Back to Index 

Contrast Menu


Fig. 6-1

The Contrast menu provides a wide variety of commands for image contrast manipulation. A Contrast stretch is a point operation (i.e., the value of a pixel in the stretched image is a function only of the corresponding pixel in the original image) designed to enhance the image for visual interpretation. The image histogram is often a good indicator for deciding the type of contrast stretch to apply.

With the exception of the Adaptive Stretch and Reference Stretch commands, all items on the Contrast menu are enabled for all types of images. The Adaptive Stretch command operates only on single-band images. The Reference Stretch command modifies the graylevels of one image dependent on those of a second image, and is therefore enabled only when there are at least two images available.


Normalize Stretch

The Normalize Stretch command performs a linear graylevel transformation on the input image. Parameters are the graylevel mean and variance in the output image, and the pixel and line increment used for sampling when the histogram of the input image is computed.

The graylevel of a pixel in the output image O is computed from the graylevel of the corresponding pixel in the input image I as

where the input image has graylevel mean and standard deviation . The mean value of the output image, , and its standard deviation are the parameters specified in the dialog.

The subsample increment parameter allows for a tradeoff between accuracy and speed. A smaller value uses more pixels to compute the histogram and is therefore slower; a larger value uses fewer pixels and is faster.

The Normalize Stretch command is useful for visually comparing images by adjusting them to have the same second order statistics.


Histogram Equalize Stretch

The Histogram Equalize Stretch command transforms the input image to an output image whose histogram density (pixels per graylevel) is approximately uniform. Parameters are the number of histogram bins, and the pixel and line increment used for sampling when the input image histogram is computed.

The graylevel of a pixel in the output image O is computed from the graylevel of the corresponding pixel in the input image I as

where,

.

CDF( ) represents the normalized cumulative distribution function (the normalized cumulative histogram) of the m-by-n-by-o input image I, and b is the number of histogram bins, as specified in the dialog. As with the Normalize Stretch command, the subsample increment allows you a tradeoff between accuracy and speed.

For an image with an approximately gaussian histogram, the Histogram Equalize Stretch command tends to reduce image contrast in very light and very dark areas, and to increase contrast in the middle graylevel range.


Linear Stretch

The Linear Stretch command performs a linear graylevel transformation on the input image. The parameters of the stretch may be specified as the output image’s minimum and maximum graylevel values (top check button), or as the two parameters of a linear coordinate transformation, bias and gain (bottom check button). The radio buttons are used to switch between these two equivalent representations. The default parameters are a minimum graylevel of 0 and a maximum graylevel of 255 (resulting in a transformation which makes the image suitable to be stored on disk in 8 bits/pixel format).

The graylevel of a pixel in the output image O is computed from the graylevel of the corresponding pixel in the input image I as

 

 

where and are the minimum and maximum graylevels of the input image, and are the minimum and maximum graylevels of the output image, and b and g are the graylevel bias and gain, respectively, as specified in the dialog.

If you switch from Min/Max representation to Bias/Gain representation or vice versa, the current parameter settings are transformed accordingly.

The Linear Stretch command is used to scale image graylevels to some specific range without altering the relative relationship between pixels. The Linear Stretch command may also be used to create the negative of an image — either by setting the new minimum graylevel to the old maximum and vice versa, or by setting the bias to the old maximum, and the gain to –1.


Logarithmic Stretch

The Logarithmic Stretch command logarithmically stretches the graylevels of the input image.

The graylevel of a pixel in the output image O is computed from the graylevel of the corresponding pixel in the input image I as

where the function ( ) computes the (base 10) logarithm of its argument.

Since the logarithm of a negative number is undefined, negative graylevels are not transformed, but simply retained. Note that one is added to the original graylevels to allow the transformation of images with graylevel values of zero. The Logarithmic Stretch command is useful for transforming an image with a wide histogram (a very large dynamic graylevel range) skewed towards lower graylevels.


Piecewise Linear Stretch

The Piecewise Linear Stretch command stretches image graylevels via a three-segment, piecewise linear transformation. The default graylevel breakpoints in the input image, , , are computed from the image’s graylevel minimum and maximum, and , as .

The graylevel of a pixel in the output image O is computed from the graylevel of the corresponding pixel in the input image I as

where and .

The Piecewise Linear Stretch command is useful for images with asymmetric histograms. It allows for different stretches to be applied to different portions of the histogram.


Square Root Stretch

The Square Root Stretch command performs a square root graylevel transformation.

The graylevel of a pixel in the output image O is computed from the graylevel of the corresponding pixel in the input image I as

Since the square root of a negative number is undefined, negative graylevels are not transformed, but simply retained. Like the Logarithmic Stretch command, the Square Root Stretch command is useful for reducing the graylevel range of images with a large dynamic range and a histogram skewed towards lower graylevels.


Square Stretch

The Square Stretch command performs a square graylevel transformation.

The graylevel of a pixel in the output image O is computed from the graylevel of the corresponding pixel in the input image I as

The Square Stretch command is useful for enlarging the graylevel range of images with a small dynamic range and with a histogram skewed to higher graylevels.


Table Lookup Stretch

The Table Lookup Stretch command performs a graylevel mapping based on a lookup table. The default lookup table for an image is the identity transformation for images with integer graylevel values. To change a lookup table entry, simply select the entry from the scrolling list and modify the value displayed in the edit field at the right.

The graylevel of a pixel in the output image O is computed from the graylevel of the corresponding pixel in the input image I as

The Table Lookup Stretch command is particularly useful for making specific changes to just a few graylevels in an image, or for relabeling the classes in a classification map. Note that the graylevels are converted to integers before use as indices to the lookup table; the Table Lookup Stretch command is therefore not very well suited for images with non-integer graylevel values.


Requantize Graylevels

The Requantize Graylevels command requantizes the input image’s graylevels. Parameters are the graylevel values in the input image corresponding to the minimum and maximum graylevels in the output image, and the number of quantization steps in the output image. The minimum and maximum graylevel values default to the input image’s graylevel minimum and maximum, respectively. Pixels in the input image with graylevel values outside that range are saturated at the range boundaries.

The graylevel of a pixel in the output image O is computed from the graylevel of the corresponding pixel in the input image I as

where the function trunc( ) truncates the fractional part of a real number, n is the number of quantization steps, and and are the minimum and maximum graylevel values. as specified in the dialog.

Note that and need not necessarily be identical to the true image graylevel minimum and maximum.


Saturate Graylevels

The Saturate Graylevels command retains all pixels with graylevel values in a specified range, and saturates all other graylevels at the appropriate range boundary. Parameters are the minimum and maximum graylevel of the range to be retained. They default to the image minimum and maximum (resulting in an identity transformation of the image).

The graylevel of a pixel in the output image O is computed from the graylevel of the corresponding pixel in the input image I as

where and are the minimum and maximum graylevel values to be retained, as specified in the dialog.

The Saturate Graylevels command is useful for discarding (by saturation) extreme graylevel values before further processing, or, in conjunction with tclSADIE’s automatic display stretch, for visually stretching the contrast in a displayed image.


Threshold Graylevels

The Threshold Graylevels command converts the input image to a binary image by replacing all graylevel values below some threshold with the minimum graylevel of the input image, , and all other graylevel values with the maximum graylevel, . The default for the threshold parameter is computed from the minimum and maximum graylevel values as

.

The graylevel of a pixel in the output image O is computed from the graylevel of the corresponding pixel in the input image I as

where t is the threshold graylevel specified in the dialog.

The Threshold Graylevels command is useful for simple segmentation and classification tasks.


Adaptive Stretch

The Adaptive Stretch command performs a spatially variable graylevel transformation, where a different linear stretch function is computed for each pixel. The input image (which must be single-band) is partitioned into blocks, and the transformation parameters are calculated for each pixel as a linear interpolation of the stretch parameters for adjoining blocks. The default block size for an m-by-n-by-o image is computed as .

The graylevel of a pixel in the output image O is computed from the graylevel of the corresponding pixel in the input image I as

where both the bias b and the gain g depend on the input pixel.

For a detailed discussion, including an exact description of the algorithm used for computing the stretch parameters, see J. D. Fahnestock and R. A. Schowengerdt, "Spatially Variant Contrast Enhancement using Local Range Modification," Optical Engineering, Vol. 22, No. 3 (May/June 1983), pp. 378–381.

The Adaptive Stretch command is particularly well suited for enhancing the detail in local areas of a scene with widely different mean graylevels or contrasts. Note, however, that the Adaptive Stretch command completely alters the radiometric relationship between pixels, and that the transformation is therefore useful only for visual image enhancement.


Reference Stretch

The Reference Stretch command transforms the graylevels of one image to match, in a least-squares sense, those of another image. This transformation is done via a lookup table. Parameters are the image to be transformed, the reference image, and the number of entries in the lookup table. The two images, which must have the same number of bands, lines/band, and pixels/line, are selected from all images currently open.

The graylevel of a pixel in the output image O is computed from the graylevel of the corresponding pixel in the input image I as

where LUT( ) is a lookup table, and n is the number of lookup table entries specified in the dialog. The least squares algorithm for computing the lookup table is described in W. J. Dallas and W. Mauser, "Preparing Pictures for Visual Comparison," Applied Optics, Vol. 19, No. 21 (November 1980), pp. 3586–3587. The Cumulative Distribution algorithm for computing the lookup table is described in R.A. Schowengerdt, Remote Sensing: Models and Methods for Image Processing, Academic Press, San Diego, CA, 1997. The resulting lookup table is then applied to the transformation image.

The reference stretch is used mainly for visual comparison of images that are initially somewhat similar. The Reference Stretch command can produce undesirable results if the two images are dissimilar or uncorrelated.


Last Updated: August 2000
University of Arizona
Electrical and Computer Engineering Department
Digital Image Analysis Laboratory © 1999,2000