While executing the below code i'm getting this 'TypeError: img is not a numerical tuple'

Viewed 12569
    import cv2
    ram_frames=30
    cam = cv2.VideoCapture(0)
    def get_image():
          cap = cam.read()
          return cap
    for i in xrange(ramp_frames):
              temp = get_image()
    image = get_image()
    cv2.imwrite('bin/color.jpg',image)

The error i'm getting is :

File "C:\modules\imlib.py", line 1035, in __init__
    self.imin = self.WinWebCam()
  File "C:\modules\imlib.py", line 1125, in WinWebCam
    cv2.imwrite('bin/color.jpg',image)
TypeError: img is not a numerical tuple

I have done everything right i didn't change anything the code which when executed in a seperate program it's not showing any error but when run inside my code it's showing error. The code i copied is from this link

2 Answers

if np.any( initial == None): #your code It will definitely work for you. The error in this code because initial is treated as a numpy array.

I initialized initial with None in my program

Related