Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV directshow camera access results in black image unless the camera has been opened previously from other software

(This is a duplicate of my question at SO)

An analog framegrabber's image can be read via OpenCV 2.4.2 only after the demo-application has opened the grabber, otherwise a black image results. The following debug code

qDebug() << "Brightness" << cap->get(CV_CAP_PROP_BRIGHTNESS);
qDebug() << "Contrast  " << cap->get(CV_CAP_PROP_CONTRAST);
qDebug() << "Saturation" << cap->get(CV_CAP_PROP_SATURATION);
qDebug() << "Hue       " << cap->get(CV_CAP_PROP_HUE);
qDebug() << "Gain      " << cap->get(CV_CAP_PROP_GAIN);
qDebug() << "Exposure  " << cap->get(CV_CAP_PROP_EXPOSURE);
qDebug() << "Width     " << cap->get(CV_CAP_PROP_FRAME_WIDTH);
qDebug() << "Height    " << cap->get(CV_CAP_PROP_FRAME_HEIGHT);

outputs

Brightness 5000
Contrast   5000
Saturation 4000
Hue        5000
Gain       -8.58993e+08
Exposure   -1
Width      720
Height     576

Of course these settings seem defective, but they are the same when opening the device successfully after it has been accessed by the grabber's demo application.

I suppose this is a driver issue where certain device settings are required that OpenCV cannot access, including invalid standard settings (gain, exposure). What lower-level methods could be used to find out about / write those settings?