ZED 2i overexposure while using manual settings

Sometimes a video becomes overexposed, even when using manual settings. Here are some images showing the before and after of the overexposure:

Hi @otaviocozer

Welcome to the Stereolabs community.

Please add more information concerning the problem.

Are you using custom code? Can you share it to check the initialization configuration?

Below is a simplified version.

class Recorder():
    def __init__(self, params: Dict):
        self.camera = sl.Camera()
        self.compression_mode = sl.SVO_COMPRESSION_MODE.H265
        self.depth_mode = sl.DEPTH_MODE.NONE
        self.max_values = params["max_values"]

        self.zed_init = sl.InitParameters()
        self.zed_init.depth_mode = self.depth_mode
        self.zed_init.camera_fps = self.fps

        self.camera.open(self.zed_init)

    @property
    def exposure(self) -> int:
        return self.camera.get_camera_settings(sl.VIDEO_SETTINGS.EXPOSURE)[1]

    @exposure.setter
    def exposure(self, value: int):
        exposure = self.max_values["exposicao"] - 1 if value > self.max_values["exposicao"] else value
        self.camera.set_camera_settings(sl.VIDEO_SETTINGS.EXPOSURE, exposure)

    @property
    def gain(self) -> int:
        return self.camera.get_camera_settings(sl.VIDEO_SETTINGS.GAIN)[1]

    @gain.setter
    def gain(self, value: int):
        gain = self.max_values["ganho"] - 1 if value > self.max_values["ganho"] else value
        self.camera.set_camera_settings(sl.VIDEO_SETTINGS.GAIN, gain)

    def __thread__(self, socket: Dict):
        recording_params = sl.RecordingParameters('recording.svo', self.compression_mode)
        self.camera.enable_recording(recording_params)

        while True:
            if socket["exposure"] == -1:
                self.camera.set_camera_settings(sl.VIDEO_SETTINGS.AEC_AGC, 1)
                time.sleep(4)
                self.gain = int(self.gain)
                self.exposure = int(self.exposure)
                socket["gain"], socket["exposure"] = self.gain, self.exposure

            exposure, gain = socket["exposure"], socket["gain"]
            self.exposure = int(exposure)
            self.gain = int(gain)

I recommend you disable auto exposure and set the default manual values just after you call the open function, otherwise automatic setting will be enabled by default.

I later assign the auto values manually, this should disable the auto settings.

@property
def exposure(self) -> int:
    return self.camera.get_camera_settings(sl.VIDEO_SETTINGS.EXPOSURE)[1]

@exposure.setter
def exposure(self, value: int):
    self.camera.set_camera_settings(sl.VIDEO_SETTINGS.EXPOSURE, exposure)

@property
def gain(self) -> int:
    return self.camera.get_camera_settings(sl.VIDEO_SETTINGS.GAIN)[1]

@gain.setter
def gain(self, value: int):
    self.camera.set_camera_settings(sl.VIDEO_SETTINGS.GAIN, gain)

def __thread__(self, socket: Dict):
   ...
    while True:
        if socket["exposure"] == -1:
          self.camera.set_camera_settings(sl.VIDEO_SETTINGS.AEC_AGC, 1)
          time.sleep(4)
          self.gain = int(self.gain)
          self.exposure = int(self.exposure)
          socket["gain"], socket["exposure"] = self.gain, self.exposure


This bug is pretty rare, but I’d estimate we see it every hundred hours or so. Appears to be a spontaneous adjustment of the exposure occurring on the camera itself. Our workaround has been to alert on imagery which has more than x% ‘white’ pixels, which would indicate such an event, then force a cycle on the exposure to get the camera back to where it should have been staying.

2 Likes