mzucker / page_dewarp

Text page dewarping using a "cubic sheet" model
https://mzucker.github.io/2016/08/15/page-dewarping.html
MIT License
1.44k stars 241 forks source link

ValueError: need more than 2 values to unpack #13

Closed rupeshchandgude closed 5 years ago

rupeshchandgude commented 5 years ago

Hello, I have ran the code as mention in comments using python page_dewarp.py Img. Following error occurred after running the code.

python page_dewarp.py IMG_20190717_114448.jpg loaded IMG_20190717_114448.jpg with size 2250x4000 and resized to 375x667 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

namdaoduy commented 5 years ago

@rupeshchandgude Same issue, and I found the solution here https://stackoverflow.com/questions/40278444/error-using-cv2-findcontours-with-python Maybe the cause of opencv version Just change the line 450: _, contours, _ = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) into contours, hierarchy = cv2.findContours(mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) Worked for me

rupeshchandgude commented 5 years ago

Thanks @namdaoduy. Now it is working for me.