Setting exposure v4l2 Camarray OV9782

  1. Where did you get the camera module(s)?

uctronics

  1. Model number of the product(s)?

Arducam 1MP*4 Quadrascopic Camera Bundle Kit for Raspberry Pi, Nvidia Jetson Nano/Xavier NX, Four OV9782 Global Shutter Color Camera Modules and Camarray Camera HAT

  1. What hardware/platform were you working on?

Jetson Nano 2GB

  1. Instructions you have followed. (link/manual/etc.)
  1. Problems you were having?

Setting up exposure value via:

cap.set(cv2.CAP_PROP_EXPOSURE, value)
is not supported.
Is:
subprocess.call([‚Äėv4l2-ctl -d /dev/video0 -c exposure=50‚Äô],shell=True)
the only option? That doesn’t seem to work on a high frequency

  1. The dmesg log from your hardware?

  2. Troubleshooting attempts you’ve made?

  3. What help do you need?

I’m implementing manual auto-exposure via software and need to set this value continuously. Doing this via sub-process doesn’t update on the required frequency.

Trying something like:

for attr in dir(cv2):
        if attr.startswith('CAP_PROP'):
            if cap.get(getattr(cv2, attr)) != -1:
                print(attr)

Shows properties like:

CAP_PROP_POS_MSEC
CAP_PROP_MODE
CAP_PROP_GAIN
CAP_PROP_FRAME_WIDTH
CAP_PROP_FRAME_HEIGHT
CAP_PROP_FOURCC
CAP_PROP_FORMAT
CAP_PROP_CONVERT_RGB
CAP_PROP_BUFFERSIZE
CAP_PROP_BACKEND

It’s weird that I can adjust the GAIN but not the exposure.

I have the very same issue with the exposure.

I have the Jetson nano 4GB version running nvidia-jetpack 4.6-b199 using the Camarray Arducam 1MP (OV9782 Color) Quad-Camera Bundle Kit bought from uctronics (cameras UC-760 Rev A and board is UC-512 Rev-D1). Python 3.6.9 is installed.

I followed the instructions here:

The arducam_displayer.py works but the images are very very dark and I cannot seem to change the gain or exposure.

I am unsure that the Arducam V4L2 Jetvariety diver is working. When I type

dmesg | grep arducam

I see the output below which says ‚ÄúFailed to setup board.‚ÄĚ

[    0.212393] DTS File Name: /var/jenkins_home/workspace/n_nano_kernel_l4t-32.6.1-arducam/kernel/kernel-4.9/arch/arm64/boot/dts/../../../../../../hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0000-p3449-0000-b00.dts
[    0.419898] DTS File Name: /var/jenkins_home/workspace/n_nano_kernel_l4t-32.6.1-arducam/kernel/kernel-4.9/arch/arm64/boot/dts/../../../../../../hardware/nvidia/platform/t210/porg/kernel-dts/tegra210-p3448-0000-p3449-0000-b00.dts
[    1.328442] arducam-csi2: arducam_read: Reading register 0x103 failed
[    1.328446] arducam-csi2 7-000c: probe failed
[    1.328475] arducam-csi2 7-000c: Failed to setup board.
[    1.352580] arducam-csi2 8-000c: firmware version: 0x0003
[    1.352943] arducam-csi2 8-000c: Sensor ID: 0x0000
[    1.407313] arducam-csi2 8-000c: sensor arducam-csi2 8-000c registered
[    1.570396] vi 54080000.vi: subdev arducam-csi2 8-000c bound

Please help

Oh hold up, I may have misunderstood the v4l2-ctl commands, which appear to work correctly when run during the execution of the arducam_displayer.py script.

This is because the exposure set by OpenCV is not the same control exposed by the camera. The exposure set by OpenCV is based on time, and the control provided by this module is to directly write to the register (unit is line length, not time).
You can set exposure with the following command:

v4l2-ctl -c exposure=1000

Hi,

From my understanding, it is not possible to use OpenCV to set the exposure as
CAP_PROP_EXPOSURE is not supported by the Jetvariety V4L2 driver.

Is there any other proper way to set the exposure directly in c++/python other than via subprocess calls like exec("v4l2-ctl -c exposure=1000") ?

I looked at your examples here but didn’t find any related to the exposure.

Thanks for your help.

Edit: We’re actually using the OV9281(SKU:B0223) cameras, hence the Jetvariety driver.

In fact you can use ioctl to set exposure:

https://www.kernel.org/doc/html/v4.9/media/uapi/v4l/control.html

1 Like

Hi @wong,

Thanks for the link, I was indeed able to change the exposure directly through ioctl().

You are welcome, glad to help you. :grinning_face_with_smiling_eyes: