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

18,726

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)

Share:
18,726
Admin
Author by

Admin

Updated on June 05, 2022

Comments

  • Admin
    Admin almost 2 years

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

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

    OpenCV(4.1.2) C:\projects\opencv-python\opencv\modules\imgproc\src\resize.cpp:3720: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'