# Set camera paramter without reset of it

**URL:** <https://forum.opencv.org/t/set-camera-paramter-without-reset-of-it/15021>\
**Category:** Uncategorized\
**Created:** [October 28, 2023, 6:44pm UTC](https://forum.opencv.org/t/set-camera-paramter-without-reset-of-it/15021 "2023-10-28T18:44:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![abcdcadb](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/abcdcadb/32/8983_2.png) [@abcdcadb](https://forum.opencv.org/u/abcdcadb)\
**Post date:** [October 28, 2023, 6:44pm UTC](https://forum.opencv.org/t/set-camera-paramter-without-reset-of-it/15021/1 "2023-10-28T18:44:44Z")

</div>

I need to change the cap\_prop\_auto\_exposure by some condition of my app. The problem is when i call camera.set(cap\_prop\_auto\_exposure), it does not work if i dont call camera.release and camera.open before.  
In other words, i can change cameram’s parameters only once when i turn it on.  
Is it true? Is there any to change parameters without reset of the camera?

---

<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 28, 2023, 7:28pm UTC](https://forum.opencv.org/t/set-camera-paramter-without-reset-of-it/15021/2 "2023-10-28T19:28:58Z")

</div>

what OS, or rather, what CAP backend?

---

<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 28, 2023, 7:38pm UTC](https://forum.opencv.org/t/set-camera-paramter-without-reset-of-it/15021/3 "2023-10-28T19:38:19Z")

</div>

windows 10 here.

DSHOW doesn’t do anything, cap.get returning -1.  
MSMF does something, cap.get always returning 0.

range is 0 … 3 in case of V4L2 API. other backends treat it as a boolean.

```python
import cv2 as cv
if True:
    cap = cv.VideoCapture(0) # apiPreference=cv.CAP_...
    assert cap.isOpened()
    def set_auto_exposure(value):
        cap.set(cv.CAP_PROP_AUTO_EXPOSURE, value)
        print("new value", cap.get(cv.CAP_PROP_AUTO_EXPOSURE))
    cv.namedWindow("cap")
    cv.createTrackbar("AUTO_EXPOSURE", "cap", 0, 3, set_auto_exposure)
    while True:
        ret, frame = cap.read()
        if not ret: break
        cv2.imshow("cap", frame)
        if cv2.waitKey(1) in (13, 27): # esc/enter
            break
    cap.release()
    cv.destroyAllWindows()

```

---

<div class="post-metadata">

**Author:** ![abcdcadb](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/abcdcadb/32/8983_2.png) [@abcdcadb](https://forum.opencv.org/u/abcdcadb)\
**Post date:** [October 28, 2023, 7:47pm UTC](https://forum.opencv.org/t/set-camera-paramter-without-reset-of-it/15021/4 "2023-10-28T19:47:32Z")

</div>

Thank for reply.  
It is ubuntu 20.04 on jetson nvidia.

Cap.set is done on c++  
I dont understand the “backend” you mentioned, what are dshow and msmf?
