Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

incompatible with recent opencv versions? #9

Open
jprobichaud opened this issue Apr 2, 2019 · 3 comments
Open

incompatible with recent opencv versions? #9

jprobichaud opened this issue Apr 2, 2019 · 3 comments

Comments

@jprobichaud
Copy link

jprobichaud commented Apr 2, 2019

It's a very nice project you have here.

I tried to run the project on ArchLinux with opencv 4 installed and with a virtualenv just for page_dewarp and I get the following error:

(venv) $ python page_dewarp.py example_input/boston_cooking_a.jpg 
loaded boston_cooking_a.jpg with size 2448x3264 and resized to 490x653
Traceback (most recent call last):
  File "page_dewarp.py", line 915, in <module>
    main()
  File "page_dewarp.py", line 867, in main
    cinfo_list = get_contours(name, small, pagemask, 'text')
  File "page_dewarp.py", line 450, in get_contours
    cv2.CHAIN_APPROX_NONE)
ValueError: need more than 2 values to unpack

Any idea?

@YagnikThanki
Copy link

Hii @jprobichaud ,
In latest opencv version findContour returns only two values instead of three so you have to modity get_contours function. Here is official document of opencv 4.0.
LINK: https://docs.opencv.org/4.0.0/d3/dc0/group__imgproc__shape.html#gadf1ad6a0b82947fa1fe3c3d497f260e0

@githubization
Copy link

githubization commented Dec 29, 2019

Got the same error, with opencv 4.0
Just to echo here: the number of output variables was changed back to 2, apparently, in opencv 4.0
I got past the error after changing the line to:

contours, hierarchy = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)

("contours" is now the /first/ value)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants