Answers for "opencv(4.5.5) d:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:assertion failed) !_src.empty() in function 'cv::cvtcolor"

3

cv2.error: OpenCV(4.5.3) C:UsersrunneradminAppDataLocalTemppip-req-build-q3d_8t8eopencvmodulesimgprocsrccolor.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

Try Giving Full Path. 
This seems to be the path issue in windows. 
I changed it to a full path like this and it worked.

filename = "D:SandboxGithubopencv-projectResourcesPhotoscats.jpg"
Posted by: Guest on July-29-2021
-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 "opencv(4.5.5) d:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\color.cpp:182: error: (-215:assertion failed) !_src.empty() in function 'cv::cvtcolor"

Browse Popular Code Answers by Language