Contrast Stretching

 

Home
Contrast Stretching
LoG Filter
Periodic Noise
Binary Methods
Particle Counting
Color Thresholding

Lab 1

 

Background:

Contrast stretching (also called Normalization) attempts to improve an image by stretching the range of intensity values it contains to make full use of possible values. Unlike histogram equalization, contrast stretching is restricted to a linear mapping of input to output values. The result is less dramatic, but tends to avoid the sometimes artificial appearance of equalized images.

The first step is to determine the limits over which image intensity values will be extended. These lower and upper limits will be called a and b, respectively (for standard 8-bit grayscale pictures, these limits are usually 0 and 255). Next, the histogram of the original image is examined to determine the value limits (lower = c, upper = d) in the unmodified picture. If the original range covers the full possible set of values, straightforward contrast stretching will achieve nothing, but even then sometimes most of the image data is contained within a restricted range; this restricted range can be stretched linearly, with original values which lie outside the range being set to the appropriate limit of the extended output range. Then for each pixel, the original value r is mapped to output value s using the function:

             (linear mapping so get equation of a straight line)

One problem with this method is that outliers can reduce the effectiveness of the operation. This was already mentioned above when it was suggested that sometimes a restricted range of the input values as determined by inspecting the histogram of the original image might by used. Frequently it is advantageous to select c and d to be at the 5th and 95th percentiles, respectively, of the input values. Alternatively, one can start at the histogram peak and move up and down the value list until only a small (e.g., 1% to 3%) number of values are rejected and left outside the chosen limits for c and d.

 

Procedure:

1.) Perform contrast stretching on the following image of a woman's face:

woman's face

Record the values of a, b, c, d used for the operation. Now perform histogram equalization on the original image. Compare the original picture and its histogram with the stretched picture and its histogram as well as with the equalized picture and its histogram. A few pithy remarks should be made here.

Now try the stretching operation again, but this time stretch a restricted range of input values, e.g., clip off 3% of the pixel values from each side of the histogram peak. What if you clip off 12% ? Looking at the original histogram, would it be desirable to only clip values from one end?

2.) Now repeat with an image of the moon's surface:

moon's surface

 

Last modified on January 31, 2001