Commit a22302de authored by katotetsuro's avatar katotetsuro Committed by Facebook Github Bot

fix "ValueError: too many values to unpack" at cv2.findContours

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 https://github.com/facebookresearch/Detectron/pull/9

Reviewed By: rbgirshick

Differential Revision: D7009465

Pulled By: ir413

fbshipit-source-id: 3b2cea6c94da1de93927a6d11724f104c063dca1
parent 021685d4
......@@ -104,7 +104,7 @@ def vis_mask(img, mask, col, alpha=0.4, show_border=True, border_thick=1):
img[idx[0], idx[1], :] += alpha * col
if show_border:
contours, _ = cv2.findContours(
_, contours, _ = cv2.findContours(
mask.copy(), cv2.RETR_CCOMP, cv2.CHAIN_APPROX_NONE)
cv2.drawContours(img, contours, -1, _WHITE, border_thick, cv2.LINE_AA)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment