Ask Your Question

Is there any range of values for the exposure flag?

asked 2016-06-10 09:17:34 -0500

Sarala gravatar image

updated 2016-06-16 13:42:46 -0500

pklab gravatar image

What is the unit of exposure value? seconds? . Also, is there any range of value?

edit retag flag offensive close merge delete


there is no unit for exposure flag in videocapture.

LBerger gravatar imageLBerger ( 2016-06-10 09:40:39 -0500 )edit

So, if i want my exposure time to be 15 sec, then how to do that?

Sarala gravatar imageSarala ( 2016-06-10 09:52:19 -0500 )edit

use driver library of you vision system

LBerger gravatar imageLBerger ( 2016-06-10 10:37:31 -0500 )edit

Hello, Due to some reasons i had to install anaconda python with opencv. And now it says "module has no attribute "cv2.CV_CAP_PROP_EXPOSURE". I want to change the exposure time of my camera what to do?

Sarala gravatar imageSarala ( 2016-06-14 05:43:25 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2016-06-16 13:38:12 -0500

pklab gravatar image

the enum should be CAP_PROP_EXPOSURE but isn't work with many API/cameras.

The VideoCapture base class is implemented with different VideoInput classes for different APIs like CAP_DSHOW, CAP_VFW, CAP_MSMF .... Each API might support or not any properties.

The CAP_PROP_EXPOSURE isn't generally supported. You can check OpenCV yourself looking at the setProperty method for any API implementation here (Check the files cap_*.cpp). For example

  • Sure VFW, MSMF or V4L do not support CAP_PROP_EXPOSURE
  • CAP_DSHOW should support but isn't guaranteed

In addiction the API itself is interfacing with the cam drivers that should respect standards but most often wont.

This means that for example some cameras accepts values for exposure but as a step of pre-defined range like from 1..10 that is not time. Using DSHOW the accepted range is available only internally here or here but you have to use the Debug breakpoints to read.

Conclusion: if you need to control the exposure use driver library of you vision system as suggested by @LBerger

edit flag offensive delete link more


@pklab@Sarala Actually, V4L supports CAP_PROP_EXPOSURE. You just have to change the CAP_PROP_AUTO_EXPOSURE setting (which is toggled on "auto" mode by default on many cases) to switch it from "auto" to "manual" :

capture.set(cv::CAP_PROP_AUTO_EXPOSURE, 0.25) // where 0.25 means "manual exposure, manual iris"

Then, you will be able to set CAP_PROP_EXPOSURE correctly.

The CAP_PROP_EXPOSURE setting won't work if you downloaded OpenCV directly from their download page, because their official build lasts from decembrer 2015. The V4L exposure setting has been corrected on april 18th 2016 and thus hasn't been included in the build from the official download page.

Major Squirrel gravatar imageMajor Squirrel ( 2016-06-20 08:24:11 -0500 )edit

@Major Squirrel thank you for your tips. Also CAP_DSHOW suffers same issue because current implementation doesn't consider the auto/manual mode.

In general videoio is a complex module based on vary videoInput libraries from different sources. Sincerely it should be used with care because result could be different on different platform and/or cameras.

pklab gravatar imagepklab ( 2016-06-22 13:42:53 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2016-06-10 09:16:25 -0500

Seen: 5,751 times

Last updated: Jun 16 '16