OpenCv not initializing usb camera

Posted by brainbarshan on Stack Overflow See other posts from Stack Overflow or by brainbarshan
Published on 2012-10-15T15:35:30Z Indexed on 2012/10/15 15:36 UTC
Read the original article Hit count: 186

Filed under:
|
|

I am trying to capture video from usb camera using OpenCv.

#include <highgui.h>
#include <iostream>

using namespace std;
using namespace cv ;

int main()
{
    VideoCapture cap (-1);
    if(!cap.isOpened())
         cout << "Cam initialize failed" ;
    else cout << "Cam initialized" ;

    return 0;
}

It is failing to initialize the camera. cap.isOpened() is returning zero. The same program, with same version of OpenCv and same usb camera, is correctly running in my friend's machine. I am running fedora 16.

I did some searching in Google and Stack Overflow. But no useful help. Any idea ?

© Stack Overflow or respective owner

Related posts about c++

Related posts about video