所以我在更新所有软件包后收到此错误。
<ipython-input-48-e9a9716d4b8c> in extractText(path)
15 plt.show()
16
---> 17 img, contours, hierarchy = cv2.findContours(edged, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)
18 contours = sorted(contours, key=cv2.contourArea, reverse=True)
19
ValueError: not enough values to unpack (expected 3, got 2)
最佳答案
在openCV4中,cv2.findContours()
返回2个值contours, hierarchy
,因此应为:
contours, hierarchy = cv2.findContours(edged, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE)
关于python-3.x - ValueError:没有足够的值使用OpenCV中的Contour解包(预期3,得到2),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54435296/