Reputation: 99
I am writing a face recognition code using opencv, and it returns an error at this line every time I run it.
This is the line of my code:
small_frame = cv2.resize(frame, None, fx=0.5, fy=0.5, interpolation=cv2.INTER_AREA)
The error it throws:
cv2.error: OpenCV(4.1.2) /io/opencv/modules/imgproc/src/resize.cpp:3720: error: (-215:Assertion failed) !ssize.empty() in function 'resize'
I think I could solve it if I can find this file named resize.cpp
, but I don't know how to do it either.
Upvotes: 1
Views: 299
Reputation: 93410
That error means that frame
is empty. There is no image!
if (frame is None):
print('!!! EMPTY IMAGE')
sys.exit(0)
small_frame = cv2.resize(frame, None, fx=0.5, fy=0.5, interpolation=cv2.INTER_AREA)
Upvotes: 2