I am trying to capture video from a 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 the same USB camera, is correctly running in my friend's machine. I am running Fedora 16. The camera is properly working in another application (for example, Cheese).
I did some searching in Google and Stack Overflow. But no useful help. Any idea?