opencv Python错误:TypeError:“NoneType”对象没有属性''

2024-04-28 10:34:18 发布

您现在位置:Python中文网/ 问答频道 /正文

当我运行此代码时发生错误。。在

我找了很多遍,但找不到解决办法。在

Traceback <most recent call last>:
File "ASL.py", line 24, in <module>
img1=img[100:500, 900:1300]
TypeError: 'NoneType' object has no attribute '__getitem__'

这是ASL.py公司代码!!在

^{pr2}$

这是手语的翻译。在

我试图解决它,但我做不到。在

我应该换什么部件? 越详细越好。 我很感激你的建议。在


Tags: 代码inpymost错误linecallfile
1条回答
网友
1楼 · 发布于 2024-04-28 10:34:18

cap.read()失败,因此img是{}。从文件中:

If no frames has been grabbed (camera has been disconnected, or there are no more frames in video file), the methods return false and the functions return NULL pointer.

相关问题 更多 >