imread returns None, violating assertion !_src.empty() in function ‘cvtColor’ error

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

  • check if the image exists in the path you give

  • check if the count variable has a valid number

Leave a Comment