Ask Your Question

opencvdev's profile - activity

2016-04-07 07:56:48 -0600 received badge  Student (source)
2016-01-03 17:01:07 -0600 received badge  Famous Question (source)
2015-01-04 14:47:18 -0600 received badge  Notable Question (source)
2014-03-22 04:48:45 -0600 received badge  Popular Question (source)
2013-07-28 16:25:56 -0600 asked a question Video capture on MacBook

I'm attempting to access the build-in camera on a MacBook Pro (running OS X 10.8.3, with OpenCV 2.4.6.1) with code I found elsewhere:

int main( int argc, const char** argv ) {

CvCapture* capture = NULL;

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

cvNamedWindow("webcam", CV_WINDOW_AUTOSIZE);
cvMoveWindow("webcam", 50, 50);

IplImage* src = NULL;
for (;;)
{
    if ((src = cvQueryFrame(capture)) == NULL)
    {
        std::cerr << "!!! ERROR: vQueryFrame\n";
        break;
    }

   cvShowImage("webcam", &src);
}

cvReleaseCapture(&capture);
return 0;

}

The camera appears to be found, the green light goes on, yet the frame returned by cvQueryFrame is always NULL. What might be wrong here?

Thanks!