How to control exposure ov2311

Hi!

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

  2. Model number of the product(s)?
    Arducam 2MP OV2311 Global Shutter M12 Mount NoIR Mono Camera Modules for NVIDIA Jetson Nano/NX and Jetson Orin NX.
    SKU: B0221

  3. What hardware/platform were you working on?
    Jetson Xavier NX (Developer Kit), JetPack 5.0.2

  4. Instructions you have followed. (link/manual/etc.)
    Quick Start Guide Arducam Wiki for Jetvariety-Camera
    MIPI_Camera example

  5. Problems you were having?
    Failed to control camera with openCV-python… First, i tried to use GStreamer pipeline, but there was a lot of mistakes. For instance, I used from quick guide:

gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, format=Y16, width=1600, height=1300 ! videoconvert ! xvimagesink 

And it said could not link v4l2src0 to videoconvert0, neither element can’t handle caps… also on the picture. I checked, that openCV has GStreamer in build.

Then i tried to use nvarguscamscr, it failed neither. I found, that Jetvariety series does not support nvarguscamerasrc. Is it true?

After this, and according to MIPI_Camera example, I used
cap = cv2.VideoCapture(0, cv2.CAP_V4L2), and it works!
For resize, I use cap.set(cv2.CAP_PROP_FRAME_WIDTH, 1600) and cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 1300), it also works!
But when I use

cap.set(cv2.CAP_PROP_AUTO_EXPOSURE, 0.75)  # tried different num
cap.set(cv2.CAP_PROP_EXPOSURE, 1/100)  # tried different num

It doesn’t work, exposure doesn’t change…

  1. The dmesg log from your hardware?

  2. Troubleshooting attempts you’ve made?
    Toubleshoot Arducam Wiki for Jetvariety-Camera
    Also found topics in this and NVIDIA forum with same problem, but without any success.

  3. What help do you need?
    How can i control exposure with openCV?

@cer_varya

It’s ture.This is because our jetvarity is not going through their isp.

Please use our specially written example first.
https://docs.arducam.com/Nvidia-Jetson-Camera/Jetvariety-Camera/Quick-Start-Guide/#41-streaming-sever

Yes, using example from MIPI

arducam_displayer -d 0

I can watch video… I also knew how to change width/height and FPS, but I still don’t understand, how to change exposure…

@cer_varya

Controlling exposure requires firmware support.
To access all the controls, you can use the v4l2-ctl tool. This tool provides a comprehensive list of controls that can be adjusted to optimize exposure settings for your device. Have you used this tool before, or do you need further guidance on how to use it?

For example

sudo apt install v4l-utils
v4l2-ctl -l

Then you can see all controls

If you might be… Please, explain to me

@cer_varya

You can view all supported controls with v4l2-ctl -l.


Then you can use the following commands to control the camera after it starts.
image

Thanks a lot!
I deal with my task:
First, launch camera cv2.VideoCapture(0, cv2.CAP_V4L2), then, in the loop, I can change exposure by executing bash command os.system(f'v4l2-clt -c exposure={exposure}').

Do you know, is there another way to change exposure right in opencv?

@cer_varya

opencv has corresponding mapping parameters, I’m not sure if it works, you can try it.

Example:

cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_AUTO_EXPOSURE, 0) 
cap.set(cv2.CAP_PROP_EXPOSURE, 1) 

I haven’t auto_exposure flag in the list of v4l2-ctl -l, so it doesn’t need to on?
Anyway, tried set this, it doesn’t work… Also tried CAP_PROP_AUTO_EXPOSURE = 0.25,0.75, 1, -1, 3, -3.
And when use

cap.set(cv2.CAP_PROP_EXPOSURE, 1)  # also -10, 1/10, 10

exposure doesn’t change, and function return false state

@cer_varya

We are a standard v4l2 protocol, direct control can also be controlled, using opencv can not control may need you to investigate yourself.

yes

Thank you very much for help!

1 Like