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.
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. An image that utilizes a full range of intensities (rather than a small subsection of intensities) means we can pick up on more details in the image.
But they use different techniques. Contrast Stretching works like mapping.
This is why Contrast Stretching is un-reliable, if there exist only two pixels have 0 and 255 intensity, it is totally useless.
A better approach than Contrast Stretching is Histogram Equalisation, which uses probability distribution (PDF). You can learn the steps here