To Fix cv2.error: OpenCV(4.5.2) color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function ‘cv::cvtColor’ Error just Read the image with opencv. To solve this error firstr of all pass this statement > cv2.cvtColor() After passing the above statement read the image with opencv by given below command: img = cv2.imread(img_path) And at the last try this. By using this you can solve your error. > print(img) or print(img.shape)