opencv - V4L2 绝对曝光设置(几乎)没有效果

标签 opencv camera webcam v4l2

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

我的相机有以下控件:

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观看图像查看器,它不做任何控制:

# 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。相机会自动调整亮度。

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

禁用 white_balance_temperature_auto工作,我也试图摆弄任何其他值(value),但我找不到任何对曝光的依赖。

是什么覆盖了手动曝光设置?

更新

一些系统信息:

核心:
$ 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。

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 的帧速率。
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。

关于opencv - V4L2 绝对曝光设置(几乎)没有效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61581125/

相关文章:

python - 安装 OpenCV 失败,因为它找不到 "skbuild"

Python图像调整大小并使用相同的名称写入

android - 使用android相机时如何删除图库中的重复图片?

iphone - 如何使用 iPhone 摄像头测量房间内的可见蓝光强度?

google-chrome - 无法在 Google Chrome 中选择正确的网络摄像头

javascript - 如何使用 JavaScript 检测系统是否安装了网络摄像头插件?

ffmpeg - 使用 ffmpeg 从网络摄像头录制声音

c++ - 在 IOS Swift 项目中使用 OpenCV 进行视频处理

iphone - 如何将 iPhone 拍摄的叠加图像和照片创建为单个图像?

c++ - fatal error : opencv2/opencv_modules. hpp:没有这样的文件或目录 #include "opencv2/opencv_modules.hpp"