How can i solve this error

error: 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’

Could you please attach the code you are using?

The error seems to be because the image you want to convert to another color model has been loaded incorrectly.

Good Luck!

1 Like

please check the image returned from imread() (or cap.read())
for None, or the np.shape() for ()

opencv’s io silently returns invalid Mats on failure

try this search: https://stackoverflow.com/search?tab=votes&q=!_src.empty()%20cvtcolor