i am writing a face dection program in opencv. And this is the error code below:
result = img[rects[0]:rects[1], rects[2]:rects[3]]
result = cv2.resize(result, (100,100))
img is our original picture and the first step is croping out our rigion of interest into result. The second step is resize to 100*100 pixels.
the error is:
result = cv2.resize(result, (100,100))
error: ..\..\..\src\opencv\modules\imgproc\src\imgwarp.cpp:1725: error: (-215) ssize.area() > 0
Hope someone can help me. Thanks a lot.
To resize an image, you call the resize() method on it, passing in a two-integer tuple argument representing the width and height of the resized image. The function doesn't modify the used image; it instead returns another Image with the new dimensions.
The first step is to create an object of the DNN superresolution class. This is followed by the reading and setting of the model, and finally, the image is upscaled. We have provided the Python and C++ codes below. You can replace the value of the model_path variable with the path of the model that you want to use.
In this tutorial, you will learn how to resize an image using OpenCV and the cv2. resize function. Scaling, or simply resizing, is the process of increasing or decreasing the size of an image in terms of width and height.
Had the same error in python ,found that image was empty so check whether imread worked or not by using imshow or checking it for NULL then use cv2.resize .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With