Answers for "opencv(4.1.2) /io/opencv/modules/imgproc/src/resize.cpp:3720: error: (-215:assertion failed) !ssize.empty() in function 'resize'"

C++
3

OpenCV(4.5.4-dev) D:aopencv-pythonopencv-pythonopencvmodulesimgprocsrcresize.cpp:4051: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'

This error arises if you aren't giving the right path to the image, 
check extentions(.png, .jpg) 

if you are working on jupyter notebook on the folder C:/users/user 
and your desired image called Dog.png exists in C:/users/user/Folder

use this -
Image = cv2.imread("Folder/Dog.png",-1)
Posted by: Guest on November-08-2021
0

opencv(4.1.2) /io/opencv/modules/imgproc/src/resize.cpp:3720: error: (-215:assertion failed) !ssize.empty() in function 'resize'

Generally this problem occurs due to resizing of the image, I just apply try and catch statement for resizing the image so that any error handling. It is working fine and not getting error related to shape.

 img=cv2.imread(filename)
    print(img)
        try:
           img = cv2.resize(img, (1400, 1000), interpolation=cv2.INTER_AREA)
            print(img.shape)
        except:
        break
    height, width , layers = img.shape
    size=(width,height)
    print(size)
Posted by: Guest on January-27-2022

Code answers related to "opencv(4.1.2) /io/opencv/modules/imgproc/src/resize.cpp:3720: error: (-215:assertion failed) !ssize.empty() in function 'resize'"

Browse Popular Code Answers by Language