Answers for "v2.error: opencv(4.1.2) /io/opencv/modules/imgproc/src/canny.cpp:829: error: (-215:assertion failed) _src.depth() == cv_8u in function 'canny'"

-1

cv2.error: OpenCV(4.3.0) /io/opencv/modules/imgproc/src/drawing.cpp:2374: error: (-215:Assertion failed) p.checkVector(2, CV_32S) >= 0 in function 'fillPoly'

new_img = cv2.fillPoly(blank_img,[cnt],color =(255,255,255))

I was facing error in this line.

so The solution is make sure "cnt" must be int not float.

CHANGES:
cnt = np.array([[50,50], [50,150], [150,150], [150,50]],dtype=np.int32)
Posted by: Guest on May-26-2021

Code answers related to "v2.error: opencv(4.1.2) /io/opencv/modules/imgproc/src/canny.cpp:829: error: (-215:assertion failed) _src.depth() == cv_8u in function 'canny'"

Browse Popular Code Answers by Language