cv2.findContours 返回错误:too many values to unpack (expected 2)

今天在使用cv2.findContours报错:

too many values to unpack (expected 2)

返回是两个数值啊,但是,不同cv2版本的cv2.findContours返回值不一样,有返回三个数值的,第一个参数为原来的图像。。。
即在cv2.findContours的返回值的第一项添加image返回参数。即:

 tcl_contours, _ = cv2.findContours(tcl_mask.astype(np.uint8), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

修改为:

images, tcl_contours, _ = cv2.findContours(tcl_mask.astype(np.uint8), cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)

game over。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章