我正在使用opencv编写人脸识别代码,每次运行它都会在此行返回错误。
这是我的代码行:
small_frame = cv2.resize(frame, None, fx=0.5, fy=0.5, interpolation=cv2.INTER_AREA)
它引发的错误:
cv2.error:OpenCV(4.1.2) /io/opencv/modules/imgproc/src/resize.cpp:3720:错误:(-215:Assertion 失败)!函数'resize'中的!ssize.empty()
如果我可以找到名为resize.cpp
的文件,我想我可以解决它,但是我也不知道该怎么做。
答案 0 :(得分:2)
该错误表示frame
为空。没有图像!
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)