dhlab-epfl / dhSegment

Generic framework for historical document processing
https://dhlab-epfl.github.com/dhSegment
GNU General Public License v3.0
370 stars 116 forks source link

ValueError: too many values to unpack (expected 2) #46

Closed asifamin48 closed 5 years ago

asifamin48 commented 5 years ago

In Demo folder when i run interactive_demo.ipynb

When i run the code : pred_page_coords = boxes_detection.find_boxes(bin_upscaled.astype(np.uint8, copy=False), mode='min_rectangle', n_max_boxes=1)

i get the error:

ValueError Traceback (most recent call last)

in () 1 pred_page_coords = boxes_detection.find_boxes(bin_upscaled.astype(np.uint8, copy=False), mode='min_rectangle', n_max_boxes=1) ----> 2 /content/dh_segment/post_processing/boxes_detection.py in find_boxes(boxes_mask, mode,min_area, p_arc_length, n_max_boxes) 26 'Input mask must be a 2D array ! Mask is now of shape {}'.format(boxes_mask.shape) 27 ---> 28 contours, _ = cv2.findContours(boxes_mask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) 29 if contours is None: 30 print('No contour found') **ValueError: too many values to unpack (expected 2)**
solivr commented 5 years ago

Can you please check that you are using opencv >= 4.0 ?

import cv2
cv2.__version__