Cannot Enable Autoexposure via V4L2

0

I am using an ELP-USBFHD01M-L21 camera. It claims to have autoexposure support and when I plug it into my Mac it appears to be so. I downloaded a sample application on OS X that someone wrote that uses the USB Video Class commands to enable/disable autoexposure and it seems fine.

On a Debian 8.5 system I am using Python to access v4l2. Here I am setting exposure to manual mode. This value (1) and a value of 3 are accepted:

self._camera = v4l2capture.Video_device(device)

self._frame_size = self._camera.set_format(*requested_frame_size)

# 0: V4L2_EXPOSURE_AUTO
# 1: V4L2_EXPOSURE_MANUAL
# 2: V4L2_EXPOSURE_SHUTTER_PRIORITY
# 3: V4L2_EXPOSURE_APERTURE_PRIORITY

actual = self._camera.set_exposure_auto(1)

If I try to set exposure_auto to zero it fails with:

Traceback (most recent call last):
  File "camera.py", line 207, in <module>
    camera = Camera('/dev/video0')
  File "camera.py", line 45, in __init__
    a = self._camera.set_exposure_auto(0)
IOError: [Errno 34] Numerical result out of range

Similar results with the utilities:

$ v4l2-ctl -c exposure_auto=0
VIDIOC_S_EXT_CTRLS: failed: Numerical result out of range
Error setting controls: Numerical result out of range
$ v4l2-ctl -c exposure_auto=1

If I use lsusb -v to examine the descriptors I see this (excerpted):

  VideoControl Interface Descriptor:
    bLength                18
    bDescriptorType        36
    bDescriptorSubtype      2 (INPUT_TERMINAL)
    bTerminalID             1
    wTerminalType      0x0201 Camera Sensor
    bAssocTerminal          0
    iTerminal               0 
    wObjectiveFocalLengthMin      0
    wObjectiveFocalLengthMax      0
    wOcularFocalLength            0
    bControlSize                  3
    bmControls           0x0000000e
      Auto-Exposure Mode
      Auto-Exposure Priority
      Exposure Time (Absolute)
python
v4l2
asked on Stack Overflow Jun 17, 2016 by Kenny

1 Answer

0

I got a bit fixated on making camera.set_exposure_auto(0) work. It turns out a value of 3 is auto exposure with manual iris adjustment. This camera doesn't have an iris (at least not a mechanical one) and this does appear to activate a form of auto exposure that works for me.

A value of 0 is auto exposure along with auto iris and it makes sense in retrospect why this isn't supported.

Some documentation here. Search for "exposure".

answered on Stack Overflow Jun 17, 2016 by Kenny

User contributions licensed under CC BY-SA 3.0