error: (-215:Assertion failed) npoints >= 0 && (depth == CV_32F || depth == CV_32S) in function ‘poi

今天遇到的问题
报错:error: (-215:Assertion failed) npoints >= 0 && (depth == CV_32F || depth == CV_32S) in function ‘pointSetBoundingRect’
原代码

contours = contours[0] if imutils.is_cv2() else contours[1]
(x, y, w, h) = cv2.boundingRect(cnt)

报错指向的是第二行

修改后

contours = contours[0]
(x, y, w, h) = cv2.boundingRect(cnt) 

感谢
https://blog.csdn.net/prolrj2015/article/details/90173782?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522163290372116780271539651%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=163290372116780271539651&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allfirst_rank_ecpm_v1~rank_v31_ecpm-13-90173782.pc_search_result_cache&utm_term=error%3A+%28-215%3AAssertion+failed%29+npoints+%3E%3D+0+%26%26+%28depth+%3D%3D+CV_32F+%7C%7C+depth+%3D%3D+CV_32S%29+in+function+%27cv%3A%3ApointSetBoundingRect%27&spm=1018.2226.3001.4187

你可能感兴趣的:(报错,深度学习,神经网络,opencv)