擅长:python、mysql、java
<p>这个问题是由不同OpenCV版本中cv2.findContours的返回值不同引起的。</p>
<p>在OpenCV 4.0.0中,这个错误可能看起来像<code>cv2.error: OpenCV(4.0.0) C:\projects\opencv-python\opencv\modules\imgproc\src\convhull.cpp:137: error: (-215:Assertion failed) total >= 0 && (depth == CV_32F || depth == CV_32S) in function 'cv::convexHull'</code></p>
<p>您可以在这里找到详细的解释和解决方案:<a href="https://stackoverflow.com/questions/48291581/how-to-use-cv2-findcontours-in-different-opencv-versions/48292371#48292371">How to use `cv2.findContours` in different OpenCV versions?</a></p>