v4l2 manual exposure not working compared to Windows 10

ⅰ亾dé卋堺 提交于 2021-01-29 06:20:20

问题


This question is very similar to V4L2 absolute exposure setting has (almost) not effect

I have a UVC compliant camera that I am running on a Raspberry Pi CM3+ module. It appears as video0.
Using the tools/drivers v4l2-ctl, qv4l2 or guvcview the absolute exposure cannot be controlled, yet it can be controlled when using Amcap on Windows 10.

The camera has two exposure modes manual and aperature controlled. When in aperature controlled the exposure levels in the image change dynamically, however, when switched to manual mode the image becomes very dark and does not change whether at the upper or lower limit of the range which can be selected.

When running v4l2-ctl the range min is stated to be 5 and the max is 2500. Yet in windows it is between -2 and -11 and the exposure of the image changes proportionally as you would expect.

Parameter range from v4l2:

exposure_auto 0x009a0901 (menu)       : min=0 max=3 default=3 value=1
exposure_absolute 0x009a0902 (int)    : min=5 max=2500 step=1 default=156 value=1659

Parameter range from Amcap on Windows 10:

If I do v4l2-ctl -d0 -all here is what I get:


pi@raspberrypi:~ $ v4l2-ctl -d0 --all
Driver Info:
        Driver name      : uvcvideo
        Card type        : HD USB CAMERA: HD USB CAMERA
        Bus info         : usb-0000:01:00.0-1.3
        Driver version   : 5.4.79
        Capabilities     : 0x84a00001
                Video Capture
                Metadata Capture
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x04200001
                Video Capture
                Streaming
                Extended Pix Format
Media Driver Info:
        Driver name      : uvcvideo
        Model            : HD USB CAMERA: HD USB CAMERA
        Serial           : 01.00.00
        Bus info         : usb-0000:01:00.0-1.3
        Media version    : 5.4.79
        Hardware revision: 0x00000224 (548)
        Driver version   : 5.4.79
Interface Info:
        ID               : 0x03000002
        Type             : V4L Video
Entity Info:
        ID               : 0x00000001 (1)
        Name             : HD USB CAMERA: HD USB CAMERA
        Function         : V4L2 I/O
        Flags         : default
        Pad 0x01000007   : 0: Sink
          Link 0x02000013: from remote pad 0x100000a of entity 'Extension 4': Data, Enabled, Immutable
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
        Width/Height      : 640/480
        Pixel Format      : 'YUYV' (YUYV 4:2:2)
        Field             : None
        Bytes per Line    : 1280
        Size Image        : 614400
        Colorspace        : sRGB
        Transfer Function : Default (maps to sRGB)
        YCbCr/HSV Encoding: Default (maps to ITU-R 601)
        Quantization      : Default (maps to Limited Range)
        Flags             :
Crop Capability Video Capture:
        Bounds      : Left 0, Top 0, Width 640, Height 480
        Default     : Left 0, Top 0, Width 640, Height 480
        Pixel Aspect: 1/1
Selection: crop_default, Left 0, Top 0, Width 640, Height 480, Flags:
Selection: crop_bounds, Left 0, Top 0, Width 640, Height 480, Flags:
Streaming Parameters Video Capture:
        Capabilities     : timeperframe
        Frames per second: 30.000 (30/1)
        Read buffers     : 0
                     brightness 0x00980900 (int)    : min=-64 max=64 step=1 default=0 value=-6
                       contrast 0x00980901 (int)    : min=0 max=95 step=1 default=1 value=6
                     saturation 0x00980902 (int)    : min=0 max=100 step=1 default=52 value=22
                            hue 0x00980903 (int)    : min=-2000 max=2000 step=1 default=0 value=0
 white_balance_temperature_auto 0x0098090c (bool)   : default=1 value=0
                          gamma 0x00980910 (int)    : min=100 max=300 step=1 default=115 value=115
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=1 value=1
      white_balance_temperature 0x0098091a (int)    : min=2800 max=6500 step=1 default=4600 value=4600
                      sharpness 0x0098091b (int)    : min=0 max=7 step=1 default=0 value=0
         backlight_compensation 0x0098091c (int)    : min=36 max=160 step=1 default=54 value=36
                  exposure_auto 0x009a0901 (menu)   : min=0 max=3 default=3 value=1
              exposure_absolute 0x009a0902 (int)    : min=5 max=2500 step=1 default=156 value=1659
error 22 getting ext_ctrl Pan (Absolute)
error 22 getting ext_ctrl Tilt (Absolute)
                 focus_absolute 0x009a090a (int)    : min=0 max=1023 step=1 default=0 value=355
                     focus_auto 0x009a090c (bool)   : default=1 value=0
error 22 getting ext_ctrl Zoom, Absolute

I have tried changing the format between MJPEG and YUYV without any change.

I am assuming that it a driver issue or some setting that I am overlooking?


回答1:


Amcap (Windows) in my case has 5 discrete exposure levels [-6,-5,-4,-3,-2].

Linux (guvcview and v4l2) has a continuous range from [5 to 2500] (as can be seen in the OP using v4l2-ctl.

I have manually set the exposure levels in Amcap and then read them using Linux (guvcview):
[-6 = 156; -5 = 312; -4 = 625; -3 = 1250; -2 = 2500]

When I set the exposure to any of these levels it works as expected. HOWEVER if I set any other values, for example, 2499 or 157, just one digit off I get nearly complete black!

I am sure there is some mathematical reason that will show this, however, I have found this misleading since the Linux drivers report a continuous range which suggests that the exposure range is linear, but it is not and is discrete!



来源:https://stackoverflow.com/questions/65595380/v4l2-manual-exposure-not-working-compared-to-windows-10

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!