Cv2 Image Error: Error: (-215:Assertion Failed) !Ssize.Empty() in Function 'Cv::Resize'

error: OpenCV(4.1.0) error: (-215:Assertion failed) !ssize.empty() in function 'cv::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)

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

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)

How to solve error (-215:Assertion failed) !ssize.empty() in function 'resize'?

The path to you test images is broken. The error comes as a result of cv2 trying to resize on empty numpy array. You should check the path to the test dataset (ensure the image_paths are reachable)

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

I solved the issue by changing the code from recv_string() to recv_pyobj() and from send() to send_pyobj() and the code works perfectly fine. Thanks



Related Topics



Leave a reply



Submit