Difference between contrast stretching and histogram equalization

In Histogram equalization, you want to flatten the histogram into a uniform distribution.

enter image description here

In contrast stretching, you manipulate the entire range of intensity values. Like what you do in Normalization.

enter image description here


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


I came across the following points after some reading.

Contrast stretching is all about increasing the difference between the maximum intensity value in an image and the minimum one. All the rest of the intensity values are spread out between this range.

Histogram equalization is about modifying the intensity values of all the pixels in the image such that the histogram is "flattened" (in reality, the histogram can't be exactly flattened, there would be some peaks and some valleys, but that's a practical problem).

In contrast stretching, there exists a one-to-one relationship of the intensity values between the source image and the target image i.e., the original image can be restored from the contrast-stretched image.

However, once histogram equalization is performed, there is no way of getting back the original image.