OpenCV NoneType对象没有属性形状 [英] OpenCV NoneType object has no attribute shape
问题描述
您好,我正在使用OpenCV开发Raspberry Pi.我想尝试一个在链接中跟踪球的教程 http://www.pyimagesearch.com/2015/09/14/ball-tracking-with-opencv/
Hello I'm working on Raspberry Pi with OpenCV. I want to try a tutorial which is ball tracking in link http://www.pyimagesearch.com/2015/09/14/ball-tracking-with-opencv/
但是当我编译它时,出现一个错误:'NoneType'对象没有属性'shape'.
But when I compile it, i get an error: 'NoneType' object has no attribute 'shape'.
我该怎么办?
推荐答案
这意味着应该返回图像的某个函数刚刚返回None,因此没有shape属性.尝试 打印img" 检查您的图片是None还是实际的numpy对象.
It means that somewhere a function which should return a image just returned None and therefore has no shape attribute. Try "print img" to check if your image is None or an actual numpy object.
这篇关于OpenCV NoneType对象没有属性形状的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!