Exposure control manuly

morning ,
i have code like follow, but i don’t know why i can not adjust the exposure manually.
thank you:

widget to control a connected camera

class CameraWidget(QWidget):
captureFinished = pyqtSignal()

def gstreamer_pipeline(self, sensor_id):
    return (
        f"nvarguscamerasrc sensor_id={sensor_id} ! "
        "video/x-raw(memory:NVMM),width=1920, height=1080, framerate=30/1 ! "
        "nvvidconv flip-method=0 ! video/x-raw,width=960, height=540 ! appsink"
    )

def __init__(self, cameraInfo, parent=None):
    super(CameraWidget, self).__init__(parent)
    
    self.sensor_id = cameraInfo["Num"]
    self.camera_name = cameraInfo["Model"]
    
    # Initialize OpenCV capture
    self.cap = cv2.VideoCapture(self.gstreamer_pipeline(self.sensor_id), cv2.CAP_GSTREAMER)
    if not self.cap.isOpened():
        raise RuntimeError(f"Failed to open camera {self.sensor_id}")
        
    # Initialize UI elements
    self.label = QLabel()
    self.label.setText(f"Camera: {self.camera_name}")
    
    self.imageLabel = QLabel()
    self.imageLabel.setSizePolicy(QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding))
    
    # Exposure control
    self.slider = QSlider(Qt.Horizontal)
    self.slider.setMinimum(1)
    self.slider.setMaximum(100)
    self.slider.setValue(50)  # Default value
    
    self.sliderValue = QLabel()
    self.sliderValue.setText(str(self.slider.value()) + " ms")
    self.sliderLabel = QLabel()
    self.sliderLabel.setText("Tempo di Esposizione:")
    
    # Connect slider to exposure control
    self.slider.valueChanged.connect(self.setExposureTime)
    
    # Layout setup
    sliderLayout = QHBoxLayout()
    sliderLayout.addWidget(self.sliderLabel)
    sliderLayout.addWidget(self.slider)
    sliderLayout.addWidget(self.sliderValue)
    
    layout = QVBoxLayout()
    layout.addWidget(self.label)
    layout.addLayout(sliderLayout)
    layout.addWidget(self.imageLabel)
    
    self.setLayout(layout)
    
    # Setup timer for frame updates
    self.timer = QTimer()
    self.timer.timeout.connect(self.update_frame)
    self.timer.start(30)  # 30ms refresh rate
    
    # Initialize exposure time
    self.setExposureTime(self.slider.value())

Hi @xi.che,

What is your setExposureTime implementation?

Regards,
Francis Guindon

Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: http://www.ridgerun.com/

hello xi.che,

please check with v4l utility for sending controls to driver layer directly to check your sensor driver functionality.
for instance, please check $ v4l2-ctl --all to list all your camera controls.
you could running with --set-ctrl exposure=xxxx to change exposure settings.

besides,
here’s argus_camera sample application, which has user-interface for sending camera controls as well.
you may install MMAPI, $ sudo apt install nvidia-l4t-jetson-multimedia-api
please see-also.. /usr/src/jetson_multimedia_api/argus/ for reference.

Dear JerryChang,
thank you so much for your answer,
When I move the slider, it responds in manually setting modo controlled by slide, but after manually adjusting the exposure, the exposure time cannot be maintained at the set time. The lens quickly returns to automatic exposure. How can I solve this problem?
Many thanks

hello xi.che,

did you configure out-of-range exposure time?
it may be helpful if you attach a video clip to demonstrate the AE issue.


Dear Jerry,video for you :)

hello xi.che,

it doesn’t looks like reference sample application.
could you please test with argus_camera sample app for verification?

hi Jerry, can you tell me which sample can i use to set up the "manual exposure mode?

user auto exposure :
Executing Argus Sample: argus_userautoexposure
USER AUTO EXPOSURE SAMPLE: Argus Version: 0.99.3.3 (multi-process)
Camera device 0 was requested but only 2 are available.
PREVIEW CONSUMER: Creating OpenGL context.
PREVIEW CONSUMER: Connecting to EGLStream(s).
PREVIEW CONSUMER: Connected to stream(s).
PREVIEW CONSUMER: Waiting until producer(s) connect…
“userAlternatingAutoExposure” doesn’t find…

hello xi.che,

please check.. /usr/src/jetson_multimedia_api/argus/apps/camera/README.TXT
it’s argus_camera sample application, which has user-interface for sending camera controls as well.
let me take a snapshot of this application for you reference.

hi Jerry, thank you for your instruction, i find the application.
i will come back to you soon in case that i have other questions.
thank you so much!

hello again, Jerry,
how can i set the exposure time manually? I can not adjust the exposure time by setting the mim and max at 683709000nm?

hello xi.che,

may I know what’s your sensor capability? what’s the actual use-case for settings min=max for the exposure time?
besides.. you’ll need to configure ae lock for setting the exposure time manually.

i think i have the imx219 sensor for nano :

acrual use-case: Compared to auto mode, I need to manually set a longer exposure time, for example: 600000000nm?

Where exactly is the AE Lock setting located in the interface? Could you describe it precisely?

hello xi.che,

is the setting within the exposure time range?
you may also run $ v4l2-ctl -d /dev/video0 --all for checking camera controls.
for instance,

                           gain 0x009a2009 (int64)  : min=16 max=357 step=1 default=16 value=26 flags=slider
                       exposure 0x009a200a (int64)  : min=13 max=683710 step=1 default=2495 value=8333 flags=slider

dear Jerry, i have
gain 0x009a2009 (int64) : min=16 max=171 step=1 default=16 value=77 flags=slider
exposure 0x009a200a (int64) : min=13 max=683710 step=1 default=2495 value=33330 flags=slider
but in argus_camera, the max gain is 10.625???

hello xi.che,

please note that, the value is rounded down to six decimal places. Usually set to 1.0, representing 1x gain.

hello , can you tell me how i can just set up the exposure time instead of gain ?
i can not change it manually? what is the Max exposure time i can set?
nothing change when i change the parameters in the software even with AELOCK checked?

hello xi.che,

here’s the max exposure time, max=683710 the unit is in microseconds, (i.e. us)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.