Skip to content

CAP_PROP_AUTO_EXPOSURE not working with DSHOW backend #17019

@DMardanbegi

Description

@DMardanbegi
System information (version)

Python 3.7.4 (64 bit)
Windows 10
opencv-python==4.0.0.21
opencv-contrib-python==4.0.0.21

Detailed description

I'm able to turn the autoexposure off and set the exposure manually using cv2.CAP_PROP_EXPOSURE and turn the autoexposure back on using CAP_PROP_AUTO_EXPOSURE with MSMF backend. With DSHOW backend however, I cannot turn the autoexposure back on.

Code
import cv2
_capture = cv2.VideoCapture(0, cv2.CAP_DSHOW)
_ret, img = _capture.read()

# turn the autoexposure off
print(_capture.set(cv2.CAP_PROP_EXPOSURE, -7))  # works

# print(_capture.set(cv2.CAP_PROP_EXPOSURE, 1))  # didn't work
print(_capture.set(cv2.CAP_PROP_AUTO_EXPOSURE, 0.75))  # didn't work

_ret = True
while _ret:
    _ret, img = _capture.read()
    key_code = cv2.waitKey(1)
    if (key_code == 27) or (key_code == ord('q')): 
        break
    cv2.imshow('img', img)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions