Change exposure with OpenCv - Linux


I’m using OpenCv to change exposure on my camera.
It works fine on Windows, but doesn’t work on linux.

I’m using cv::VideoCapture::set(cv::CAP_PROP_EXPOSURE, value).

Can you please help me with implement that on Linux?


There is a chance that the camera driver in linux does not expose that in it’s api. Maybe you can try auto exposure?


It doesn’t work with auto exposure. I did the following:

cv::VideoCapture::set(cv::CAP_PROP_AUTO_EXPOSURE, 70)

Does it make sense?


auto exposure is a boolean, i.e. 0 or 1.


can you affect your camera’s settings, on linux, using any other program, like VLC or guvcview?


I’m using Open CV to change exposure, using cv::set(cv::CAP_PROP_EXPOSURE, value).
It works Great.

However - I would like to change the state back to auto exposure.
After using cv::set(cv::CAP_PROP_AUTO_EXPOSURE, 1), I’m expecting to see the frame with normal exposure, but it doesn’t happen. The frame stays with the same value. Is it possible?


did you read (and look at) multiple frames after changing the settings?

Using CAP_PROC_EXPOSURE, I can change exposure value successfully.

However, when trying to set auto exposure to on, using CAP_CROP_AUTO_EXPOSURE, it doesn’t work (setting auto exposure to off - works).

Do you know if the is a way to change auto exposure back to on?


do not use multiple accounts, do not open multiple threads for the same issue. I’ve merged the threads.

On windows use cap = cv2.VideoCapture(1, cv2.CAP_DSHOW) and
cap.set(cv2.CAP_PROP_SETTINGS, 1) opens camera settings. There you can check what the values typically are because 70 might be out of range.

Yes - I can see the values and change to auto exposure from the settings window. Can I do that from the code?