Difference between contrast stretching and histogram equalization

Jeru Luke picture Jeru Luke · Dec 13, 2016 · Viewed 31.2k times · Source

I would like to know the difference between contrast stretching and histogram equalization.

I have tried both using OpenCV and observed the results, but I still have not understood the main differences between the two techniques. Insights would be of much needed help.

Answer

eneski picture eneski · Mar 16, 2017

Lets Define Contrast first,

Contrast is a measure of the “range” of an image; i.e. how spread its intensities are. It has many formal definitions one famous is Michelson’s:

He says contrast = ( Imax - Imin )/( Imax + I min )

Contrast is strongly tied to an image’s overall visual quality. Ideally, we’d like images to use the entire range of values available to them.

Contrast Stretching and Histogram Equalisation have the same goal: making the images to use entire range of values available to them.enter image description here

But they use different techniques. Contrast Stretching works like mapping

it maps minimum intensity in the image to the minimum value in the range( 84 ==> 0 in the example above )

With the same way, it maps maximum intensity in the image to the maximum value in the range( 153 ==> 255 in the example above )

This is why Contrast Stretching is un-reliable, if there exist only two pixels have 0 and 255 intensity, it is totally useless.

However a better approach is Histogram Equalisation which uses probability distribution. You can learn the steps here