Ask Your Question
0

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

asked 2017-10-05 23:44:53 -0600

glx00 gravatar image

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

berak gravatar image

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()
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2017-10-05 23:53:02 -0600

berak gravatar image

updated 2017-10-05 23:53:43 -0600

unfortunately, there is no guarantee, that any capture properties apart from width or height are supported by your combination of camera driver / capture / os.

it seems, you're just out of luck with it. (it's not a "python problem")

ps: please avoid using the deprecated cv2.cv api, it is no more there in recent cv2. please use cv2.CAP_PROP_GAIN , etc.

edit flag offensive delete link more

Comments

There must be some way of doing this. What options can I explore?

glx00 gravatar imageglx00 ( 2017-10-06 00:29:26 -0600 )edit

i don't think, you can, via python/cv2.

there should be a "global" , persistent variable panel for your cam, try to access that like: guvcview -z or from vlc

berak gravatar imageberak ( 2017-10-06 01:24:47 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2017-10-05 23:44:53 -0600

Seen: 3,586 times

Last updated: Oct 05 '17