Search code examples
pythonopencvwebcamhdr

Finding exposure duration of a webcam in time units?


I'm experimenting with HDR capture at the moment and using a Logitech C920 through OpenCV via python. All the camera calibration algorithms I have come across to date require the actual duration of the image exposure or at least known ratios between the various exposure times. Unfortunately all I have when setting the exposure time in OpenCV (CAM_PROP_EXPOSURE) for the C920 is an integer range [-11 to -2] with no indication of units.

Is there a low level API or utility that I can probe the camera with to find the corresponding duration in seconds?


Solution

  • Solved it - turns out OpenCV is going through DirectShow in the back end for the camera and according to the appropriate documentation ICameraControl::get_Exposure the mystery values are encoding the exposure duration:

    pValue

    Receives the exposure time, in log base 2 seconds. If the value is n, the exposure time is 2^n seconds.

    while the log of a negative number makes no sense and I guess must be an error, the second part about 2^n seconds seems credible. This would give -2 as 1/4 of a second and -11 as 1/2048 of a second with the exposure times doubling/halving each integer step.