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.
You are always setting Frame
to 0
(grabbed, Frame) = camera.read(), 0
grabbed
gets output of camera.read()
and Frame
gets 0. For and int
, np.size
returns 1.