cv2.findContours()报错ValueError: not enough values to unpack (expected 3, got 2)解决方案
一、报错
Traceback (most recent call last):
File "C:/Users/Desktop/GMM/GMM.py", line 22, in
im, contours, hierarchy = cv2.findContours(fgmask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
ValueError: not enough values to unpack (expected 3, got 2)
二、分析 原因是 cv2.findContours()的opencv返回值不一致报错,旧版本返回3个值,而新版本返回2个值,
三、解决方案 将
im, contours, hierarchy = cv2.findContours(fgmask, cv2.RETR_EXTERNAL, cv2.
cv2.findContours()报错ValueError: not enough values to unpack (expected 3, got 2)解决方案最先出现在Python成神之路。
共有 0 条评论