# importance of using histogram equalization

I'm reading opencv tutorials and I'm diving into histogram equalization. i have looked in wikipedia, there is a nice example that sums up exactly the problem:

original:

equalized:

but for getting this result i would take a different approach:

1. find the minimum and maximum in the original

2. normalize (remap) everything upon it.

no histogram, no cumulative distribution function. for sure a more stupid approach but i can't see the difference.. why use histogram equalization? can someone can help me in make the reason out?

The difference is that with your method, if you imagine the histogram, you're simply going to stretch it to span from 0 to 255, but its shape will be preserved. Histogram equalization not only stretches your histogram, but also tries to make it flat, so that you get an approximately even distribution of pixels of every shade of gray.

In terms of why one is better for certain applications than others, that's application specific.

Edit:

Here are some examples from Bruzed:

Histogram equalization:

As you can see, the bulk of the pixels in the original image was gray, represented by a large peak in the middle. When you do contrast stretching, the peak is still there, even though your darkest pixel is now black and you brightest pixel is now white. By contrast (pun intended), using histogram stretching you get a much flatter histogram response. This actually increases the overall contrast of the image.

• can you provide some example? Jul 17, 2012 at 17:46
• @nkint Example of applications or example of how the two are different? Jul 17, 2012 at 17:47
• how the two are different! Jul 17, 2012 at 17:48
• To complement on Phonon's answer, here is a situation where the two are different. You have an underexposed photograph - dark and dark grey everywhere (say values are restricted in 0 the 55 range). Yet, because of a sensor problem, there is a lone hot pixel at 255. Histogram normalization will yield a correctly exposed image, with some loss of dynamic range of course. Your suggest approach will not change anything because the minimum in the input is 0 and the maximum is 255. Jul 17, 2012 at 18:16
• Also, instead of using min an max as references for normalization, one can use percentiles, for example 10th and 90th percentile. Jul 17, 2012 at 23:23