Ask Your Question

tbabb's profile - activity

2020-03-01 13:08:57 -0500 received badge  Famous Question (source)
2018-08-11 10:06:39 -0500 received badge  Notable Question (source)
2018-08-11 10:06:39 -0500 received badge  Popular Question (source)
2015-11-03 01:35:40 -0500 received badge  Editor (source)
2015-11-03 01:35:00 -0500 asked a question VideoCapture won't open camera on osx

I have a MacBook with a built in camera. When I try to open device 0 with VideoCapture, isOpen() always returns false.

My OpenCV lib is compiled from source. Build options are largely default, with the exception that I enabled a few extra WITH_* flags (qt, for example). I am compiling on the command line, not with XCode.

  • How do I troubleshoot why VideoCapture fails to open?
  • How do I inspect available devices and their status?
  • What is necessary in building opencv (or my own project) to ensure that video capture support is enabled?
  • What might cause VideoCapture to fail?

I'm using the video capture example verbatim:

#include "opencv2/opencv.hpp"

using namespace cv;

int main(int, char**)

    VideoCapture cap(0); // open the default camera
    if(!cap.isOpened()) { // check if we succeeded
        std::cout << "no capture device :(\n";
        return -1;

    Mat edges;
        Mat frame;
        cap >> frame; // get a new frame from camera
        cvtColor(frame, edges, COLOR_BGR2GRAY);
        GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
        Canny(edges, edges, 0, 30, 3);
        imshow("edges", edges);
        if(waitKey(30) >= 0) break;
    // the camera will be deinitialized automatically in VideoCapture destructor
    return 0;
2015-08-31 00:27:07 -0500 asked a question Documentation pages extremely slow

I'm noticing that is behaving very badly-- I get load times that would be appropriate for dialup, if the pages ever load at all.

It took me 30 minutes to download the 11Mb tutorial pdf (I have 10Mbs broadband). All other non-opencv sites are behaving normally for me. It's not my browser, because I tried to wget an 8k image from docs.opencv, and it stalled halfway through; the estimate climbing continuously-- well beyond 15 minutes-- until I killed it.

Anyone else seeing this? Is there sysadmin for out there? 'Cause the site is all messed up.