Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Finding contours
im_gray = gray(im)
im_blur = blur(im_gray)
im_thresh = threshold(im_blur)
contours, _ = cv2.findContours(im_thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)
@saeedmaham

This comment has been minimized.

Copy link

@saeedmaham saeedmaham commented Sep 3, 2020

ValueError: too many values to unpack (expected 2)

I'm having this error. How can I solve it?

Any idea.

@aniruddha27

This comment has been minimized.

Copy link
Owner Author

@aniruddha27 aniruddha27 commented Sep 3, 2020

Hi, could you try the following code because it could be possible you have a different OpenCV version.

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

@saeedmaham

This comment has been minimized.

Copy link

@saeedmaham saeedmaham commented Sep 4, 2020

Thank you
It's working now.

@aniruddha27

This comment has been minimized.

Copy link
Owner Author

@aniruddha27 aniruddha27 commented Sep 4, 2020

Welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment