I'm interested in performing image pre-processing for various computer vision tasks, and have a question about histogram equalization.

As I understand it, histogram equalization is a non-linear function applied to the image with the intention of increasing contrast. This is generally applied per-image, using the YCbCr color space (equalize using the Y channel), and is either done to match a normally distributed histogram (Gaussian) or uniformly distributed histogram (flat). My question is, which is preferred for vision tasks such as image recognition? My intuition is that a Gaussian histogram would amplify less noise given its flat tails (and so would be preferred), but I am interested in a more theoretical or at least empirical reason.

It would be also helpful if there was a good metric for the "flatness" or distribution of a histogram. This would be very helpful when expressing the behavior of my equalization function.


1 Answer 1


Unfortunately, the answer to this question is a great big "it depends". If the images you are working with tend to be pretty flat with no large humps, then a uniform distribution might be for you. If it has a single peak, a Gaussian could be good. However, it may also be the case that normalization using either of these methods could cause you to lose signal. There was a paper out of Stanford looking at image processing in pathology that found that many of the commonly used methods in the field actually caused a loss of signal.

If you want to use a histogram normalization method, your most important first step should be looking at a bunch of your image histograms. If, for example, your histograms look bimodal, those two peaks could be characterizing unique elements of your data, so squeezing them into either a uniform or a Gaussian distribution could remove a lot of signal. For this reason, some histogram equalization methods will choose their target distribution to be one of the images in the sample set so that the basic shape remains intact.

One peice of advice I would give is to look into an adaptive histogram equalization methods like AHE or even better CLAHE. These methods normalize each pixel based on the pixels in their local neighborhood, so they have less of a tendency to distort the image based on outlier tails, and they keep more of the shape of the original histogram while still moving the image into a normalized space. Also in my experience with these methods, the choice of the target distribution tends to matter much less than in non adaptive methods (though I generally find a Rayleigh distribution to do well).

In the end, I feel that when it comes to normalization methods the the proof of the pudding is in the eating. Try a couple of different things and see how it effects your outcome. Gather a few of your images that should have the same properties but have different lighting artifacts and see if features you want to collect from them are more similar after normalization (the Stanford paper has examples of metrics for this). The thing you should not do is visually inspect the images to see which seem more "normalized" to you because computers look at very different things than humans do. Computers "see" texture very well, and humans are particularly awful at seeing texture, so your visual analysis will likely miss everything the computer is using to characterize the images.

Finally, as for tests for histogram "flatness", your best bet would be a Chi Squared test with your target being a discrete uniform distribution. However, I would note that like many tests for fit of theoretical distributions, for larger values of N, you almost always will reject the null hypothesis. The theoretical distributions are "perfect" so it doesn't take much deviance from that to call for rejection. These aren't tests for "uniformish" data, so perfectly uniform data except for a small outlier on the tail will be all you need for rejection. While less quantitative, a Q-Q plot can often be more useful in determining how well your data fit a distribution.

  • $\begingroup$ Thank you very much for your detailed and helpful answer $\endgroup$
    – Kantthpel
    Commented Sep 14, 2016 at 22:39
  • $\begingroup$ No problem, sorry it took a month for someone to give you an answer. $\endgroup$
    – Barker
    Commented Sep 14, 2016 at 22:53
  • $\begingroup$ Thankfully its a longer-term research problem that I'm working on, so this input is useful even a month after! $\endgroup$
    – Kantthpel
    Commented Sep 14, 2016 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.