Set/get camera properties from code

Hi,

I need to be able to get and set the properties of my webcam (brightness, contrast, saturation, backlight compensation, exposure and gain). I know that ofVideoGrabber has the “videoSettings()” function that pops up a window where I can control the camera settings, but I need to do that form my code (not from a window).

Reading the videoInput.h file I found the following functions:

setVideoSettingCamera
setVideoSettingCameraPct
getVideoSettingCamera

and the following list of properties:

  
  
                                long propBrightness;  
		long propContrast;  
		long propHue;  
		long propSaturation;  
		long propSharpness;  
		long propGamma;  
		long propColorEnable;  
		long propWhiteBalance;  
		long propBacklightCompensation;  
		long propGain;  
		long propPan;  
		long propTilt;  
		long propRoll;  
		long propZoom;  
		long propExposure;  
		long propIris;  
		long propFocus;  
  

As the ofVideoGrabber has no functions to “manualy” set/get these properties I am trying to find out the way to write the functions myself:

Shoud I crate a new class (which extends the ofVideoGrabber class) and ad new methods, for example “setCameraProperty” and “getCameraProperty” using videoInput’s setVideoSettingCamera and getVideoSettingCamera?

Is there a more appropiate way of doing this?

Any advice is welcome! Thanks in advance

By the way, if you have a firewire camera, you can enable settings in code by using the ofxVideoGrabber addon. Not sure if this helps you though…

I wonder if the other implementations (OF_VIDEO_CAPTURE_UNICAP, OF_VIDEO_CAPTURE_GSTREAMER, OF_VIDEO_CAPTURE_QUICKTIME) allow these kind of settings too?

It’d be very helpful to have this across all platforms. For now I’ve just added a method to my ofVideoGrabber that calls the videoInput method. If you’re planning on sharing it with other people, extending the class is probably the best method.

Did you managed to find a way for this?

Mind sharing the extended class for manual video setting adjustment?