Page 1 of 1

Adjusting image sensitivity and Contrast

Posted: 2025-10-19 13:50
by RogerTheFox
I have started using the SC3336 camera on the Pico Ultra outdoors and notice the image is very washed out. Is there a way to adjust the contrast or sensitivity? I am running the buildroot build and streaming from the default RTSP setup.

Re: Adjusting image sensitivity and Contrast

Posted: 2025-10-20 1:47
by yangxj121
Hello, you can modify the corresponding parameters using the v4l2-ctl tool. The official wiki has relevant commands that you can refer to. You can view the corresponding parameters using

Code: Select all

v4l2-ctl --device=/dev/video15 --list-ctrls
and set them.

Re: Adjusting image sensitivity and Contrast

Posted: 2025-10-20 19:42
by RogerTheFox
Thank you,
I tried the following:

Code: Select all

 v4l2-ctl --device=/dev/video15 --list-ctrls
It produces:

Code: Select all

Image Processing Controls: pixel_rate 0x009f0902 (int64)  : min=0 max=1000000000 step=1 default=1000000000 value=102000000 flags=read-only, volatile
which does not look like what I am looking for.
I checked out the information on : https://wiki.luckfox.com/Luckfox-Pico-Ultra/CSI-Camera, but there is limited information there.

Examining the output of media-ctl -d /dev/media0 -p I can see a sensor entry :

Code: Select all

- entity 63: m00_b_sc3336 4-0030 (1 pad, 1 link) type V4L2 subdev subtype Sensor flags 0 device node name /dev/v4l-subdev2 pad0: Source [fmt:SBGGR10_1X10/2304x1296@10000/250000 field:none] -> "rockchip-csi2-dphy0":0 [ENABLED]
So I ran:

Code: Select all

v4l2-ctl -d /dev/v4l-subdev2 --list-ctrls --list-ctrls-menus
which produced:


Code: Select all

User Controls

                       exposure 0x00980911 (int)    : min=1 max=1624 step=1 default=128 value=816
                horizontal_flip 0x00980914 (bool)   : default=0 value=0
                  vertical_flip 0x00980915 (bool)   : default=0 value=0

Image Source Controls

              vertical_blanking 0x009e0901 (int)    : min=64 max=31471 step=1 default=64 value=336
            horizontal_blanking 0x009e0902 (int)    : min=496 max=496 step=1 default=496 value=496 flags=read-only
                  analogue_gain 0x009e0903 (int)    : min=128 max=99614 step=1 default=128 value=1209

Image Processing Controls

                 link_frequency 0x009f0901 (intmenu): min=0 max=1 default=0 value=1 (255000000 0xf32fdc0) flags=read-only
                                0: 253125000 (0xf166188)
                                1: 255000000 (0xf32fdc0)
                     pixel_rate 0x009f0902 (int64)  : min=0 max=102000000 step=1 default=102000000 value=102000000 flags=read-only
                   test_pattern 0x009f0903 (menu)   : min=0 max=4 default=0 value=0 (Disabled)
                                0: Disabled
                                1: Vertical Color Bar Type 1
                                2: Vertical Color Bar Type 2
                                3: Vertical Color Bar Type 3
                                4: Vertical Color Bar Type 4
I got the current values:

Code: Select all

v4l2-ctl -d /dev/v4l-subdev2 --list-ctrls | sed -n '/exposure/p;/gain/p;/analogue_gain/p;/digital_gain/p;/vblank/p'

                  exposure 0x00980911 (int)    : min=1 max=1624 step=1 default=128 value=816
                  analogue_gain 0x009e0903 (int)    : min=128 max=99614 step=1 default=128 value=1209
                  analogue_gain 0x009e0903 (int)    : min=128 max=99614 step=1 default=128 value=1209
This looked more like what I need so, I started an RTSP stream, hooked it up to VLC and tried:

Code: Select all

v4l2-ctl -d /dev/v4l-subdev2 --set-ctrl=exposure=250
while observing the stream.
This does momentarily darken the stream, but it immediately recovers back to its default brightness.

How do I set this for a session so that it is not overwritten?

Re: Adjusting image sensitivity and Contrast

Posted: 2025-10-27 8:09
by Crocodile
Hello, when rkisp starts working, it uses the 3A algorithm to take over the control of gain and exposure time. It cannot be directly controlled using v4l2-ctl. You can try modifying the file /etc/iqfiles/sc3336_CMK-OT2119-PC1_30IRC-F16.json, setting main_scene -> ae_calib -> Enable to 0. Then, manually adjust analogue_gain and exposure afterwards.

Re: Adjusting image sensitivity and Contrast

Posted: 2025-10-27 13:49
by RogerTheFox
Thank you that worked. I am just going to summarise the issue now for others:

When I started using the SC3336 camera on the Pico Ultra outdoors and notice the image is very washed out. I started to search for a way to adjust the contrast or sensitivity.

I tried the following:

Code: Select all

 v4l2-ctl --device=/dev/video15 --list-ctrls
It produces:

Code: Select all

Image Processing Controls: pixel_rate 0x009f0902 (int64)  : min=0 max=1000000000 step=1 default=1000000000 value=102000000 flags=read-only, volatile
which did not look like what I am looking for.

I checked out the information on : https://wiki.luckfox.com/Luckfox-Pico-Ultra/CSI-Camera, but there is limited information there.

Examining the output of

Code: Select all

media-ctl -d /dev/media0 -p
I could see a sensor entry :

Code: Select all

- entity 63: m00_b_sc3336 4-0030 (1 pad, 1 link) type V4L2 subdev subtype Sensor flags 0 device node name /dev/v4l-subdev2 pad0: Source [fmt:SBGGR10_1X10/2304x1296@10000/250000 field:none] -> "rockchip-csi2-dphy0":0 [ENABLED]
So I ran:

Code: Select all

v4l2-ctl -d /dev/v4l-subdev2 --list-ctrls --list-ctrls-menus
which produced:

Code: Select all

User Controls

                       exposure 0x00980911 (int)    : min=1 max=1624 step=1 default=128 value=816
                horizontal_flip 0x00980914 (bool)   : default=0 value=0
                  vertical_flip 0x00980915 (bool)   : default=0 value=0

Image Source Controls

              vertical_blanking 0x009e0901 (int)    : min=64 max=31471 step=1 default=64 value=336
            horizontal_blanking 0x009e0902 (int)    : min=496 max=496 step=1 default=496 value=496 flags=read-only
                  analogue_gain 0x009e0903 (int)    : min=128 max=99614 step=1 default=128 value=1209

Image Processing Controls

                 link_frequency 0x009f0901 (intmenu): min=0 max=1 default=0 value=1 (255000000 0xf32fdc0) flags=read-only
                                0: 253125000 (0xf166188)
                                1: 255000000 (0xf32fdc0)
                     pixel_rate 0x009f0902 (int64)  : min=0 max=102000000 step=1 default=102000000 value=102000000 flags=read-only
                   test_pattern 0x009f0903 (menu)   : min=0 max=4 default=0 value=0 (Disabled)
                                0: Disabled
                                1: Vertical Color Bar Type 1
                                2: Vertical Color Bar Type 2
                                3: Vertical Color Bar Type 3
                                4: Vertical Color Bar Type 4
I got the current values:

Code: Select all

v4l2-ctl -d /dev/v4l-subdev2 --list-ctrls | sed -n '/exposure/p;/gain/p;/analogue_gain/p;/digital_gain/p;/vblank/p'

Code: Select all

                  exposure 0x00980911 (int)    : min=1 max=1624 step=1 default=128 value=816
                  analogue_gain 0x009e0903 (int)    : min=128 max=99614 step=1 default=128 value=1209
                  analogue_gain 0x009e0903 (int)    : min=128 max=99614 step=1 default=128 value=1209
This looked more like what I need so, I started an RTSP stream, hooked it up to VLC and tried:

Code: Select all

v4l2-ctl -d /dev/v4l-subdev2 --set-ctrl=exposure=250
while observing the stream.

This does momentarily darken the stream, but it immediately recovers back to its default brightness.

It appears that when rkisp starts working, it uses the 3A algorithm to take over the control of gain and exposure time. It cannot then be directly controlled using v4l2-ctl. To disable this you can try modifying the file /etc/iqfiles/sc3336_CMK-OT2119-PC1_30IRC-F16.json

There is a section in that for setting main_scene -> ae_calib -> Enable, set this to 0 as shown below (the default is 1)

Code: Select all

        "main_scene":   [{
                        "name": "normal",
                        "sub_scene":    [{
                                        "name": "day",
                                        "scene_isp32":  {
                                                "ae_calib":     {
                                                        "CommCtrl":     {
                                                                "Enable":       0,
                                                                "AecRunInterval":       0,
                                                                "AecOpType":    "RK_AIQ_OP_MODE_AUTO",
                                                                "HistStatsMode":        "CAM_HISTV2_MODE_Y",
                                                                "RawStatsMode": "CAM_RAWSTATSV2_MODE_Y",
                                                                "YRangeMode":   "CAM_YRANGEV2_MODE_FULL",
                                                                "AecGridWeight":
This disables the automatic control, you can then set the exposure manually by adjusting the analogue_gain and exposure afterwards. For example:

Code: Select all

v4l2-ctl -d /dev/v4l-subdev2 --set-ctrl=exposure=250
v4l2-ctl -d /dev/v4l-subdev2 --set-ctrl=analogue_gain=300
This allows you to adjust the image in daylight conditions.