Need Help with Manual Exposure & Gain Control on IMX415 (Owlow OS, Rockchip ISP)

I am using a dual IMX415 camera setup on Owow OS (Rockchip-based). I want to disable auto exposure, auto white balance, and gain control to achieve consistent image output for depth estimation and also have to do Hardware based crop along with .

However, I cannot control exposure ,brightness ,auto focus and gain manually, and it seems the ISP is overriding the settings.

System Information

Platform: Owow OS
Camera Sensor:IMX415
Camera Interface:MIPI-CSI2
No of Camera Connected (2) :/dev/video33 and /dev/video51
kernel version- 6.1.84

Some Details below:

v4l2-ctl --list-devices:   rkisp (platform:rkisp0):
    /dev/video33(left cam)
    /dev/video51(right cam)
    m00_b_imx415 (platform: i2c-1):
    /dev/v4l-subdev2
dmesg | grep rkisp :status Active


v4l2-ctl -d /dev/video33 --list-ctrls
     Brightness: -1
    Contrast: -1
    Gain: -1
   Exposure: -1
   Auto Exposure: -1
  Looks Like ISP is blocking manual settings

Sensor Subdevice for RAW Output:
    v4l2-ctl -d /dev/v4l-subdev2 --list-ctrls

What I Need Help With:

  1. How can I fully disable ISP processing and control exposure manually?
  2. Is there a way to force the camera to output RAW Bayer (RG10) without ISP interference?
  3. Can I use media-ctl or other tools to bypass ISP without modifying DTS?
  4. If a kernel modification is required, what files should I change?
  5. how i can get the Hardware cropping with ISP disable .

Please Help me to get this all solution done on priority .

Helloyou using Ubuntu24.04  right

1~4. You can kill rkisp_3A_server to fully disable ISP processing:
sudo killall rkaiq_3A_server
then you can use v4l2-ctl command to control exposure and gain.

v4l2-ctl -d /dev/v4l-subdev2 --set-ctrl "exposure=800"     #exposure control
v4l2-ctl -d /dev/v4l-subdev2 --set-ctrl "analogue_gain=64"   #gain control

5 . If you want to corp the camera output image, you can try this command, The ‘top’, ‘left’, ‘right’, ‘bottom’ is the position to be cropped.

gst-launch-1.0 v4l2src device=/dev/video51 io-mode=dmabuf ! video/x-raw,format=NV12,width=1920,height=1080,framerate=60/1 ! videocrop top=200 left=500 right=200 bottom=0 ! autovideosink
2 Likes

yes ubuntu 24.04
v4l2-ctl -d /dev/v4l-subdev2 --set-ctrl “exposure=800” #exposure control
v4l2-ctl -d /dev/v4l-subdev2 --set-ctrl “analogue_gain=64” #gain control
applying this not reflecting on device id 51 and 33
also i want to do hardware crop.

v4l2-ctl -d /dev/video33 --all
Driver Info:
Driver name : rkisp_v6
Card type : rkisp_mainpath
Bus info : platform:rkisp0-vir0
Driver version : 2.6.1
Capabilities : 0x84201000

still using isp
after killing the rkaiq_3A_server(as instructed by you )
if i miss anything here please guide me .

Hello @gita.kumari

Provide some system info as follow:

  1. cat /etc/os-release
  2. media-ctrl -pd /dev/media2 (while imx415 connect to cam3)
    or media-ctrl -pd /dev/media0 (while imx415 connect to cam2)
    or media-ctrl -pd /dev/media1 (while imx415 connect to cam1)

You just want to get the raw video from camera, and can also control exposure abd gain, right? Please describe your project requirements and background.

We want control on gain exposure focus , brightness
So that we can make the appropriate settings for 24*7 to get the good quality image

All these things we want on isp level ( so that we can get the good speed of capture )
I have used this camera with vim4 and I found there few of the controls were present there .

Is it possible to get these all on edge2 (On isp)board with imx415.

We have also plan of using this cameras as stereo (for object depth finding)

NOte : Mostly we want manual control ,Auto should be disable (like focus exposure
etc.)

After killing the 3A server, when previewing the camera feed, is the image displayed as expected?

Keep the camera preview , then adjust the exposure and gain settings. Does the image change as a result?

for cam3 interface

v4l2-ctl -d /dev/v4l-subdev10 --set-ctrl "exposure=800"     #exposure control
v4l2-ctl -d /dev/v4l-subdev10 --set-ctrl "analogue_gain=64"   #gain control

for cam2 interface

v4l2-ctl -d /dev/v4l-subdev2 --set-ctrl "exposure=800"     #exposure control
v4l2-ctl -d /dev/v4l-subdev2--set-ctrl "analogue_gain=64"   #gain control

You can check the value by running : v4l2-ctl -d /dev/v4l-subdev10 -l

v4l2-ctl -d /dev/v4l-subdev10 -l

User Controls

                   exposure 0x00980911 (int)    : min=4 max=2242 step=1 default=2242 value=800
            horizontal_flip 0x00980914 (bool)   : default=0 value=0
              vertical_flip 0x00980915 (bool)   : default=0 value=0

Image Source Controls

          vertical_blanking 0x009e0901 (int)    : min=58 max=30575 step=1 default=58 value=58
        horizontal_blanking 0x009e0902 (int)    : min=4936 max=4936 step=1 default=4936 value=4936 flags=read-only
              analogue_gain 0x009e0903 (int)    : min=0 max=240 step=1 default=0 value=64

Image Processing Controls

             link_frequency 0x009f0901 (intmenu): min=0 max=4 default=0 value=1 (446000000 0x1a956b80)
                 pixel_rate 0x009f0902 (int64)  : min=0 max=950400000 step=1 default=356800000 value=356800000 flags=read-only

value reflected here
but not able to capture video using this device id
“/dev/video33” and “/dev/video51”

WARN:0@0.024] global cap_gstreamer.cpp:2829 handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module source reported: Could not read from resource.
[ WARN:0@0.024] global cap_gstreamer.cpp:1698 open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0@0.024] global cap_gstreamer.cpp:1173 isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
Error: Could not open /dev/video33!

how do you open the camera?

dose this command can open the video?

gst-launch-1.0 v4l2src device=/dev/video51 ! 'video/x-raw, width=1920, height=1080' ! videoconvert ! autovideosink

no it is not opening the video .
i observed
while running this media-ctl -d /dev/media2 -p

i did not find any device id linked here .

dmesg | grep -i video
[ 10.806955] videodev: Linux video capture interface: v2.00
[ 11.343131] mpp_service mpp-srv: 0308f07933f7a author: Yandong Lin 2024-10-14 video: rockchip: mpp: iep2: fix err log false print
[ 13.763219] : get_remote_sensor: video pad[0] is null
[ 13.765485] : get_remote_sensor: video pad[0] is null
[ 13.767842] : get_remote_sensor: video pad[0] is null
[ 13.770231] : get_remote_sensor: video pad[0] is null
[ 13.782438] : get_remote_sensor: video pad[0] is null
[ 13.785037] : get_remote_sensor: video pad[0] is null
[ 13.787738] : get_remote_sensor: video pad[0] is null
[ 13.790533] : get_remote_sensor: video pad[0] is null
[ 13.804145] : get_remote_sensor: video pad[0] is null
[ 13.807100] : get_remote_sensor: video pad[0] is null
[ 13.810155] : get_remote_sensor: video pad[0] is null
[ 13.813262] : get_remote_sensor: video pad[0] is null
[ 13.875345] usbcore: registered new interface driver uvcvideo

let me see this log : dmesg | grep imx

dmesg | grep imx
[ 11.723140] platform csi2-dcphy1: Fixed dependency cycle(s) with /i2c@feab0000/imx415f@1a
[ 11.757584] platform csi2-dcphy0: Fixed dependency cycle(s) with /i2c@feac0000/imx415b@1a
[ 13.468882] platform csi2-dphy0: Fixed dependency cycle(s) with /i2c@feca0000/imx415@1a
[ 14.266784] imx415 3-001a: driver version: 00.01.08
[ 14.267958] imx415 3-001a: Get hdr mode failed! no hdr default
[ 14.269095] imx415 3-001a: detect imx415 lane 2
[ 14.270234] imx415 3-001a: could not get default pinstate
[ 14.273594] imx415 3-001a: could not get sleep pinstate
[ 14.274714] imx415 3-001a: supply dvdd not found, using dummy regulator
[ 14.275887] imx415 3-001a: supply dovdd not found, using dummy regulator
[ 14.277009] imx415 3-001a: supply avdd not found, using dummy regulator
[ 14.348989] imx415 3-001a: Unexpected sensor id(000000), ret(-5)
[ 14.352406] imx415 4-001a: driver version: 00.01.08
[ 14.355188] imx415 4-001a: Get hdr mode failed! no hdr default
[ 14.357966] imx415 4-001a: detect imx415 lane 2
[ 14.360634] imx415 4-001a: Failed to get reset-gpios
[ 14.362771] imx415 4-001a: could not get default pinstate
[ 14.364858] imx415 4-001a: could not get sleep pinstate
[ 14.366918] imx415 4-001a: supply dvdd not found, using dummy regulator
[ 14.368998] imx415 4-001a: supply dovdd not found, using dummy regulator
[ 14.371025] imx415 4-001a: supply avdd not found, using dummy regulator
[ 14.444165] imx415 4-001a: Detected imx415 id 0000e0
[ 14.448317] imx415 8-001a: driver version: 00.01.08
[ 14.451680] imx415 8-001a: Get hdr mode failed! no hdr default
[ 14.454986] imx415 8-001a: detect imx415 lane 4
[ 14.458357] imx415 8-001a: could not get default pinstate
[ 14.461653] imx415 8-001a: could not get sleep pinstate
[ 14.464889] imx415 8-001a: supply dvdd not found, using dummy regulator
[ 14.468215] imx415 8-001a: supply dovdd not found, using dummy regulator
[ 14.471390] imx415 8-001a: supply avdd not found, using dummy regulator
[ 14.539032] imx415 8-001a: Detected imx415 id 0000e0
[ 14.720248] imx415 4-001a: Consider updating driver imx415 to match on endpoints
[ 14.728895] rockchip-csi2-dphy csi2-dcphy0: dphy0 matches m00_b_imx415 4-001a:bus type 5
[ 14.759180] imx415 8-001a: Consider updating driver imx415 to match on endpoints
[ 14.765022] rockchip-csi2-dphy csi2-dphy0: dphy0 matches m02_b_imx415 8-001a:bus type 5
[ 19.991404] imx415 4-001a: set exposure(shr0) 2047 = cur_vts(2250) - val(203)
[ 19.992129] imx415 8-001a: set exposure(shr0) 1845 = cur_vts(2250) - val(405)

It seems the system has already acquired the camera. Please reboot the board and try to open camera again.
If the problem continues, please share the command and error log.

now i can see the camera view
settings chnages behaviour i will confirm shortly with different test cases Result 


How i will contorl over auto focus and white balance ,HDR ,Noise Reduction
also i saw link frequency is read only if some body wants to change it is it possible to change ?

how we confirm whether current cam has auto focus enabled?

if any stereo callibration related guidlines will be welcome .

We need to confirm how to control these parameters because we have been using auto mode so far.

The link frequency is configured in the camera driver and cannot be modified at the user layer.

There is no direct indicator to confirm if AF is enabled. However, disabling the 3A service will turn off AF. You can physically enable the camera and observe whether the focal length adjusts automatically to verify this.

1 Like

Basically our camera should handle indoor and out door operation means
i need to setup my camera for 24*7 with stable stereo callibration(lets suppose for depth finding) result and for further processing .

i want my app with choice Auto and Manual configuraton of camera params like exposure gain,brightnes, FPS ,focus ,Auto white and HDR control 


we also want cameraa should capture very good quality image so that we should not do the further post processing .

Note:
As I have Explained the all requirement
your suggestions are also welcome which will fullfill this all requirements .
→ We like to consider existing hardware based cropping which i found on device node(/dev/video33 and /dev/video51)

Hello @gita.kumari
I find a demo and performed a simple test. You can refer to external_camera_engine_rkaiq/rkisp_demo/demo/rkisp_demo.c, which might help you.

Get and compile the demo code:

  1. Clone the repository:
git clone https://github.com/khadas/external_camera_engine_rkaiq.git
  1. Update packages and install dependencies:
apt-get update && apt-get install -y m4 xxd
  1. Navigate to the project directory:
cd external_camera_engine_rkaiq
  1. Apply the following patch to rkisp_demo/demo/rkisp_demo.c
diff --git a/rkisp_demo/demo/rkisp_demo.c b/rkisp_demo/demo/rkisp_demo.c
index 3d231523..5c683c4a 100644
--- a/rkisp_demo/demo/rkisp_demo.c
+++ b/rkisp_demo/demo/rkisp_demo.c
@@ -64,7 +64,7 @@
 #define DEFAULT_CAPTURE_RAW_PATH "/tmp/capture_image"
 #endif
 #define CAPTURE_CNT_FILENAME ".capture_cnt"
-// #define ENABLE_UAPI_TEST
+#define ENABLE_UAPI_TEST
 #define IQFILE_PATH_MAX_LEN 256
 // #define CUSTOM_AE_DEMO_TEST
 // #define CUSTOM_GROUP_AE_DEMO_TEST
@@ -1445,7 +1445,7 @@ static void mainloop(demo_context_t *ctx)
             aov_read_frame(ctx);
         } else {
             read_frame(ctx);
-            XCAM_STATIC_FPS_CALCULATION(rkisp_demo, 30);
+            //XCAM_STATIC_FPS_CALCULATION(rkisp_demo, 30);
         }
     }
 }
  1. Run CMake to configure the build:
cmake -DISP_HW_VERSION=-DISP_HW_V30 \
      -DRKAIQ_TARGET_SOC=rk3588 \
      -DCMAKE_C_COMPILER="path/to/fenix/build/toolchains/gcc-arm-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-gcc" \
      -DCMAKE_CXX_COMPILER="path/to/fenix/build/toolchains/gcc-arm-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-g++" \
      -DCMAKE_INSTALL_PREFIX="/usr" \
      -DCMAKE_INSTALL_RUNSTATEDIR="/run" \
      -DCMAKE_BUILD_TYPE=MinSizeRel \
      -DENABLE_RKISP_DEMO=ON \
      -DARCH="aarch64" .
  1. Compile the demo:
make

Run the Demo on Edge2

After compiling, copy external_camera_engine_rkaiq/rkisp_demo/exe/MinSizeRel/rkisp_demo to the Edge2 board and follow these steps to test the demo:
Tips: Edge2 need connect HDMI screen.

  1. Switch to root (the demo requires root privileges):
su root
  1. Stop the rkaiq_3A_server process:
killall rkaiq_3A_server
  1. Run the demo with the following command:
./rkisp_demo --device /dev/video51 --vop --width 1920 --height 1080 --iqpath /etc/iqfiles/ --rkaiq
  1. Then you can see the output as follow, select the test item you want to run.
Usage : 
0) AE:         module test sample.
1) AWB:        module test sample.
2) AF:         module test sample.
3) ACCM:       module test sample.
4) A3DLUT:     module test sample.
5) ADRC:       module test sample.
6) AMERGE:     module test sample.
7) AGAMMA:     module test sample.
8) ADEHAZE:    module test sample.
9) AYNR:       module test sample.
a) ACNR:       module test sample.
b) ASHARP:     module test sample.
c) ABAYER2DNR: module test sample.
d) ABAYERTNR:  module test sample.
e) CSM:        module test sample.
f) ABLC:       module test sample.
g) AGIC:       module test sample.
h) ALDCH:      module test sample.
i) ADEBAYER:   module test sample.
j) ALSC:       module test sample.
k) ACP:        module test sample.
l) AIE:        module test sample.
m) CGC:        module test sample.
n) CAC:        module test sample.
o) AGAIN:      module test sample.
p) AWBV32:     module test sample.
r) CCMV2:      module test sample.
s) ALDCHV32:  module test sample.
t) SMARTIR:    module test sample.
u) DPCC:       module test sample.
v) AINR:       module test sample.
w) TRANS:       module test sample.
x) ALDC:       module test sample.
y) RGBIR:       module test sample.
A) SYSCTL:       module test sample.
z) ALL:       module test sample.
ï»ż
please press the key: 

Note: We haven’t conducted further testing. The specific functionality needs to be tested by you。

2 Likes