No success trying to grab images from my built-in MacBook Pro Cam

asked 2013-08-01 06:03:56 -0600

SHoehn gravatar image

Hi,

I am desperately looking for a solution to make my builtin cam working. No matter which settings I try, it does not put on the green light.

This is my main method for testing purposes:

VideoCapture capture_;
capture_.open(0);
Mat img;

if (capture_.isOpened()) {
    printf("Is open!\n");
    sleep(2); // I read somewhere that open takes some time
    Mat frame;
    printf("Codec: %f\n", capture_.get(CV_CAP_PROP_FOURCC));  // this one is 0.0000
    capture_.set(CV_CAP_PROP_FOURCC, CV_FOURCC('M','J','P','G'));
    printf("Codec: %f\n", capture_.get(CV_CAP_PROP_FOURCC));  // it is still 0.0000
    capture_ >> frame;
    // capture_.read(img);  // they both fail
    imshow("Test", frame);
    waitKey(0);
} else {
    printf("Is not open!\n");
}

The cam seems to open correctly (but no green light indicating that). When I try to read from the cam I get an empty image. I found some sources on the web that claimed that I need QuickTime support for the cam to work. But I did not succeed in compiling with QuickTime on OSX 10.8.

Does anyone have further ideas?

Thanks and best regards,

Sebastian

edit retag flag offensive close merge delete

Comments

1

Which OpenCV version are you using? There were many errors that got fixed. Make sure you are trying to build openCV 2.4.6.1

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-01 06:05:36 -0600 )edit

Just two small hints: If opening takes some time, it's not useful to put the sleep() after the if-clause, because it already passed the relevant point. Second, make sure you have properly initialised opencv ( OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_5, ...))

Alexander Pacha gravatar imageAlexander Pacha ( 2013-08-05 07:27:25 -0600 )edit

I have the same problem. Running OpenCV 2.4.6.1, it won't open the isight camera. Anyone found a solution?

alex_a gravatar imagealex_a ( 2013-09-27 15:06:42 -0600 )edit