Python OpenCV——函数 cv2.findContours 运行错误【in function ‘cv::pointSetBoundingRect‘】解决方案
問題描述
cv2.error: OpenCV(4.5.1) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-r2ue8w6k\opencv\modules\imgproc\src\shapedescr.cpp:874: error: (-215:Assertion failed) npoints >= 0 && (depth == CV_32F || depth == CV_32S) in function 'cv::pointSetBoundingRect'
or
ValueError: not enough values to unpack (expected 3, got 2)?
解決方案
In OpenCV 3.4:
image, contours, hierarchy= cv2.findContours(image, mode, method[, contours[, hierarchy[, offset]]])修改為
In OpenCV 4.0:
contours, hierarchy= cv2.findContours(image, mode, method[, contours[, hierarchy[, offset]]])參考文章?
error: (-215:Assertion failed) npoints >= 0 && (depth == CV_32F || depth == CV_32F || depth ==CV_32S
OpenCV Assertion failed: (-215:Assertion failed) npoints >= 0 && (depth == CV_32F || depth == CV_32S)
總結
以上是生活随笔為你收集整理的Python OpenCV——函数 cv2.findContours 运行错误【in function ‘cv::pointSetBoundingRect‘】解决方案的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Typora——恢复未保存文件解决方案
- 下一篇: Python——基于OpenCV获取倾斜