Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between contrast stretching and histogram equalization

Tags:

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.

like image 495
Jeru Luke Avatar asked Dec 13 '16 10:12

Jeru Luke


People also ask

What are the differences between histogram equalization and histogram matching?

While the goal of histogram equalization is to produce an output image that has a flattened histogram, the goal of histogram matching is to take an input image and generate an output image that is based upon the shape of a specific (or reference) histogram. Histogram matching is also known as histogram specification.

What is contrast stretching?

Contrast stretching (often called normalization) is a simple image enhancement technique that attempts to improve the contrast in an image by 'stretching' the range of intensity values it contains to span a desired range of values, the full range of pixel values that the image type concerned allows.

What is another name for histogram equalization?

In this tutorial we will see that how histogram equalization can be used to enhance contrast. Before performing histogram equalization, you must know two important concepts used in equalizing histograms. These two concepts are known as PMF and CDF.

Does histogram equalization increase contrast?

Histogram Equalization is a computer image processing technique used to improve contrast in images . It accomplishes this by effectively spreading out the most frequent intensity values, i.e. stretching out the intensity range of the image.


2 Answers

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

like image 56
eneski Avatar answered Sep 21 '22 02:09

eneski


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.

like image 33
Jeru Luke Avatar answered Sep 19 '22 02:09

Jeru Luke