I am using OpenCV 2.4.10 and python 2.7.9
I am trying to capture video from builtin webcam (Toshiba ,Windows 7) . I am using this code
import numpy as np
import cv2
cap = cv2.VideoCapture(1)
print cap.isOpened()
print cap.get(3)
print cap.get(4)
while(True):
ret,frame=cap.read()
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
And the problem is , When i first `run` this code it throws error :
`error: (-215) size.width>0 && size.height>0 in function cv::imshow`

and just after waiting for hardly one minute , i again run this code and this time it's fine

And this is happening again and again , sometimes it's work good but sometimes fails and give error.
Any solution to this ?
I copied the `opencv_ffmpeg2410.dll` file from `C:\Applications\opencv\build\x86\vc10\bin` into the python path `C:\Python27` (http://stackoverflow.com/questions/11699298/opencv-2-4-videocapture-not-working-on-windows)
↧