Search code examples
pythonimageopencvcameravideo-capture

Right name for Python OpenCV video capture exposure setting


I know this is a useless question, but I couldn't find di answer anywhere, so I'm curious to find the answer.
I am using OpenCV 3.1.0 and Python 3.5.2 to capture some images with different exposure time with cv2.VideoCapture, like this:

cap = cv2.VideoCapture(0)
k = -4
cap_next = cap.set(15, k)
ret, img = cap.read()
outcam = './img.jpg'
cv2.imwrite(outcam, img)
cap.release()

However, I managed to access to the exposure video attribute only through its number, and not with its name string: when I substitute 15 with CAP_PROP_EXPOSURE or CV_CAP_PROP_EXPOSURE I get the error NameError: name 'CAP_PROP_EXPOSURE' is not defined.
Do you know how to do that with my current version of OpenCV?


Solution

  • Do you use CAP_PROP_EXPOSURE or cv2.CAP_PROP_EXPOSURE?

    In my OpenCV 3.1.0, Python 2.7 there is such value:

    print cv2.CAP_PROP_EXPOSURE
    15