user3460905
user3460905

Reputation: 11

How to set webcam properties with EmguCV?

I made an application in C# following the EmguCV tutorials for capture of web camera. Preview is working fine, but I can't change the camera properties like brightness,exposure etc. and I need to implement this in my application. In documention it's said I should do it with CAP_PROP Enumeration, but it's not working, here is my code where I change brightness:

_capture.SetCaptureProperty(Emgu.CV.CvEnum.CAP_PROP.CV_CAP_PROP_BRIGHTNESS, newBrightnessValue);

but nothing changes...

I found some responses on EmguCV forums, in which they say this should not be done with EmguCV, but I have done most of my project using EmguCV and I wouldn't like to start over with some other library just because of this :/

Is there some alternative way of doing this, but not too complicated like DirectShow? Maybe some lib which could set these properties, without need to change the rest of code I have made using Emgu CV?

Upvotes: 1

Views: 5170

Answers (2)

I have faced same issue, found out that this is working:

CvInvoke.cvSetCaptureProperty(_capture.Ptr, CAP_PROP.CV_CAP_PROP_BRIGHTNESS, newBrightnessValue);

Upvotes: 2

Shiva
Shiva

Reputation: 6887

You can directly manipulate the brightness,contrast,gamma values of an image after its captured.

So some of the techniques will be like this.

Image<Bgr, byte> myImage;// you can store a static image from disk or 
                         //load one from web cam frame in it

myImage= myImage.Mul(brightValue);// multiply the image with decimal number 
                                  //to increase the brightness

myImage._EqualizeHist(); //to improve the contrast read documentation,
                         //as you can play around the threshold values too.

myImage._GammaCorrect(1.8d);// give a decimal value to adjust the gamma value

You can refer to this post as it might help.

Upvotes: 0

Related Questions