Expanding Image Contrast
While making adjustments to brightness and contrast is often the first thing users try to do to digitized images, that is a poor strategy. Problems of color adjustment, nonuniform illumination, and noise should be corrected first as shown above. That will make those procedures more consistent and will also allow for a greater range of contrast adjustment afterwards.
The image histogram is a vitally important tool for understanding and adjusting image contrast. As shown in the Histogram Displays interactive tutorial, this is a plot of the number of pixels (or the fraction of the image area) as a function of the brightness level. For color images, the average of red, green and blue, or the weighted luminance that corresponds to human visual response (approximately 25 percent * red + 60 percent * blue + 10 percent * red), or any of the various color space axes shown above, may be used. The cumulative histogram, which can also be selected in the example, shows the integral of the histogram and is used for some of the adjustments shown below.
Another useful tool, particularly when used in conjunction with the histogram, is the transfer function. This is a plot showing the original pixel values on the horizontal axis and the new value after adjustment on the vertical axis. In the Image Contrast Adjustment interactive tutorial, adjusting the gain (contrast) and brightness (level) changes the slope and position of the transfer function, and shifts the values in the image and histogram.
Setting the contrast and brightness to get maximum contrast without significant clipping of values to white or black is difficult. It is generally better to use the image histogram to set limits that maximize the image contrast. If this is done on individual color channels, it can produce unwanted color shifts in the image. Instead, the image should be converted to a different color space such as HSI or LAB where the brightness can be adjusted without altering colors, and then the result converted back for correct display.
Clipping of more than a tiny fraction of the pixels to black and or white should be avoided since those pixels lose any information they may have had in the original image. It is better to acquire an image with slightly less than full contrast rather than one in which significant areas exceed the dynamic range of the camera and are clipped to black or white. The Levels Adjustment interactive tutorial shows the effect of stretching the contrast to limits based on allowing a small fraction of the pixels to be clipped.
Nonlinear functions selectively expand contrast in one part of the brightness range by contracting contrast elsewhere. This can also be used to compensate for the characteristics of the acquisition device, which may be linear, logarithmic, or have some other response. These adjustments are best understood in terms of the transfer function. In the Image Contrast Adjustment interactive tutorial, the slider changes the shape of the transfer function without shifting the midpoint or end points. Applying such changes to the individual RGB channels can produce color shifts, and so operating on the intensity only while leaving color alone is the preferred method.
The cumulative histogram, illustrated above, varies from 0 to 100 percent. If the cumulative histogram is used as the transfer function it produces an image that has brightness values spread out to cover the entire range available. As shown in the Histogram Equalization interactive tutorial, the new cumulative histogram becomes a straight line, and peaks in the histogram are spread out so that small differences become visible. Comparison of images acquired with varying conditions, including changing specimen density, may be facilitated.
Human vision detects detail and differences based on a local percentage difference (a minimum of a few percent under most conditions). A difference between brightness values of 20 and 40 is 100 percent, but between 220 and 240 is less than 10 percent. Consequently, it is more difficult to see detail in the bright areas of images than in the dark areas. Photographers have long known that some details are easier to see in negatives. Reversing the contrast in a digital image is accomplished by subtracting the pixel value from 255 (white), as shown in the Complement Image interactive tutorial. This is usually done for the red, green and blue values individually, but in some cases it is more useful to reverse the intensity and leave the colors unchanged. Many programs call this operation “inverse” but of course it is not the arithmetic inverse (= 1/value).
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