Nikhil Gupta
Nikhil Gupta

Reputation: 63

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

I am recieving this error when running this line of code:

img = cv2.resize(img, (224,224)) 

OpenCV(4.1.2) C:\projects\opencv-python\opencv\modules\imgproc\src\resize.cpp:3720: error: (-215:Assertion failed) !ssize.empty() in function 'cv::resize'

Upvotes: 5

Views: 39700

Answers (2)

user15832708
user15832708

Reputation: 9

frame = cv2.resize(frame,(224,224),fx=0,fy=0, interpolation = cv2.INTER_CUBIC)

I've changed my code to this and it works for me.

Upvotes: -2

code-lukas
code-lukas

Reputation: 1651

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)

Upvotes: 13

Related Questions