usage of findContours causes ValueError: not enough values to unpack (expected 3, got 2)
usage of findContours causes ValueError: not enough values to unpack (expected 3, got 2)
我正在使用 RaspberryPi 3
我正在尝试 运行 This 代码
显示以下错误
Waiting for video to adjust... Done.
Waiting for motion.
Waiting for video to adjust... Done.
Waiting for motion.
Traceback (most recent call last):
File "/home/pi/Tracking-Turret/turret.py", line 418, in <module> t.motion_detection(show_video=True)
File "/home/pi/Tracking-Turret/turret.py", line 273, in motion_detection VideoUtils.find_motion(self.__move_axis, show_video=show_video)
File "/home/pi/Tracking-Turret/turret.py", line 134, in find_motion c = VideoUtils.get_best_contour(thresh.copy(), 5000)
File "/home/pi/Tracking-Turret/turret.py", line 158, in get_best_contour im, contours, hierarchy = cv2.findContours(imgmask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
ValueError: not enough values to unpack (expected 3, got 2)
这是版本变更。在 OpenCV 4.4 之前,findCounters
做了 return 三件事。较新的版本 return 2:contours
和 hierarchy
.
https://docs.opencv.org/4.4.0/d3/dc0/group__imgproc__shape.html#gadf1ad6a0b82947fa1fe3c3d497f260e0
我正在使用 RaspberryPi 3 我正在尝试 运行 This 代码 显示以下错误
Waiting for video to adjust... Done.
Waiting for motion.
Waiting for video to adjust... Done.
Waiting for motion.
Traceback (most recent call last):
File "/home/pi/Tracking-Turret/turret.py", line 418, in <module> t.motion_detection(show_video=True)
File "/home/pi/Tracking-Turret/turret.py", line 273, in motion_detection VideoUtils.find_motion(self.__move_axis, show_video=show_video)
File "/home/pi/Tracking-Turret/turret.py", line 134, in find_motion c = VideoUtils.get_best_contour(thresh.copy(), 5000)
File "/home/pi/Tracking-Turret/turret.py", line 158, in get_best_contour im, contours, hierarchy = cv2.findContours(imgmask, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
ValueError: not enough values to unpack (expected 3, got 2)
这是版本变更。在 OpenCV 4.4 之前,findCounters
做了 return 三件事。较新的版本 return 2:contours
和 hierarchy
.
https://docs.opencv.org/4.4.0/d3/dc0/group__imgproc__shape.html#gadf1ad6a0b82947fa1fe3c3d497f260e0