0

I am trying to improve the quality of an image.

I use emgu for this.

I use this code to change the contrast (I think!).

Image<Bgr, byte> improveMe = new Image<Bgr, byte>(grid);
improveMe._EqualizeHist();

For a daytime image I get this:

enter image description here

For a night time image I get this:

enter image description here

Obviously, not so good!

The 1st image is nice and lush and the 2nd is as you can see could be descirbed as over-exposed.

Are there ways to avoid get such a poor image at night-time? Is it because the image is now lower in color channels (if that makes sense)? Should I check for min/max color ranges of an image before deciding to apply this filter? Should I use a completely different filter?

Reading material links are welcome answers as well...

Andrew Simpson
  • 6,883
  • 11
  • 79
  • 179

1 Answers1

2

There are many ways to do this some better then others depending whether is a video feed, still and even camera shutter speed... and so on.

I would recommend you to try "adaptive threshold" (EMGU ThresholdAdaptive function) and also check some white balance algorithms. Check this one: White balance algorithm

Community
  • 1
  • 1
tweellt
  • 2,171
  • 20
  • 28
  • Hi, thanks for all that info. Looks good. I will take time to go through it all and report back tomorrow. Thanks :) – Andrew Simpson Mar 13 '14 at 20:01
  • Hi, very quickly though will not the adaptive threshold work by converting to binary and thus black and white? – Andrew Simpson Mar 13 '14 at 20:04
  • @Andrew, yes in its base image "binarization" is need to get threshold levels, after that you can average with every pixel RGB. That's one of the common ways to correct color burst, in your case excessive white. Also, really, check white balance, I think you will get good results adding that. – tweellt Mar 13 '14 at 21:48
  • Hi, I will definitely look and implement/test that link to the white balance. Apologies for asking such a naive question (I am still learning all this - and is rare to find people to talk to about this subject) but how would I apply the adaptive thresholding in code/sudo code? – Andrew Simpson Mar 14 '14 at 06:11
  • Also, will give you the 'coveted green tick' as you gave me the info I asked for. – Andrew Simpson Mar 14 '14 at 06:11
  • To give something back here, I asked Canming Huang (author of Emgu) and he gave this reply which I intend to look at as well: May be it is one of the functions in this class: http://sourceforge.net/p/emgucv/code/ci/master/tree/Emgu.CV/PInvoke/CvInvokePhoto.cs This is GIT development code that will be included in Emgu CV 3.0 – Andrew Simpson Mar 14 '14 at 06:12
  • I am obviously not functioning this well this morning but where/what is the algorithm for white-balancing you suggest I look at please? Thanks :) – Andrew Simpson Mar 14 '14 at 06:26
  • 1
    @AndrewSimpson, Sorry for the late reply... Here is a link applying color correction and white balance, check this... http://tracking-people.googlecode.com/svn/branches/WiimoteIRTracking/IdeaTester/ColorCalibrator.cs – tweellt Mar 15 '14 at 15:28