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

Error: Need more than 2 values to unpack #16

Open
stevethearkiv opened this issue Jan 23, 2020 · 2 comments
Open

Error: Need more than 2 values to unpack #16

stevethearkiv opened this issue Jan 23, 2020 · 2 comments

Comments

@stevethearkiv
Copy link

Sorry I cannot get this to work, and there is nothing in the readme about additional values?

Cheers for any help you can give me

loaded boston_cooking_a.jpg with size 2448x3264 and resized to 490x653
Traceback (most recent call last):
File "../page_dewarp.py", line 915, in
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

@Andry-Bal
Copy link

In earlier versions of openCV function findContours() used to return 3 values (image, contours, hierarchy). In openCV 4 it returns two values (contours, hierarchy) and this is what causing the error. Just use openCV 3.

@bjornmosten
Copy link

bjornmosten commented Apr 9, 2020

You can also just remove the first _ on line 450, making the line

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

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

3 participants