Skip to content Skip to sidebar Skip to footer

Python 3.8.5 Cv2 -215:assertion Failed

Error: Build\OpenCV\opencv-4.4.0\modules\imgproc\src\color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cv::cvtColor' Code: import cv2 # Load the cascade f

Solution 1:

This error shows up when the image you are passing to it is empty i.e. OpenCV is not able to read the image. Are you sure that the test.jpg is in the same directory as this code?

Check the extension. It might be jpeg.

You have two options -

  1. Give the complete path in the cv2.imread function.
  2. Move the image to the directory in which your code exists.

Post a Comment for "Python 3.8.5 Cv2 -215:assertion Failed"