[英]How to fix Opencv arcLength function error: (-215:Assertion failed)
The following code is giving me the following error:以下代码给了我以下错误:
contours = cv2.findContours(horizontal_lines_canvas, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)
contours = contours[1]
contours = sorted(contours, key=lambda c: cv2.arcLength(c, True), reverse=True)[:2]
ERROR:错误:
cv2.error: OpenCV(4.0.0) /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/shapedescr.cpp:237: error: (-215:Assertion failed) count >= 0 && (depth == CV_32F || depth == CV_32S) in function 'arcLength' cv2.error:OpenCV(4.0.0)/Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/shapeescr.cpp:237:错误:(-215:断言失败)计数> = 0 && (depth == CV_32F || depth == CV_32S) 在 function 'arcLength'
Why so?为什么这样? All seems correct一切似乎都是正确的
Thank you, HansHirse.谢谢你,汉斯希尔斯。
Replaced with:替换为:
contours, hierarchy = cv2.findContours(..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.