[Solved]: error: OpenCV(4.1.2) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

This error occurs because the image is not loaded correctly. So there is a problem in the previous line cv2.imread,

my suggestion is:

  • Check if the image is in the path you specified
  • Check if the count variable has a valid number