I'm trying to run my code using python 2.7, and OpenCV 3.3, but I`m running into the following error:
Traceback (most recent call last): File "CameraTest.py", line 52, in height = np.size(Frame,0) File "/usr/lib/python2.7/dist-packages/numpy/core/fromnumeric.py", line 2700, in size return asarray(a).shape[axis] IndexError: tuple index out of range
These are some of the code lines:
47 for i in range(0,20):
48 (grabbed, Frame) = camera.read(), 0
49
50 while True:
51 (grabbed, Frame) = camera.read(), 0
52 height = np.size(Frame,0)
53 width = np.size(Frame,1)
54 if not grabbed:
55 break
56
57 frame = camera.read()
58 frame = imutils.resize(frame, width=400)
Also read what the fromnumeric.py file had to say, and have no clue to what is my problem, I'm really lost in my Python here, been struggling with this error for some days now, and I couldn't find the answer by myself or searching. Can anyone help? Thanks in advance.
print(Frame)? It seem you're assigning int0toFrame.camera.read()is and 0 to grabbed and Framed for 20 times. Note that only the final time counts. And then in the while loop you're doing this again, except it fails after the first time since0does not have a shape. The for loops did not accomplish anything as you overwrotegrabbed, Framefirst thing in your while loop.