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

Nonuniform Illumination

Adjusting a light microscope to have uniform illumination across the entire picture width can be difficult. Scanning electron microscopes often show shading that darkens portions of the image because of detector location and specimen tilt. Lighting a copy stand uniformly is particularly hard. And many optical systems cause vignetting because less light from the scene reaches the corners of the sensor. Add to those causes any variation in the sample (nonuniform thickness, a surface that isn’t perfectly flat, etc.) and the result is an image in which the same objects have different brightnesses depending on where they lie. Such variations make subsequent analysis very difficult and should be corrected.

There are three principal approaches to correcting shading in images. The first, and the best for those cases in which is it practical, is to capture two images, one of the specimen and another with the specimen removed or replaced by a uniform target so that the pattern of nonuniformity can be recorded directly. This “background” image can then be either subtracted from or divided into the image of the specimen to produce a leveled result. As shown in the Removing a Measured Background interactive tutorial, this method can be very successful with photographs on a copy stand, or for some types of specimens in a transmission light microscope.

Interactive Tutorial
Removing a Measured Background
Subtract a measured background from an image showing nonuniform illumination. 

The choice between subtracting the background and dividing by it depends on the sensor (and electronics) used to capture the image. Solid state sensors are inherently linear, and so a “raw” format image would be leveled by dividing by the background. But film, as well as vidicons and most other television cameras, respond logarithmically to light intensity. And many digital cameras process the raw intensity values internally to produce the more film-like and familiar logarithmic output. Division of the raw values is equivalent to subtraction of the logs, as shown in Equation 1. If you are using the raw output from your camera, or if you have a sensor mounted on an electron microscope, division is the proper procedure to use. Otherwise, subtraction is appropriate.


If it was not practical to remove the specimen, or if the variation is due to the sample itself, a suitable background image may not be obtainable. And, of course, in some cases the presence of nonuniform illumination may not be realized until long after the image has been acquired, so that there is no possibility to capture a background image. In these instances it is necessary to generate a suitable estimate of the background image. There are two ways this is commonly done. For some images, either method can be used, but many types of samples lend themselves to one technique or the other.

If the specimen consists of dispersed objects with regions of background well distributed throughout the image, the background brightness can be measured at a number of points and used to generate a background using a polynomial function. Usually either a second or third order polynomial will provide a good fit to the nonuniformity that results from optical vignetting or the fall-off in illumination due to condenser lens settings or copy stand lights. The Removing a Fitted Background interactive Java tutorial allows the user to select points from which to fit a background to be subtracted.

Interactive Java Tutorial
Removing a Fitted Background
Subtract a polynomial function fit to selected background points of an image. 

The polynomial fitting method has two important (and limiting) assumptions: first, that the background brightness does actually vary gradually, and second that there are enough background points available to properly characterize the function. If the only background points are around the periphery of the image, or all at one side, the function may not extrapolate well to the regions of interest where the objects lie. In the preceding example, observe the (poor) results of fitting if the selected fitting points are not well distributed on background throughout the image area. Of course, the other drawback to this approach is the need for human intervention to select the background points, so that automatic batch processing is impractical.

A simplified form of the polynomial adjustment technique that is particularly suited to correcting for vignetting adds brightness to the image in a radially symmetrical pattern, with an adjustable amount and a power that varies between the square and the cube of the radius, as shown in the Anti-Vignetting interactive tutorial.

Interactive Tutorial
Explore the use of a power-law function in removing vignetting from digital images. 

The other method used to generate a background image is to remove the features from the image, leaving just the background. Of course, you can’t simply “remove” something from an image, you have to first identify the pixels that correspond to the features, and then decide what to replace those values with. One approach that has been used occasionally is to apply a Gaussian blur to the image with a large standard deviation (see the Background Leveling interactive tutorial). That is actually a poor technique for several reasons - large Gaussian filters are inefficient to apply, they mix the pixel values from the features into those of the background, rather than removing them, and the background produced is forced to vary gradually and can’t handle abrupt changes.

Interactive Tutorial
Background Leveling
Compare two different methods for producing a uniform background. 

The preferred method uses the same neighborhood ranking procedure introduced in the preceding section. But rather than selecting the median value, either the brightest or darkest pixel in the neighborhood is kept. If the features are bright on a dark background, the procedure is to first replace each pixel with its darkest neighbor, and then in a second pass through the image to replace each pixel with its brightest neighbor. The individual operations are called erosion and dilation, and the combination is called an opening. If the features are dark and the background bright the order of the operations is reversed, a dilation followed by an erosion, and the combination is called a closing. Either a neighborhood with radius at least as large as half the width of the features must be used, or a smaller neighborhood used repeatedly until the features are removed, as shown in the Rank Leveled Background interactive tutorial.

Interactive Tutorial
Rank Leveled Background
Explore how to generate a background by erosion and dilation. 

The advantage of the rank-based leveling method is that the background can have a much more complex form than provided by the polynomial (for example, in the image of the immunogold particles in the Background Leveling interactive tutorial, the “background” is the density of the tissue, which varies in a complex way). Also this method does not rely on human selection of appropriate background points. However, it does require that the features be small enough in width to be removed by the ranking procedure.

Contributing Authors

John C. Russ - Materials Science and Engineering Dept., North Carolina State University, Raleigh, North Carolina, 27695.

Matthew Parry-Hill 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-2009 by Michael W. Davidson, John Russ, Olympus America Inc., 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: Tuesday, Sep 11, 2018 at 03:22 PM
Access Count Since July 20, 2006: 9098
For more information on microscope manufacturers,
use the buttons below to navigate to their websites: