gpt4 book ai didi

python-3.x - 人脸识别opencv断言失败

转载 作者:行者123 更新时间:2023-12-02 10:45:01 25 4
gpt4 key购买 nike

我正在使用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: error: (-215:Assertion failed) !ssize.empty() in function 'resize'



我想我可以找到名为 resize.cpp的文件来解决它,但是我也不知道该怎么做。

最佳答案

该错误意味着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)

关于python-3.x - 人脸识别opencv断言失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60015062/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com