There seems to be a misconception about the 'index' parameter, see http://www.csse.uwa.edu.au
The function cvCaptureFromCAM allocates and initialized the CvCapture structure for reading a video stream from the camera. Currently two camera interfaces can be used: Video for Windows (VFW) and Matrox Imaging Library (MIL). To connect to VFW camera the parameter "index" should be in range 0-10, to connect to MIL camera the parameter "index" should be in range 100-115. If -1 is passed then the function searches for VFW camera first and then for MIL camera.
Main Topics
Browse All Topics





by: rxzangPosted on 2009-06-02 at 17:24:07ID: 24532600
/// there is some typo in previous code
/// cameraindex is a input variable to choose which camera to open
if (cameraindex==0)
{
CvCapture* capture = cvCaptureFromCAM( 0 );
}
else if (cameraindex==1)
{
CvCapture* capture = cvCaptureFromCAM( 1 );
}
else if (cameraindex==2)
{
CvCapture* capture = cvCaptureFromCAM( 2 );
}