I am trying to use a Diamond VC500 usb device to capture video using OpenCV 2.4.2 in Windows 7 Ultimate, programming in c++ in Visual Studio 2010.
So far, I have the following code:
CvCapture* cap = cvCaptureFromCAM(camIndex);
if(!cap){
std::cout << "Camera not open!\n";
return -1;
}
cv::namedWindow("camera", 1);
cv::Mat frame;
while(true){
frame = cvQueryFrame(cap);
cv::imshow("camera", frame);
if(cv::waitKey(30) >= 0)
break;
}
It does just what it is supposed to, continuously capture video, but I can't choose the camera device that I want. It always defaults to my computer's built in Apple iSight camera (I'm dual booting on an iMac) no matter what value I use for "camIndex". I've used -1, 0, ... 10 and CV_CAP_ANY.
-1, 0, and CV_CAP_ANY all go straight to the iSight camera. Values 1..10 give me a light gray screen. I've tested the VC500 and I've captured video with the software it comes with, I just can't get it to work with opencv