0% found this document useful (0 votes)
213 views

Module - 4 Lecture Notes - 2: Remote Sensing-Digital Image Processing-Image Enhancement Contrast Stretching

Linear contrast stretching expands the range of gray levels in an image uniformly to increase contrast. Non-linear contrast stretching assigns display levels proportionally based on pixel frequency using methods like histogram equalization, piecewise linear stretching, and logarithmic/power law transformations. These emphasize areas of interest by expanding lower or higher brightness values as needed. Contrast stretching techniques enhance information visibility and feature detection in images.

Uploaded by

Pranjal Mhatre
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
213 views

Module - 4 Lecture Notes - 2: Remote Sensing-Digital Image Processing-Image Enhancement Contrast Stretching

Linear contrast stretching expands the range of gray levels in an image uniformly to increase contrast. Non-linear contrast stretching assigns display levels proportionally based on pixel frequency using methods like histogram equalization, piecewise linear stretching, and logarithmic/power law transformations. These emphasize areas of interest by expanding lower or higher brightness values as needed. Contrast stretching techniques enhance information visibility and feature detection in images.

Uploaded by

Pranjal Mhatre
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Remote Sensing-Digital Image Processing-Image Enhancement Contrast stretching

MODULE – 4 LECTURE NOTES – 2

CONTRAST STRETCHING

1. Introduction

Image enhancement is used to enhance the information available from an image for any
specific purpose. The enhancement may be done either in the spatial domain or in the
frequency domain. The frequency domain enhancement is based on the modification of the
Fourier transformation of the original image. On the other hand, spatial domain enhancement
involves manipulation of the pixels in an image from the image plane itself.

This lecture explains the basics of image enhancement in the spatial domain.

2. Contrast stretching

Contrast stretching is used to increase the dynamic range of the gray levels in the image. For
example, in an 8-bit system the image display can show a maximum of 256 gray levels. If the
number of gray levels in the recorded image spread over a lesser range, the images can be
enhanced by expanding the number of gray levels to a wider range. This process is called
contrast stretching. The resulting image displays enhanced contrast between the features of
interests.

For example, Fig. 1(a) shows the unstretched Landsat TM Band-5 image. The original image
is vague. Fig. 1 (b) shows the contrast-stretched image.

D Nagesh Kumar, IISc, Bangalore 1 M4L2


Remote Sensing-Digital Image Processing-Image Enhancement Contrast stretching

Fig. 1 Landsat TM Band-5 image before and after the contrast stretching

The transformation functions used to convert the values of the original image into
corresponding values in the output image may be linear or non-linear functions.

3. Linear Contrast Stretching

When the values in the original image are expanded uniformly to fill the total range of the
output device, the transformation is called linear contrast stretching. If DN is the Digital
Number of the pixel, DNst is the corresponding DN in the enhanced output image, DNmax and
DNmin are the maximum and minimum DN values in the original image, the linear contrast
stretching can be graphically represented as shown below.

Fig. 2. Graphical representation of the linear contrast stretching function

D Nagesh Kumar, IISc, Bangalore 2 M4L2


Remote Sensing-Digital Image Processing-Image Enhancement Contrast stretching

For example, for an 8-bit display system, linear contrast stretching transformation can be
achieved as given below.

(1)

where DN values in the range DNmin-DNmax are rescaled to the range 0-255 in the output
image.

Fig. 3(a) shows histogram of the Landsat TM band-5 image, wherein the DN values range
from 60 to 158. Therefore in the display of the original image, display in the ranges 0-59 and
159-255 are not utilized, giving a low contrast image as shown in Fig. 1(a). Histogram of the
enhanced image is shown in Fig. 3(b), wherein the values are expanded to fill the entire range
0-255, giving better contrast. The enhanced output image is shown in Fig. 1(b).

Fig. 3 Histograms of the Landsat TM Band-5 image before and after contrast stretching

In the contrast stretched image the light tone areas appear lighter and the dark tone areas
appear darker. The variation in the input data, now being displayed in a wider range, thus
becomes easily differentiable.

From the histogram of the original image it can be observed that though the DN values ranges
from 60 to 158, number of pixels having DN values in the range 60-90 are very less.
Nevertheless, in linear stretching equal number of display levels are assigned to these ranges.
Consequently, for the higher values not many display levels are available. In other words, the
number of display levels available for different DN ranges are not in proportion to the
number of pixels having DN values in the range. To solve this problem, non-linear contrast
stretching has been used.

D Nagesh Kumar, IISc, Bangalore 3 M4L2


Remote Sensing-Digital Image Processing-Image Enhancement Contrast stretching

4. Non-linear Contrast Stretching

In non-linear stretching, the DN values are not stretched linearly to uniformly occupy the
entire display range. Different non-linear contrast stretching methods are available. Some of
them are the following.

 Histogram-equalized stretch

 Piece-wise linear stretch

 Logarithmic, power law or Gaussian stretch

Histogram–equalized stretch

In histogram-equalized stretch the DN values are enhanced based on their frequency in the
original image. Thus, DN values corresponding to the peaks of the histogram are assigned to
a wider range. Fig.4 compares the histogram of a raw image with that of the images enhanced
using linear stretching and histogram-equalized stretching.

Fig. 4. Histograms of (a) Unstretched image (b) Linear contrast stretched image

(c) Histogram equalised image

D Nagesh Kumar, IISc, Bangalore 4 M4L2


Remote Sensing-Digital Image Processing-Image Enhancement Contrast stretching

Fig.5 (a) shows a sample histogram of an image and Fig.5 (b) shows the corresponding
histogram-equalization stretch function. Input DN values corresponding to the peak of the
histogram are stretched to a wider range as shown in the figure.

Fig.5 (a) Sample histogram of an image and (b) Function used for histogram equalized stretch

For example, for an 8-bit display system, the histogram equalization function used for
stretching the input image can be represented as follows.

k nj
DN st  255  (2)
j 0 N

where nj is the number of pixels having DN values in the jth range, k is the number of DN
value ranges, and N is the total number of pixels in the input image.

By assigning more display levels to the higher frequency region that contains majority of the
information, better information enhancement is possible using histogram-equalized stretch.

D Nagesh Kumar, IISc, Bangalore 5 M4L2


Remote Sensing-Digital Image Processing-Image Enhancement Contrast stretching

(a)

(b)

Fig. 6 Landsat ETM+ Band 5 images and the corresponding histograms (a) before contrast
stretch and (b) after histogram equalization stretch

Piece-wise Linear Stretch

In piece-wise linear stretch, different linear functions are used for enhancing the DN values in
different ranges within the same image. In other words, different parts of the histogram are
stretched by different amounts. It is generally useful in cases where the original image has bi-
modal histogram.

Fig.7 shows a sample bimodal function for piece-wise linear stretching.

D Nagesh Kumar, IISc, Bangalore 6 M4L2


Remote Sensing-Digital Image Processing-Image Enhancement Contrast stretching

Fig. 7. A sample bi-modal histogram, piece wise linear function used for the contrast
stretching and the histogram after piece wise contrast stretch

Using the piece-wise linear stretch function, region between the two modes of the histogram
may be compressed, whereas the regions corresponding to the histogram peaks may be
enhanced as shown in Fig.7. It is also used to enhance any special features in the image.

Logarithmic, power law or Gaussian stretch

In logarithmic stretching, curves having the shape of the logarithmic function are used for
rescaling the original DN levels into the wider output range, as shown in Fig. 8.

Fig. 8. A sample logarithmic stretch function

General form of logarithmic stretching uses the following form.

DNst = c log (1+DN) (3)

where c is a constant.

D Nagesh Kumar, IISc, Bangalore 7 M4L2


Remote Sensing-Digital Image Processing-Image Enhancement Contrast stretching

As shown in Fig. 8, in logarithmic stretching, smaller values are stretched to a wider range,
whereas narrower output range is used for higher values. This type of stretching is generally
used to enhance the information contained in the dark pixels, during which process the
information contained in the lighter pixels are compressed.

Application of power law executes the stretching in an opposite way. Power-law contrast
stretching generally uses the following form.

DNst = c DNn (4)

where c and n are positive constants.

Fig. 9 shows the sample power function for contrast stretching. While using the power
functions, higher values are expanded to a wider range. This enhances information contained
in the higher DN values, whereas the lower DN values are compressed.

Fig. 9. A sample function used for power law contrast stretching

D Nagesh Kumar, IISc, Bangalore 8 M4L2


Remote Sensing-Digital Image Processing-Image Enhancement Contrast stretching

In Gaussian contrast stretch, the DN values are modified in such a way that the stretched
brightness value distribution resembles a normal distribution. Fig. 10 shows the Landsat
ETM+ Band 5 image after applying the Gaussian contrast stretching. Original image is shown
in Fig. 6(a).

Fig.10. Landsat ETM+ Band 5 image after applying the Gaussian contrast stretching

Fig. 11 gives the schematic representation of all the above contrast stretching methods.
Histogram of the original image is shown in Fig. 11(a). The values are only in the range 60-
158. Therefore in an 8-bit display system, only the range 60-158 is used for the image display
resulting in poor contrast. Fig.11 (b) shows the linear stretching, wherein the range 60-158 is
equally transformed into the full range 0-255 using linear function. Fig.11 (c) shows the
schematic of the histogram equalization stretch. The range 60-108, having low frequency, is
transformed into a relatively narrower range 0-38, whereas the high frequency range 108-158
is transferred to a wider range 38-255. Fig.11 (d) shows special stretch wherein only the
range 60-92 is stretched to occupy the full display range. The remaining ranges are
compressed.

D Nagesh Kumar, IISc, Bangalore 9 M4L2


Remote Sensing-Digital Image Processing-Image Enhancement Contrast stretching

Fig. 11. Schematic representation showing various contrast stretching algorithms

(Courtesy: Lillesand et al., 2004)

5. Look-up Table

In contrast stretching, DN values in the original image are transformed into another range and
the resulting new DN values (DNst) represent the enhanced image. If the transformation has
to be estimated for every pixel of an image using the transformation functions, the procedure
would involve significantly large amount of computation. For example, a 60 x 60 km
multispectral SPOT image would require new DNs to be calculated for 27 million pixels.

D Nagesh Kumar, IISc, Bangalore 10 M4L2


Remote Sensing-Digital Image Processing-Image Enhancement Contrast stretching

Assuming 500,000 arithmetic operations a second, this procedure would take nearly four
minutes.

On the other hand, since the transformation functions are well defined, it is possible to
calculate DNst for all possible DN values in a single stretch, and can be presented in a tabular
form, as shown in Fig. 12. Such a table is called look-up table (LUT).

Fig. 12 (a) shows a sample linear transformation function used for contrast stretching. Fig. 12
(b) shows the LUT for this function.

Fig. 12 (a) A sample linear transformation function used for contrast stretching (b) LUT for
this function

LUT can be used to simplify the contrast stretching process. For any pixel in the original
image, the corresponding DNst may be obtained from the LUT, and thus the contrast
stretching procedure can be speeded up.

D Nagesh Kumar, IISc, Bangalore 11 M4L2

You might also like