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?
what OS, or rather, what CAP backend?
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.
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()
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?