How to set or get VideoCapture Properties

asked 2014-05-16 12:07:09 -0600

Ketta gravatar image

updated 2014-05-16 12:07:52 -0600

Hello all.

I am attempting to set the properties of a nice Webcam with OpenCV. In particular, I would like to be able to change the exposure, gain, and auto-exposure/gain properties of my camera. I have tried setting properties with methods such as the following in my project:

bool CaptureThread::connectToCamera()
{
cap = new VideoCapture(0);
cap->set(CV_CAP_PROP_FRAME_WIDTH, width);
cap->set(CV_CAP_PROP_FRAME_HEIGHT, height);
cap->set(CV_CAP_PROP_EXPOSURE, 0.20); //Or multiple other values here.
return cap->isOpened();
}

The width and height parameters are set accordingly here and elsewhere, but any other parameters I attempt to pass are ignored. My only real goal is to be able to set these values manually so that the camera doesn't waste time balancing itself for a clearer image. (This will be used in an entirely closed lightening environment.

Can anyone help me with this issue, or let me know if these functions aren't usable by all cameras? Otherwise, do you have suggestions for a workaround?

I apologize if I am not being clear or giving enough information. I will try to clarify anything else that is needed of me.

edit retag flag offensive close merge delete

Comments

Its not explicitly mentioned, but the return value should give you a clue if the set was successful. Its a simple boolean.

Moster gravatar imageMoster ( 2014-05-16 14:51:34 -0600 )edit

@Ketta Also see the answer here might be helpful.

Haris gravatar imageHaris ( 2014-05-17 01:15:35 -0600 )edit