Ask Your Question

How do I set exposure time of Logitech C922 webcam on OpenCV?

asked 2017-08-13 09:33:11 -0500

keyboardwarriror gravatar image


I am writing a code for a project, and it requires some color segmentation which seems to be quite sensitive to the camera settings. I can get the frame size, brightness, autofocus, contrast and etc to set to a certain value, but I can't seem to set the exposure. My webcam always changes to auto exposure, and I prefer to have a set manual exposure. I tried the code below:

import cv2 import numpy as np cap = cv2.VideoCapture(1) cap.set(cv2.CAP_PROP_FRAME_WIDTH, 864) cap.set(cv2.CAP_PROP_FRAME_HEIGHT, 480) cap.set(cv2.CAP_PROP_BRIGHTNESS, 0.7) cap.set(cv2.CAP_PROP_AUTOFOCUS,0) cap.set(cv2.CAP_PROP_EXPOSURE,0.5)

but as I stated before, it will not change the exposure. Does anyone have any experience with c922 webcams, or have any suggestions?


edit retag flag offensive close merge delete


Try using webcam driver if it works in C++, import your function to python.

Ziri gravatar imageZiri ( 2017-08-14 00:01:34 -0500 )edit

2 answers

Sort by ยป oldest newest most voted

answered 2019-01-04 01:55:19 -0500

pjoe gravatar image

I can set manual exposure like this (on windows):

cap.set(cv2.CAP_PROP_AUTO_EXPOSURE, 0)
cap.set(cv2.CAP_PROP_EXPOSURE, -6)

I believe the values are negative power of 2, e.g. -4 would be 1/16

I do however have issues turning on auto exposure. When getting the property value it always return -1

edit flag offensive delete link more

answered 2017-08-15 03:40:02 -0500

supra56 gravatar image
edit flag offensive delete link more


please do not post link-only answers

(this also does not answer the question)

berak gravatar imageberak ( 2017-08-19 00:54:41 -0500 )edit

Question Tools

1 follower


Asked: 2017-08-13 09:33:11 -0500

Seen: 8,587 times

Last updated: Aug 15 '17