gpt4 book ai didi

python - 类型错误 : 'NoneType' object has no attribute '__getitem__15'

转载 作者:太空宇宙 更新时间:2023-11-03 18:27:39 25 4
gpt4 key购买 nike

大家好,我想运行 camshift 算法,但在运行时出现错误。错误是:

Traceback (most recent call last):
File "C:\Python27\code\extra algorithms\Camshift in OpenCV.py", line 11, in <module>
roi = frame[r:r+h, c:c+w] TypeError: 'NoneType' object has no attribute '__getitem__10'

`

最佳答案

可能frame是无。所以你不能像 frame[r:r+h, c:c+w] 中那样对它进行索引。您应该初始化该变量或处理它为 None 的情况。

关于python - 类型错误 : 'NoneType' object has no attribute '__getitem__15' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22898546/

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