cv2.error: OpenCV(4.3.0) /private/var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/pip-req-build-x_mm3_2c/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor' code example

Example: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor'

This error happened because the image didn't load properly.
So you have problem with the previous line cv2.imread my suggestion is :

check if the images exist in the path you give

check the count variable if he have valid number

Tags:

Misc Example