Microscopy Primer
Light and Color
Microscope Basics
Special Techniques
Digital Imaging
Confocal Microscopy
Live-Cell Imaging
Microscopy Museum
Virtual Microscopy
Web Resources
License Info
Image Use
Custom Photos
Site Info
Contact Us

The Galleries:

Photo Gallery
Silicon Zoo
Chip Shots
DNA Gallery
Amino Acids
Religion Collection
Cocktail Collection
Screen Savers
Win Wallpaper
Mac Wallpaper
Movie Gallery

Interactive Tutorials

Contrast Stretching and Histogram Normalization

Contrast modification in digital images is a point process that involves application (addition, subtraction, multiplication, or division) of an identical constant value to every pixel in the image. This tutorial explores how redistributing brightness values through application of contrast stretching and histogram normalization algorithms can rehabilitate digital images having poor contrast.

The tutorial initializes with a specimen lacking proper contrast being displayed in the Specimen Image window. Each specimen name includes, in parentheses, an abbreviation designating the contrast mechanism employed in obtaining the image. The following nomenclature is used: (FL), fluorescence; (BF), brightfield; (DF), darkfield; (PC), phase contrast; (DIC), differential interference contrast (Nomarski); (HMC), Hoffman modulation contrast; and (POL), polarized light. All of the images utilized in the tutorial have contrast deficiencies and will benefit from proper implementation of the contrast stretching and histogram normalization algorithms. 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 Intensity Histogram graphical representation of the specimen intensity profile, which plots the number of pixels versus the pixel intensity (or brightness) distribution from 0 (black) to 255 (white). The black histogram is that of the original specimen image, while the gray histogram represents the current tutorial settings for a contrast-enhanced specimen image. To adjust image contrast, use the mouse cursor to translate the Black Level and White Level sliders while observing results appearing in both the image and histogram windows. Alternatively, the blue arrow buttons can be activated with the mouse to incrementally move the sliders, either to the right or left.

Current black and white level values are indicated by red arrows in the histogram window. The Black Level slider determines the intensity level below which all pixels will be set to black. Moving this slider to the right shifts the black level red arrow to the right, and the intensity histogram of the specimen image stretches to the left as a result. The White Level slider determines the intensity level above which all pixels will be turned to white. Moving the White Level slider to the left shifts the right-hand red arrow to the left, and the intensity histogram of the specimen image stretches to the right. Together, these sliders can be utilized to restore contrast to digital images. As the sliders are shifted, the Transfer Function graph indicates changes in pixel input and output levels. Visitors can monitor their progress in rehabilitation of the digital images by clicking on the Show Original checkbox, which will toggle the Specimen Image to the original poor-contrast image. Digital images can be changed by selecting a new specimen from the Choose A Specimen pull-down menu. To select between grayscale and color specimen image sets, click on the appropriate (Grayscale Images or Color Images) radio button.

Histograms of digital images provide a graphical representation of image contrast characteristics and are useful in evaluating contrast deficiencies such as low or high contrast, or inadequate dynamic range. Manipulation of the histogram can correct poor contrast and brightness to dramatically improve the quality of digital images.

Histogram stretching involves modifying the brightness (intensity) values of pixels in the image according to some mapping function that specifies an output pixel brightness value for each input pixel brightness value. For a grayscale digital image, this process is straightforward. For an RGB color digital image, histogram manipulation can be accomplished by converting the image to a Hue, Saturation, Intensity (HSI) color space representation of the image and applying the brightness mapping operation to the intensity information alone. The following mapping function is utilized to compute pixel brightness values:

Output(x, y) = (Input(x, y) - B) / (W - B)

In the equation above, the intensity range is assumed to lie between 0.0 to 1.0, with 0.0 representing black and 1.0 representing white. The variable B represents the intensity value corresponding to the black level, while the intensity value corresponding to the white level is represented by the variable W. In some instances, it is desirable to apply a nonlinear mapping function (not addressed in this tutorial) to digital images in order to selectively modify portions of the image.

Contributing Authors

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, John C. Long, 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-2022 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
Graphics & Web Programming Team
in collaboration with Optical Microscopy at the
National High Magnetic Field Laboratory.
Last modification: Thursday, Feb 11, 2016 at 10:51 AM
Access Count Since February 1, 2002: 72849
Visit the websites of our partners in digital imaging education:
Visit the Olympus Microscopy Resource Center website. Visit the QImaging website.