KananVyas / BoxDetection

A Box detection algorithm for any image containing boxes.
https://medium.com/@kananvyas/a-box-detection-algorithm-for-any-image-containing-boxes-756c15d7ed26
GNU General Public License v3.0
119 stars 53 forks source link

What could be possible reason for ValueError #6

Closed pcakhilnadh closed 4 years ago

pcakhilnadh commented 4 years ago

Find contours for image, which will detect all the boxes

im2, contours, hierarchy = cv2.findContours(img_final_bin, cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)

ValueError: not enough values to unpack (expected 3, got 2)

pcakhilnadh commented 4 years ago

In openCV 4 it returns only two parameters So the line im2, contours, hierarchy = cv2.findContours(img_final_bin, cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)

should be chnaged to

contours, hierarchy = cv2.findContours( img_final_bin, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

6 closed