Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Why am I not able to change all settings of Logitech C920 camera using opencv-python?

I am using opencv 2.7 and python27. I tried getting and changing the camera settings such as contrast, brightness,gain,exposure,etc. I am not able to change any of the camera properties viz EXPOSURE, ZOOM, FOCUS. Though I am able to read the exposure value which shows up in the range of -5 to -1. I don't know if this is the correct value it is showing. But I not not able change it using this command in python- cap.set(cv2.cv.CV_CAP_PROP_EXPOSURE,-3). Any help in changing the exposure setting will be very helpful.

import numpy as np
import cv2
cap = cv2.VideoCapture(0)

gain = cap.get(cv2.cv.CV_CAP_PROP_GAIN)
print "Gain: {0}".format(gain)
cap.set(cv2.cv.CV_CAP_PROP_GAIN,120)
cap.set(cv2.cv.CV_CAP_PROP_EXPOSURE,-3)
expo = cap.get(cv2.cv.CV_CAP_PROP_EXPOSURE)
print "Exposure: {0}".format(expo)

cap.release()
click to hide/show revision 2
retagged

updated 2017-10-05 23:54:38 -0600

berak gravatar image

Why am I not able to change all settings of Logitech C920 camera using opencv-python?

I am using opencv 2.7 and python27. I tried getting and changing the camera settings such as contrast, brightness,gain,exposure,etc. I am not able to change any of the camera properties viz EXPOSURE, ZOOM, FOCUS. Though I am able to read the exposure value which shows up in the range of -5 to -1. I don't know if this is the correct value it is showing. But I not not able change it using this command in python- cap.set(cv2.cv.CV_CAP_PROP_EXPOSURE,-3). Any help in changing the exposure setting will be very helpful.

import numpy as np
import cv2
cap = cv2.VideoCapture(0)

gain = cap.get(cv2.cv.CV_CAP_PROP_GAIN)
print "Gain: {0}".format(gain)
cap.set(cv2.cv.CV_CAP_PROP_GAIN,120)
cap.set(cv2.cv.CV_CAP_PROP_EXPOSURE,-3)
expo = cap.get(cv2.cv.CV_CAP_PROP_EXPOSURE)
print "Exposure: {0}".format(expo)

cap.release()