antmicro / pyvidctrl

A simple TUI util to control V4L2 camera parameters
Apache License 2.0
29 stars 5 forks source link

support for additional V4L2_CTRL_TYPE: _U8 , _U16 , _U32 #14

Open ZalgoSoft opened 2 years ago

ZalgoSoft commented 2 years ago

https://www.kernel.org/doc/html/v5.0/media/uapi/v4l/vidioc-queryctrl.html#c.v4l2_ctrl_type

V4L2_CTRL_TYPE_U8 V4L2_CTRL_TYPE_U16 V4L2_CTRL_TYPE_U32 V4L2_CTRL_TYPE_MPEG2_SLICE_PARAMS V4L2_CTRL_TYPE_MPEG2_QUANTIZATION

please add support at least for _U8 , _U16 , _U32 raspbery pi platform v4l2 has options such this

root@rpilan:~# v4l2-ctl --device /dev/video13 --all
Driver Info:
        Driver name      : bcm2835-isp
        Card type        : bcm2835-isp
        Bus info         : platform:bcm2835-isp
        Driver version   : 5.4.189
        Capabilities     : 0x84200002
                Video Output
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps      : 0x04200002
                Video Output
                Streaming
                Extended Pix Format
Media Driver Info:
        Driver name      : bcm2835-isp
        Model            : bcm2835-isp
        Serial           :
        Bus info         : platform:bcm2835-isp
        Media version    : 5.4.189
        Hardware revision: 0x00000000 (0)
        Driver version   : 5.4.189
Interface Info:
        ID               : 0x03000008
        Type             : V4L Video
Entity Info:
        ID               : 0x00000006 (6)
        Name             : bcm2835-isp0-output0
        Function         : V4L2 I/O
        Pad 0x01000007   : 0: Source
          Link 0x0200000a: to remote pad 0x1000002 of entity 'bcm2835_isp0': Data, Enabled, Immutable
Priority: 2
Format Video Output:
        Width/Height      : 1280/1280
        Pixel Format      : 'BA81' (8-bit Bayer BGBG/GRGR)
        Field             : None
        Bytes per Line    : 1280
        Size Image        : 1638400
        Colorspace        : Raw
        Transfer Function : Default (maps to None)
        YCbCr/HSV Encoding: Default (maps to ITU-R 601)
        Quantization      : Default (maps to Full Range)
        Flags             :
Selection Video Capture: crop, Left 0, Top 0, Width 0, Height 0, Flags:
Selection Video Capture: crop_default, Left 0, Top 0, Width 1280, Height 1280, Flags:
Selection Video Capture: crop_bounds, Left 0, Top 0, Width 1280, Height 1280, Flags:
Selection Video Output: crop, Left 0, Top 0, Width 0, Height 0, Flags:
Selection Video Output: crop_default, Left 0, Top 0, Width 1280, Height 1280, Flags:
Selection Video Output: crop_bounds, Left 0, Top 0, Width 1280, Height 1280, Flags:

User Controls

                    red_balance 0x0098090e (int)    : min=1 max=65535 step=1 default=1000 value=1000 flags=slider
                   blue_balance 0x0098090f (int)    : min=1 max=65535 step=1 default=1000 value=1000 flags=slider
       colour_correction_matrix 0x009819e1 (u8)     : min=0 max=255 step=1 default=0 [88] flags=has-payload
                   lens_shading 0x009819e2 (u8)     : min=0 max=255 step=1 default=0 [36] flags=has-payload, execute-on-write
                    black_level 0x009819e3 (u8)     : min=0 max=255 step=1 default=0 [12] flags=has-payload
             green_equalisation 0x009819e4 (u8)     : min=0 max=255 step=1 default=0 [16] flags=has-payload
                          gamma 0x009819e5 (u8)     : min=0 max=255 step=1 default=0 [136] flags=has-payload
                        denoise 0x009819e6 (u8)     : min=0 max=255 step=1 default=0 [24] flags=has-payload
                        sharpen 0x009819e7 (u8)     : min=0 max=255 step=1 default=0 [28] flags=has-payload
     defective_pixel_correction 0x009819e8 (u8)     : min=0 max=255 step=1 default=0 [8] flags=has-payload
                 colour_denoise 0x009819e9 (u8)     : min=0 max=255 step=1 default=0 [8] flags=has-payload

Image Processing Controls

                   digital_gain 0x009f0905 (int)    : min=1 max=65535 step=1 default=1000 value=65500

изображение

ZalgoSoft commented 2 years ago

and another request

if we have 'fragmented' enum like

                     scene_mode 0x009a091a (menu)   : min=0 max=13 default=0 value=11
                                0: None
                                8: Night
                                11: Sports

code is unable to enum this menu fully and cannot allow to change value

proposed patch: seems works as expected without side effects

--- ./ctrl_widgets.py   2022-06-24 23:36:35.343450892 +0800
+++ /usr/local/lib/python3.8/dist-packages/pyvidctrl/ctrl_widgets.py    2022-06-24 23:41:28.462543056 +0800
@@ -237,6 +237,9 @@
                 # still be more valid indexes
                 pass

+            except UnicodeDecodeError:
+                options[i] = querymenu.name
+                pass
         self.menu = Menu(options)
         self.widgets[2] = self.menu
tgorochowik commented 2 years ago

Can you submit a PR with the proposed changes?

ZalgoSoft commented 2 years ago

Can you submit a PR with the proposed changes?

unfortunately I'm unknown with python , i tried some changes, with no effect.

arkanoid87 commented 1 year ago

I stepped on this, too