AI软件下载
有趣网站推荐及实用软件下载

face_img = cv2.resize(face_img, (width, height))cv2.error: OpenCV(4.10.0) :-1: error: (-5:Bad argument) in function 'resize'

今天在调试应用EchoMimic的时候,运行webui脚本,应用报错了,部分错误信息如下:

Traceback (most recent call last):

File “D:\python\EchoMimic\myenv\lib\site-packages\anyio_backends_asyncio.py”, line 2441, in run_sync_in_worker_thread
return await future
File “D:\python\EchoMimic\myenv\lib\site-packages\anyio_backends_asyncio.py”, line 943, in run
result = context.run(func, args) File “D:\python\EchoMimic\myenv\lib\site-packages\gradio\utils.py”, line 846, in wrapper response = f(args, **kwargs)
File “D:\python\EchoMimic\gradio_app.py”, line 34, in infer_a2v
path_video = infer(
File “D:\python\EchoMimic\my_infer_audio2vid.py”, line 214, in infer
face_img = cv2.resize(face_img, (width, height))
cv2.error: OpenCV(4.10.0) :-1: error: (-5:Bad argument) in function ‘resize’

Overload resolution failed:

  • src is not a numerical tuple
  • Expected Ptrfor argument ‘src’

意思是传递给cv2.resize的不是有效的图像数组数据,原代码如下:

face_img = crop_and_pad(face_img, crop_rect)
face_mask = crop_and_pad(face_mask, crop_rect)                
face_img = cv2.resize(face_img, (width, height))
face_mask = cv2.resize(face_mask, (width, height))

代码修改方式如下:

face_img,_ = crop_and_pad(face_img, crop_rect)
face_mask,_ = crop_and_pad(face_mask, crop_rect)                
face_img = cv2.resize(face_img, (width, height))
face_mask = cv2.resize(face_mask, (width, height))

问题解决,不再报错

1V1答疑支持
爱发电:点击前往
赞(0) 打赏
文章名称:《face_img = cv2.resize(face_img, (width, height))cv2.error: OpenCV(4.10.0) :-1: error: (-5:Bad argument) in function 'resize'》
文章链接:https://nuowa.net/815
本站原创文章未经允许不得转载,分享资源仅供个人学习研究,不可用于违法违规用途,否则法律问题自行承担。

最新发布

觉得文章对你有帮助就打赏一下作者

非常感谢你的打赏,我将有更多的动力继续提供优质内容,让我们一起创建更加美好的世界!

支付宝扫一扫

微信扫一扫