danvk / oldnyc

Mapping photos of Old New York
Apache License 2.0
288 stars 130 forks source link

too many values to unpack #118

Open kdiogenes opened 6 years ago

kdiogenes commented 6 years ago

I'm getting this error when trying to run the script https://github.com/danvk/oldnyc/blob/master/ocr/tess/crop_morphology.py:

$: ./crop_morphology.py untitled.jpg
untitled.jpg too many values to unpack

Any hint of what can be the issue?

ecit241 commented 6 years ago

the same problem to u

kdiogenes commented 6 years ago

I find that the problem is in the call cv2.findContours. Maybe the script uses opencv2, from my distro repos I only find opencv3, but I have not had time to read the documentation.

juliomax commented 6 years ago

in older versions cv2.findContours return 2 values in new versions of opencv, this funcion return 3 values, so you have to update the code to receive these 3 values: Ex: from contours, hierarchy = cv2.findContours to something like this: _, contours, hierarchy = cv2.findContours