close

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

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error OpenCV(4.1.2) error: (-215:Assertion failed) !ssize.empty() in function ‘cv::resize’ in Python. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

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

Today I get the following error OpenCV(4.1.2) error: (-215:Assertion failed) !ssize.empty() in function ‘cv::resize’ in Python.

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

  1. How To Solve OpenCV(4.1.2) error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize' Error ?

    To Solve OpenCV(4.1.2) error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize' Error It is an error that can not be received from the camera or movie file. Make sure that the video file name is the same as the code and that it is in the same directory.

Solution 1

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)

Solution 2

It is an error that can not be received from the camera or movie file. Make sure that the video file name is the same as the code and that it is in the same directory.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment