Contrast Manipulation in Digital Images
The term contrast refers to the amount of color or grayscale differentiation that exists between various image features in both analog and digital images. Images having a higher contrast level generally display a greater degree of color or grayscale variation than those of lower contrast. This interactive tutorial explores the wide range of adjustment that is possible in digital image contrast manipulation, and how contrast variations affect the final appearance of the image.
The tutorial initializes with a randomly selected specimen (imaged in the microscope) appearing in the left-hand window entitled Specimen Image. Individual specimens are identified by the method of capture with an abbreviation appearing in parentheses after the specimen name. The following nomenclature is used to designate capture techniques: (FL), fluorescence; (BF), brightfield; (DF), darkfield; (PC), phase contrast; (DIC), differential interference contrast (Nomarski); (HMC), Hoffman modulation contrast; and (POL), polarized light. Visitors will note that specimens captured using the various techniques available in optical microscopy behave differently during image processing in the tutorial.
Adjacent to the Specimen Image window is a graph that displays the RGB/Intensity Histogram of the image from the microscope (black or colored bars), along with the intensity transfer function (black curve). Selecting the Red, Green, or Blue checkboxes will display the histogram for the corresponding color channel of the image in the RGB Histogram window. Three contrast adjustment mode controls are available in the tutorial, which correspond to specific contrast adjustment algorithms: Grayscale Contrast, RGB Contrast, and HSI Contrast. The contrast level of the specimen image is adjustable with the Contrast Level slider and/or a set of blue arrow buttons. To operate the tutorial, select an image from the Choose A Specimen pull-down menu, and vary the contrast level with the Contrast Level slider (or arrow buttons). Moving the slider to the left of the center position decreases image contrast, while moving the slider to the right increases image contrast. The slider can be translated either by dragging with the mouse cursor, or by clicking on the blue arrow buttons. The digital microscope image, histogram, and intensity transfer function graphs are continuously updated as the contrast level is varied with the slider. Visitors should note that the height of the histogram graph is scaled according to the number of pixels displayed at the top left of the vertical axis (labeled Pixel Count).
The contrast of a digital image is related to the RGB intensity (grayscale) values of the optical image and the accuracy of the digitizing device used to capture the optical image. The RGB intensity refers to the amount of red, green, and blue light energy actually reflected by, or transmitted through, the physical specimen at a given point. Although a number of factors play a role in specimen contrast, insufficient or non-uniform illumination and/or an incorrectly adjusted microscope can result in underexposure or blurring of specimen details, which is often a major cause of low contrast in digital images. The RGB intensity range utilized in construction of a digital image is known as the dynamic range of the image, and is a function of both the intensity range of the optical image and the accuracy of the camera used to capture the image. If the dynamic range of the digital image is severely limited by the camera's digitizer, then too few intensity levels will be available in each color channel to represent the subtle differences of intensity that may occur in the optical image. As a result, image contrast will suffer.
Deficiencies in digital image contrast can often be corrected by utilizing an intensity transformation operation, which is an algorithm designed to transform each input brightness value to a corresponding output brightness value via a transfer function. The purpose of the transfer function is simply to define a set of rules for assigning input pixel brightness values to output pixel brightness values. For images having low contrast, an intensity transformation can be employed to broaden the range of brightness values present in each color channel of the image, resulting in an overall increase in image contrast. However, in order for a contrast manipulation algorithm to perform properly, there must be sufficient variance in the pixel brightness values between pixel ensembles in the low-contrast image.
A chief advantage of the intensity transformation is that it affects only the color, but not the position, of a pixel. Also, unlike neighborhood operations, which determine an output pixel intensity color value as a function of the color values from a group of pixels in a neighborhood surrounding the input pixel, an intensity transformation determines the output pixel intensity color value as a function of the input pixel color value alone. For this reason, the algorithm is computationally very simple, and utilizing look-up tables (LUTs) for the intensity transfer function values further reduces processing time.
In the tutorial, two basic contrast modification algorithms are available: RGB contrast and HSI contrast. When RGB Contrast is selected, image contrast is increased or decreased by modifying the red, green, and blue channels of the image through the use of a look-up table. When Grayscale Contrast or HSI Contrast options are selected, image contrast is increased or decreased by transforming the RGB image to the HSI (Hue, Saturation, Intensity) color model and applying an intensity transfer function to the intensity information of the image alone. The HSI algorithm has the advantage of avoiding color shifts that can occur with the use of the RGB algorithm.
In the tutorial, the transfer function is a mathematical function whose graph is displayed as a black line or curve in the RGB Histogram window. When the Contrast Level slider is moved to the center position (default value), the intensity transfer function is simply an identity function (having a graph displayed as a straight line) that maps each input pixel intensity value to an identical output intensity value in each of the three color channels. The result is that each pixel's color or intensity value remains the same and no change in contrast occurs. As the slider is moved to the left of center position, the intensity transfer function compresses intensity values toward the center of the graph, resulting in a decrease of image contrast as differences between pixel brightness values are reduced or eliminated in each color channel of the image. When RGB Contrast is selected, this effect can also be seen in the red, green, and blue histograms of the image, which are compressed toward the center of the graph. Histogram compression corresponds to a reduction in the dynamic range of the resulting image in each color channel because fewer intensity levels are utilized per channel in the image display.
As the Contrast Level slider is moved to the right of the center position, the intensity transfer function increases the brightness variation among the mid-range intensity levels of each color channel of the image, while simultaneously decreasing the brightness variation among the low- and high-range intensity levels. The result is a general overall increase in image contrast, since the majority of brightness values in each color channel of an image will tend to occupy the mid-range of intensity levels of the histogram. This effect can be observed in red, green, and blue histograms of the processed image, which are gradually stretched to the boundaries. Histogram stretching corresponds to an increase in the dynamic range of each color channel of the image as more intensity levels become utilized in each channel of the displayed image. When the slider is moved to the extreme right of the center position, each histogram separates near the mid-range of the intensity levels, with all brightness values in each channel of the image being collected into the extremes (lowest and highest intensity values). The resulting effect is similar to posterization, where the number of colors in an image is reduced to the extent that the image takes on an artificial appearance.
Kenneth R. Spring - Scientific Consultant, Lusby, Maryland, 20657.
John C. Russ - Materials Science and Engineering Department, North Carolina State University, Raleigh, North Carolina, 27695.
Matthew J. Parry-Hill, Thomas J. Fellers, and Michael W. Davidson - National High Magnetic Field Laboratory, 1800 East Paul Dirac Dr., The Florida State University, Tallahassee, Florida, 32310.
Questions or comments? Send us an email.
© 1998-2019 by Michael W. Davidson and The Florida State University. All Rights Reserved. No images, graphics, scripts, or applets may be reproduced or used in any manner without permission from the copyright holders. Use of this website means you agree to all of the Legal Terms and Conditions set forth by the owners.
This website is maintained by our