# Change exposure with OpenCv - Linux

**URL:** <https://forum.opencv.org/t/change-exposure-with-opencv-linux/10647>\
**Category:** C++\
**Tags:** linux, videoio\
**Created:** [October 23, 2022, 1:33pm UTC](https://forum.opencv.org/t/change-exposure-with-opencv-linux/10647 "2022-10-23T13:33:38Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roei](https://avatars.discourse-cdn.com/v4/letter/r/f0a364/32.png) [@Roei](https://forum.opencv.org/u/Roei)\
**Post date:** [October 23, 2022, 1:33pm UTC](https://forum.opencv.org/t/change-exposure-with-opencv-linux/10647/1 "2022-10-23T13:33:38Z")

</div>

Hi,

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?

Thanks!

---

<div class="post-metadata">

**Author:** ![voe](https://avatars.discourse-cdn.com/v4/letter/v/ea5d25/32.png) [@voe](https://forum.opencv.org/u/voe)\
**Post date:** [October 23, 2022, 1:51pm UTC](https://forum.opencv.org/t/change-exposure-with-opencv-linux/10647/2 "2022-10-23T13:51:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Roei](https://avatars.discourse-cdn.com/v4/letter/r/f0a364/32.png) [@Roei](https://forum.opencv.org/u/Roei)\
**Post date:** [October 23, 2022, 2:02pm UTC](https://forum.opencv.org/t/change-exposure-with-opencv-linux/10647/3 "2022-10-23T14:02:13Z")

</div>

Hi,

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

cv::VideoCapture::set(cv::CAP\_PROP\_AUTO\_EXPOSURE, 70)

Does it make sense?

Thanks!

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [October 23, 2022, 7:39pm UTC](https://forum.opencv.org/t/change-exposure-with-opencv-linux/10647/4 "2022-10-23T19:39:14Z")

</div>

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

see:

> [@voe](#):
>
> There is a chance that the camera driver in linux does not expose that in it’s api.

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

---

<div class="post-metadata">

**Author:** ![Roei](https://avatars.discourse-cdn.com/v4/letter/r/f0a364/32.png) [@Roei](https://forum.opencv.org/u/Roei)\
**Post date:** [October 24, 2022, 8:27am UTC](https://forum.opencv.org/t/change-exposure-with-opencv-linux/10647/5 "2022-10-24T08:27:28Z")

</div>

Hi,

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?

Thanks!

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [October 24, 2022, 9:24am UTC](https://forum.opencv.org/t/change-exposure-with-opencv-linux/10647/6 "2022-10-24T09:24:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Rambo](https://avatars.discourse-cdn.com/v4/letter/r/e274bd/32.png) [@Rambo](https://forum.opencv.org/u/Rambo)\
**Post date:** [October 24, 2022, 11:31am UTC](https://forum.opencv.org/t/change-exposure-with-opencv-linux/10647/7 "2022-10-24T11:31:41Z")

</div>

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?

Thanks!

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [October 24, 2022, 1:26pm UTC](https://forum.opencv.org/t/change-exposure-with-opencv-linux/10647/8 "2022-10-24T13:26:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![voe](https://avatars.discourse-cdn.com/v4/letter/v/ea5d25/32.png) [@voe](https://forum.opencv.org/u/voe)\
**Post date:** [October 24, 2022, 1:32pm UTC](https://forum.opencv.org/t/change-exposure-with-opencv-linux/10647/9 "2022-10-24T13:32:49Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Rambo](https://avatars.discourse-cdn.com/v4/letter/r/e274bd/32.png) [@Rambo](https://forum.opencv.org/u/Rambo)\
**Post date:** [October 24, 2022, 1:40pm UTC](https://forum.opencv.org/t/change-exposure-with-opencv-linux/10647/10 "2022-10-24T13:40:26Z")

</div>

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

Thanks!
