Skip to content

How to set auto-exposure mode ? #52

@salocinx

Description

@salocinx

I am working with OpenCV 3.4.2 and Visual Studio 2015 / C++ on Windows 10.

I can set the exposure of the camera to any value by using this code:

cv::VideoCapture *cap;  
...
cap = new cv::VideoCapture(0);
cap->set(CV_CAP_PROP_EXPOSURE, exposure);   // exposure = [0, 255]

Now I would like to switch to auto-exposure too. How can I set the camera to auto-exposure mode?

I tried the following:

cap->set(CV_CAP_PROP_EXPOSURE, 0);       // not working
cap->set(CV_CAP_PROP_EXPOSURE, -1);      // not working
cap->set(CV_CAP_PROP_AUTO_EXPOSURE, 1);  // not working, exposure stays fixed
cap->set(CV_CAP_PROP_AUTO_EXPOSURE, 0);  // not working, exposure stays fixed
cap->set(CV_CAP_PROP_AUTO_EXPOSURE, -1); // not working, exposure stays fixed

Any idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions