Adjust ZED 2i camera parameters in python

I have a python code which captures images using the cv2 module of OpenCV. But when changing the exposure and gain parameters of the camera, they do not take the value that I indicate, what could be happening?.

Attached the part of the code in which I assign the values ​​to the parameters .

           #Range

brightness= 4 #0-8
contrast=4 #0-8
saturation=4 #0-8
sharpness=5 #0-8
exposure= 7 #0-100
gain=2 #0-100
white_balance=2800 #2800-6500

cap.set(cv2.CAP_PROP_AUTO_EXPOSURE,0)
cap.set(cv2.CAP_PROP_FRAME_WIDTH, resolucion[0])
cap.set(cv2.CAP_PROP_FRAME_HEIGHT, resolucion[1])
cap.set(cv2.CAP_PROP_FPS, fps)
cap.set(cv2.CAP_PROP_BRIGHTNESS,brightness)
cap.set(cv2.CAP_PROP_CONTRAST,contrast)
cap.set(cv2.CAP_PROP_SATURATION,saturation)
cap.set(cv2.CAP_PROP_EXPOSURE,exposure)
cap.set(cv2.CAP_PROP_GAIN,gain)

Hi,

I think you are doing it the wrong way. You should use the camera controls functions from the SDK.
There is an example here : zed-sdk/camera control/python/camera_control.py at master · stereolabs/zed-sdk · GitHub

Hello, thanks for answering.

Is there any other way to modify the camera parameters from python? like the exposure, but without requiring the use of the SDK

You’ll be more limited if you don’t want to use the SDK. But check out this repo : GitHub - stereolabs/zed-open-capture: Low level camera driver for the ZED stereo camera family. API docs available here: