【发布时间】:2018-03-21 00:50:53
【问题描述】:
我正在尝试完成 OpenCV 教程,并且正在使用提供的源代码。我遇到了这个错误:
文件“C:\xxx\xxxxxxx\Desktop\basic-motion-detection\motion_detector.py”,第 61 行,在 cv2.CHAIN_APPROX_SIMPLE) ValueError:解包的值太多。
代码如下:
# on thresholded image
thresh = cv2.dilate(thresh, None, iterations=3)
(cnts, _) = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL,
cv2.CHAIN_APPROX_SIMPLE)`
【问题讨论】:
-
看起来您正在使用 OpenCV 3.x(下次请指定版本),但编写的代码是为 2.x 准备的。某些 API 已更改。如有疑问,您可以随时使用
help。 -
另见stackoverflow.com/questions/20851365/…,用户遇到了相反的问题。