我正在尝试在OpenCV中计算轮廓区域。我的版本是4.1.2.30。这是我的代码-
cnts = cv2.findContours(thresholded.copy(), cv2.RETR_EXTERNAL,
cv2.CHAIN_APPROX_SIMPLE)
cnts = cnts[1]
cnts = sorted(cnts, key=cv2.contourArea, reverse=True)
我的错误是-File "filename.py", line 70, in extract_main_table cnts = sorted(cnts, key=cv2.contourArea, reverse=True) cv2.error: OpenCV(4.1.2) /Users/travis/build/skvark/opencv-python/opencv/modules/imgproc/src/shapedescr.cpp:274: error: (-215:Assertion failed) npoints >= 0 && (depth == CV_32F || depth == CV_32S) in function 'contourArea'
我一直在尝试永远调试,但无济于事。请帮帮我!谢谢! :)