-
Notifications
You must be signed in to change notification settings - Fork 5.5k
fix "ValueError: too many values to unpack" at cv2.findContours #9
Conversation
It could also be made backwards compatible with OpenCV 2, with a try/except like this: |
Thanks for the PR @katotetsuro, looks great! Thanks for the suggestion @jasonbunk. Providing backward compatibility with OpenCV 2 is outside the scope of this PR. I'm also not sure if there is a net benefit in maintaining the backward compatibility but we can discuss that in another issue/PR. |
@caffe2bot test this please. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ir413 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Hi @katotetsuro, we're having some issues with merging this PR internally. Could you please rebase the changes onto a fresh pull of Detectron? Sorry for the inconvenience. |
d532960
to
2322b9f
Compare
Hi @ir413, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ir413 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Thanks @katotetsuro, the update looks great! |
LGTM |
With opencv 4.0.0 the convention seems to have changed again so this fix breaks. Downgrading to 3.2.0 fixed it for me. It would be good to reflect this in the requirements. |
Thanks @aishwaryap . I've made #847 which should have addressed this. |
Summary: OpenCV 2, 3, 4 have different signatures for this function. Using [-2] is compatible with them. Pull Request resolved: #847 Reviewed By: rbgirshick Differential Revision: D14703716 Pulled By: ir413 fbshipit-source-id: 7329c5d45a0b0d2a3125198e6ac64bc79b42ff46
Summary: This PR fix the issue vis_one_image_opencv raises ValueError. >Since OpenCV 3.2, findContours() no longer modifies the source image but returns a modified image as the first of three return parameters. https://docs.opencv.org/3.3.1/d4/d73/tutorial_py_contours_begin.html and this line also assumes opencv>=3.2 https://github.com/facebookresearch/Detectron/blob/master/lib/utils/vis.py#L326 so, It may be better to set OpenCV version specification to 3.2 or higher in Installation guide. Closes facebookresearch/Detectron#9 Reviewed By: rbgirshick Differential Revision: D7009465 Pulled By: ir413 fbshipit-source-id: 3b2cea6c94da1de93927a6d11724f104c063dca1
This PR fix the issue vis_one_image_opencv raises ValueError.
and this line also assumes opencv>=3.2
https://github.com/facebookresearch/Detectron/blob/master/lib/utils/vis.py#L326
so, It may be better to set OpenCV version specification to 3.2 or higher in Installation guide.