環(huán)境:
python3.6.4
opencv3.4.1.15
運行目標跟蹤object_tracking文件夾中的mean函數(shù)時報錯且不顯示視頻結果
Traceback (most recent call last):
File "F:\pycharm_python\projects\project_python_test\object_tracking\main.py", line 15, in <module>
height, width, _ = frame.shape
AttributeError: 'NoneType' object has no attribute 'shape'
查找原因基本上看見三個
1.圖片不存在(路徑不存在, 路徑包含中文無法識別) 2.讀取的圖片內(nèi)容和默認讀取時參數(shù)匹配不匹配。(默認讀取的是3通道的彩色圖)例如讀取到的圖片是灰度圖,就會返回None。3.也可能是路徑中有中文(59條消息) AttributeError: 'NoneType' object has no attribute 'shape'_旅人_Eric的博客-CSDN博客文章來源:http://www.zghlxwxcb.cn/news/detail-426412.html
自己分析了一下,肯因為程序中是相對路徑,文章來源地址http://www.zghlxwxcb.cn/news/detail-426412.html
cap =cv2.VideoCapture("highway.mp
到了這里,關于報錯AttributeError: ‘NoneType‘ object has no attribute ‘shape‘的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!