I have the following issue: In my openCV program under Mac OS X 10.5.8 when I try to open my USB camera for video it always opens the iSight built-in camera, although I explicitly set the camera number to 1 (iSight is supposed to be 0). Furthermore, choosing camera numbers of 2, 3 etc. also opens the iSight camera, although I only have 2 cameras connected.
I tried the following
CvCapture * camera = cvCaptureFromCAM( 1 );
and
CvCapture * camera = cvCreateCameraCapture ( 1 );
They both give the same result. The interesting thing is that when I open video capture from the iSigh开发者_StackOverflow社区t camera from Skype or PhotoBooth it occupies the channel and the openCV program is forced to open the webcam channel, which works without any problems.
My question is, how can I explicitly choose the webcam in my openCV program without having to occupy the iSight channel first in another program?
Thank you.
P.S. The program works under Windows - I only tried it on a machine with 1 camera (the same webcam) but if I specify anything different than 0 or CV_CAP_ANY it crashes, so I assume it correctly searches for the camera.
Looks like the problem was just a bug in 1.1, the version I assume you're using because you're on a mac and the private framework is built with that version. I fixed the issue by pulling down the 2.1 source, building that, and linking against the dylibs there.
Grab the latest OpenCV (which is version 2.1 at this time) and try opening your device with:
if ((capture = cvCaptureFromCAM(0)) == NULL)
{
std::cerr << "!!! ERROR: vCaptureFromCAM No camera found\n";
exit(-1);
}
精彩评论