While executing the below code i'm getting this 'TypeError: img is not a numerical tuple'
<pre><code>    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)
</code></pre>

<p>The error i'm getting is :</p>

<pre><code>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
</code></pre>

<p>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 <a href="https://codeplasma.com/2012/12/03/getting-webcam-images-with-python-and-opencv-2-for-real-this-time/" rel="nofollow">this link</a></p>