V4L2绝对曝光设置(几乎)无效 [英] V4L2 absolute exposure setting has (almost) not effect

查看:337
本文介绍了V4L2绝对曝光设置(几乎)无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试手动控制相机的曝光,但是该设置只是短暂地处于活动状态,但是显然,自动模式似乎仍处于活动状态,正如我在相机图像上所看到的那样.

I am trying to manually control the exposure of my camera, but the setting is only briefly active, but then apparently still an auto mode seems to be active, as I can see on the camera images.

我的相机具有以下控件:

My camera has the following controls:

v4l2-ctl --list-ctrls-menus
                     brightness 0x00980900 (int)    : min=-127 max=128 step=1 default=0 value=0
                       contrast 0x00980901 (int)    : min=0 max=30 step=1 default=15 value=15
                     saturation 0x00980902 (int)    : min=0 max=127 step=1 default=54 value=54
                            hue 0x00980903 (int)    : min=-180 max=180 step=1 default=0 value=0
 white_balance_temperature_auto 0x0098090c (bool)   : default=1 value=1
                          gamma 0x00980910 (int)    : min=20 max=250 step=1 default=88 value=88
                           gain 0x00980913 (int)    : min=0 max=10 step=1 default=0 value=0
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=1 value=1
                0: Disabled
                1: 50 Hz
                2: 60 Hz
      white_balance_temperature 0x0098091a (int)    : min=2500 max=7000 step=1 default=6000 value=6000 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=60 step=1 default=10 value=10
         backlight_compensation 0x0098091c (int)    : min=0 max=2 step=1 default=0 value=0
                  exposure_auto 0x009a0901 (menu)   : min=0 max=3 default=3 value=1
                1: Manual Mode
                3: Aperture Priority Mode
              exposure_absolute 0x009a0902 (int)    : min=78 max=1250 step=1 default=312 value=1250
         exposure_auto_priority 0x009a0903 (bool)   : default=0 value=0

在通过基本的 opencv 查看器观看图像时,我进行了设置和验证,该查看器不进行任何控制:

I set and verify, while watching the image through a basic opencv viewer, which doesn't do any controlling:

# Verify initial setting
$ v4l2-ctl -C exposure_auto
exposure_auto: 3

# Set auto-exposure to "Manual exposure time, manual iris."
$ v4l2-ctl -c exposure_auto=1

# Verify that manual setting is active
$ v4l2-ctl -C exposure_auto
exposure_auto: 1

# Set an absolute exposure value
$ v4l2-ctl -c exposure_absolute=1000

# Verify set absolute exposure
$ v4l2-ctl -C exposure_absolute
exposure_absolute: 1000

我还使用 exposure_auto_priority 设置.

但是,当我改变曝光时,我可以很快看到相机图像的效果,然后立即回到自动"模式.IE.相机会自动调整其亮度.

However, when I change the exposure, I can see the effect very quickly on the images from the camera, which then immediately seems to go back to the "auto" mode. I.e. the camera is adjusting it's brightness automatically.

使用 guvcview 时,我观察到的效果相同,基本上可以为上述每个控件提供一个滑块.当我更改曝光时,它会短暂适用,但随后似乎会应用自动曝光.尽管可以确认设置本身是已设置的(使用 v4l2-ctl -C ... ).

The same effect I'm observing when I use guvcview, which basically gives me a slider for each of the above controls. When I change the exposure, it briefly applies, but then seems to apply auto-exposure. Although the setting itself can be confirmed to be as set (using v4l2-ctl -C ...).

禁用 white_balance_temperature_auto 是可行的,并且我还尝试摆弄其他任何值,但找不到与暴露量有关的任何依存关系.

Disabling white_balance_temperature_auto works, and I also tried to fiddle with any other value, but I couldn't find any dependency to the exposure.

是什么可以推翻手动曝光设置?

What could it be that is overruling the manual exposure settings?

一些系统信息:

$ uname -r
5.3.0-51-generic
cat /proc/version
Linux version 5.3.0-51-generic (buildd@lgw01-amd64-034) (gcc version 9.2.1 20191008 (Ubuntu 9.2.1-9ubuntu2)) #44-Ubuntu SMP Wed Apr 22 21:09:44 UTC 2020

媒体:

$ media-ctl -p
Failed to enumerate /dev/media0 (-13)

$ ls /dev/media* 
/dev/media0  /dev/media1  /dev/media2

V4L2:

$ v4l2-ctl --all
Driver Info:
    Driver name      : uvcvideo
    Card type        : HBV HD CAMERA: HBV HD CAMERA
    Bus info         : usb-0000:05:00.3-1.1
    Driver version   : 5.3.18
    Capabilities     : 0x84a00001
        Video Capture
        Metadata Capture
        Streaming
        Extended Pix Format
        Device Capabilities
    Device Caps      : 0x04200001
        Video Capture
        Streaming
        Extended Pix Format
Priority: 2
Video input : 0 (Camera 1: ok)
Format Video Capture:
    Width/Height      : 1920/1080
    Pixel Format      : 'MJPG' (Motion-JPEG)
    Field             : None
    Bytes per Line    : 0
    Size Image        : 4147200
    Colorspace        : sRGB
    Transfer Function : Default (maps to sRGB)
    YCbCr/HSV Encoding: Default (maps to ITU-R 601)
    Quantization      : Default (maps to Full Range)
    Flags             : 
Crop Capability Video Capture:
    Bounds      : Left 0, Top 0, Width 1920, Height 1080
    Default     : Left 0, Top 0, Width 1920, Height 1080
    Pixel Aspect: 1/1
Selection: crop_default, Left 0, Top 0, Width 1920, Height 1080, Flags: 
Selection: crop_bounds, Left 0, Top 0, Width 1920, Height 1080, Flags: 
Streaming Parameters Video Capture:
    Capabilities     : timeperframe
    Frames per second: 30.000 (30/1)
    Read buffers     : 0
                     brightness 0x00980900 (int)    : min=-127 max=128 step=1 default=0 value=0
                       contrast 0x00980901 (int)    : min=0 max=30 step=1 default=15 value=15
                     saturation 0x00980902 (int)    : min=0 max=127 step=1 default=54 value=54
                            hue 0x00980903 (int)    : min=-180 max=180 step=1 default=0 value=0
 white_balance_temperature_auto 0x0098090c (bool)   : default=1 value=1
                          gamma 0x00980910 (int)    : min=20 max=250 step=1 default=88 value=88
                           gain 0x00980913 (int)    : min=0 max=10 step=1 default=0 value=0
           power_line_frequency 0x00980918 (menu)   : min=0 max=2 default=1 value=1
      white_balance_temperature 0x0098091a (int)    : min=2500 max=7000 step=1 default=6000 value=6000 flags=inactive
                      sharpness 0x0098091b (int)    : min=0 max=60 step=1 default=10 value=10
         backlight_compensation 0x0098091c (int)    : min=0 max=2 step=1 default=0 value=0
                  exposure_auto 0x009a0901 (menu)   : min=0 max=3 default=3 value=3
              exposure_absolute 0x009a0902 (int)    : min=78 max=1250 step=1 default=312 value=312 flags=inactive
         exposure_auto_priority 0x009a0903 (bool)   : default=0 value=1

推荐答案

看看UVC类规范中的曝光时间(绝对)控制,您可以从usb.org中找到它.我引用下面的规范版本1.5.

Take a look at Exposure Time (Absolute) Control in the UVC class specification, which you can find from usb.org. I'm quoting from spec version 1.5 below.

请注意,手动曝光控制还受到边框的限制间隔,始终具有较高的优先级.如果帧间隔是更改为低于曝光控制"当前值的值,曝光控制值将自动更改.默认值曝光控制值将是当前帧间隔,直到选择显式暴露值.

Note that the manual exposure control is further limited by the frame interval, which always has higher precedence. If the frame interval is changed to a value below the current value of the Exposure Control, the Exposure Control value will automatically be changed. The default Exposure Control value will be the current frame interval until an explicit exposure value is chosen.

所以,这解释了您所看到的.绝对曝光时间以100µs单位表示.您的默认值为312,即31200µs,这使帧速为〜32.

So, this explains what you are seeing. Absolute Exposure Time is expressed in 100µs units. Your default value is 312, which is 31200µs, and this gives a frame rate of ~32.

exposure_absolute 0x009a0902 (int)    : min=78 max=1250 step=1 default=312 value=312 flags=inactive

Frames per second: 30.000 (30/1)

您将绝对曝光时间设置为1000,即100000µs.这可以生效,但随后的帧间隔(31200µs)优先,然后回落到31200µs.

You are setting the Absolute exposure time to 1000, which is 100000µs. This takes effect, but then the frame interval (31200µs) takes precedence and it falls back to 31200µs.

这篇关于V4L2绝对曝光设置(几乎)无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆