3

I'm trying to run the following script on windows: https://github.com/mzucker/page_dewarp.

It requires scipy, numpy, pillow and OpenCV.

I have no experience with python, I have downloaded WinPython (http://winpython.github.io/), which includes scipy, numpy and pillow and also installed OpenCV 3.2 for Python 3.5 following the instructions found here: https://pythonarena.wordpress.com/2016/03/07/scientific-python-on-windows/.

Now I'm trying to run the script using the command page_dewarp.py IMAGE1, as indicated by the developer, but it results in a syntax error.

Could you explain if there is something missing or wrong and, eventually, how to do to make it work properly?

Thank you!

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
qwertxyz
  • 143
  • 1
  • 7
  • I have been trying to get this script to work too. I think there are some other changes that occurred in the modules he imports during the transition from python 2 to 3. I can't quite be sure but I think it might be in the way division changed and that's effecting the way his bumpy arrays work. Once I figure out more I'll try to get back to you – Jared VanderVeen Sep 24 '20 at 18:43

4 Answers4

3

page_dewarp.py contains print statements, so it will not work with Python 3.

Warren Weckesser
  • 110,654
  • 19
  • 194
  • 214
  • With Python 2.7 it gives the following error: ImportError: numpy.core.multiarray failed to import Traceback (most recent call last): File "C:\WinPython27\pagedewarp\page_dewarp.py", line 15, in import cv2 ImportError: numpy.core.multiarray failed to import – qwertxyz Feb 01 '17 at 15:17
1

Try putting braces around the content of print statements as:

print 'abc'

to

print('abc')

This should solve the syntax problem. You might need to install scipy. This can be done using

pip install scipy
Beginner
  • 61
  • 11
0

After cloning the repo, Just checkout 'support-python3' branch. It supports the python3 and OpenCV4.

git checkout support-python3
-1

page_dewarp.py is in python2.
You just need to convert it into python3.
Just copy all content of that file and convert it into python3 code by using this website. And then replace the content of that file with converted code.

Navpreet Devpuri
  • 503
  • 4
  • 19