Skip to content
Advertisement

OpenCV(4.1.2) error: (-215:Assertion failed) !ssize.empty() in function ‘cv::resize’

I am recieving this error when running this line of code:

img = cv2.resize(img, (224,224)) 

OpenCV(4.1.2) C:projectsopencv-pythonopencvmodulesimgprocsrcresize.cpp:3720: error: (-215:Assertion failed) !ssize.empty() in function ‘cv::resize’

Advertisement

Answer

Your img variable is empty, you probably didn’t load the image correctly. Try printing your img.shape after you load your image. Then have a look at the path you specified, there is probably something wrong with it. (Either you misspelled something or the file doesn’t exist in that directory)

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement