Ask Your Question

syryus92's profile - activity

2014-03-22 05:12:06 -0600 asked a question opencv problem with capture

i'm trying to acquire image from an wireless cam with EasyCAP tuner. I can get images with any other video capture programs and matlab but in opencv i get empty frames. This code worked with my laptop webcam and with a logitec webcam. With tuner it sends me in infinite loop here beacuse of empty frame.

   while (frame.empty())
          cap>>frame;

I'm using visual stuido 2010 , i have tuner on the 2nd slot(first is webcam)and my code is:

#include <opencv2/highgui/highgui.hpp>
> #include <opencv2/imgproc/imgproc.hpp>
> #include <windows.h>
> #include <stdio.h>
> 
> using namespace cv; using namespace
> std;
> 
> VideoCapture cap(1);
> 
> Mat frame; void main() {
>       char key;   namedWindow("imag", WINDOW_AUTOSIZE);   Sleep(1000);
> 
> 
> cap.set(CV_CAP_PROP_FRAME_WIDTH,160);
> cap.set(CV_CAP_PROP_FRAME_HEIGHT,120);
> cap.set(CV_CAP_PROP_FPS,15);
> cap.set(CV_CAP_PROP_FOURCC,CV_FOURCC('B',
> 'G', 'R', '3'));
> 
> 
>     while (1)
>      {
>       
>          cap>>frame;       while (frame.empty())
>             cap>>frame;
>                   imshow("imag",frame);       waitKey(33);
> 
>       } }

without set proprieties is the same