OpenCV NoneType object has no attribute shape
<p>Hello I'm working on Raspberry Pi with OpenCV. I want to try a tutorial which is ball tracking in link
<a href="http://www.pyimagesearch.com/2015/09/14/ball-tracking-with-opencv/" rel="nofollow">http://www.pyimagesearch.com/2015/09/14/ball-tracking-with-opencv/</a></p>

<p>But when I compile it, i get an error: 'NoneType' object has no attribute 'shape'.</p>

<p>What should I do?</p>

<p>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.</p>

python opencv raspberry-pi2