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?
Try running your program as root. You may not have permission, and opencv doesn't tell you if thats the reason cap.isOpened() failed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With