1

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?

user3460905
  • 11
  • 1
  • 5

2 Answers2

2

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

CvInvoke.cvSetCaptureProperty(_capture.Ptr, CAP_PROP.CV_CAP_PROP_BRIGHTNESS, newBrightnessValue);
NorthCat
  • 9,643
  • 16
  • 47
  • 50
  • 1
    What version of EmguCV does this apply to? `3.1.0.1` does't appear to have the `Emgu.CV.CvInvoke.cvSetCaptureProperty` method. It does have `CvInvoke.cveVideoCaptureSet` though. – dthor Feb 09 '17 at 19:03
0

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.

Community
  • 1
  • 1
Shiva
  • 6,677
  • 4
  • 36
  • 61
  • 1
    You can find and example of setting camera capture properties here http://www.emgu.com/wiki/index.php?title=Camera_Capture but if the camera does not support it Shiva methods would be the best option – Chris Mar 26 '14 at 09:45
  • Yes, I know about that, but I need also to set Exposure and White Balance. AFAIK it's not possible to set Exposure this way, it must be done before image is captured. Is there any easy way to access exposure setting without need to change all of my code? Camera is chinese one, DirectShow compatible. I tried using DirectShowNET library, but it is too complicated for me. With EmguCV I can easily capture frames and manipulate them, but it has this problem with camera settings. So I'd like to know if there is some little chunk of code that could help me with setting of Exposure. – user3460905 Mar 26 '14 at 12:16