cvCreateCameraCapture returns null

前端 未结 2 1681
旧巷少年郎
旧巷少年郎 2020-12-12 07:22

I\'ve got a webcam which is working perfectly in vlc, and is available as /dev/video0. However, whenever I use cvCreateCameraCapture, it returns null. I\'ve used 0,1,-1 as i

2条回答
  •  萌比男神i
    2020-12-12 07:57

    I'm using OpenCV 2.1 on Ubuntu 9.04 and this works fine:

    CvCapture* capture = NULL;
    if ((capture = cvCaptureFromCAM(-1)) == NULL)
    {
        std::cerr << "!!! ERROR: cvCaptureFromCAM No camera found\n";
        return -1;
    }
    

    Note that I'm using cvCaptureFromCAM() instead of cvCreateCameraCapture().

提交回复
热议问题