Skip to content
Advertisement

OPENCV – !ssize.empty()

THIS IS MY CODE:

JavaScript

Guys, this is the part of my code. I am trying to resize my image but ıt gives the following error:

error: OpenCV(4.0.1) C:ciopencv-suite_1573470242804workmodulesimgprocsrcresize.cpp:3784: error: (-215:Assertion failed) !ssize.empty() in function ‘cv::resize’

Do you have any suggestions to solve this?

Advertisement

Answer

If I’m not mistaken, you want to resize the video frames with the same size of imgTarget

You can solve with two-steps


    1. Check whether the video is opened
    1. If the video is opened then resize

First you should be checking whether your video can be opened

JavaScript

Now you need to check whether the current frame returns

JavaScript

Now resize

JavaScript

If you want to display you can use imshow

JavaScript

Make sure to release the cap and Vid variables at the end of the code.

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