Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

cv2.VideoCapture(1) error.

$
0
0
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` ![image description](/upfiles/14531075361581442.jpg) and just after waiting for hardly one minute , i again run this code and this time it's fine ![image description](/upfiles/14531076171850609.jpg) 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)

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>