Overview of Contrasting and Filtering
Contrast within an image is based on the brightness or darkness of a pixel in relation to other pixels. Modifying the contrast among neighboring pixels can enhance the ability to extract information from the image. Operations such as noise removal and smoothing decrease contrast and make neighboring pixel values more similar. Other operations such as scaling pixel values, edge detection and sharpening increase contrast to highlight specific image features.
A simple way to modify contrast is to scale the pixel values within an image. Within IDL, the pixel values of displayed images typically range from 0 to 255. Byte-scaling changes the range of values within an image to a linear progression from a minimum of 0 to a maximum of 255. For images with pixel values exceeding 255, byte-scaling produces a more linear display with the minimum value as the darkest pixel and the maximum value as the brightest pixel. For images with a smaller range in pixel values, byte-scaling increases the contrast and brightens dark areas. See Byte-Scaling for more information on byte-scaling.
Contrast can also be increased to show more variations within uniform areas of the image using histogram equalization operations. These operations modify the distribution of pixel values within an image. See Working with Histograms for more information on using histograms to modify contrast.
Filters provide another means of changing contrast within an image. A filter is represented by a kernel, which is an array that is multiplied and added to each pixel (and its surrounding values) within an image. Examples of such filters include low pass, high pass, directional, and Laplacian filters. See Filtering an Image for more information on these filters. The following list introduces some of the specific operations covered in this section:
- Low pass filtering - a low pass filter provides the basis for smoothing operations. If an image contains too many variations to be able to determine specific features, smoothing can decrease the contrast so that some areas (especially the background) will not distract from viewing other areas of the image. See Smoothing an Image for more information on smoothing.
- High pass filtering - a high pass filter provides the basis for sharpening operations. Some variations within areas of an image are too slight, causing some features to be indistinguishable from other features (usually the background). Sharpening increases the contrast in these areas, allowing these features to be clearly displayed. See Sharpening an Image for more information on sharpening.
- Directional and Laplacian filters - these filters are the basis for edge detection operations. Shapes within an image are distinguished by their edges, which typically involve a sharp gradient. Edge detection increases the contrast between the boundary of the shape and the adjoining areas. See Detecting Edges for more information on edge detection.
- Windowing and adaptive filters - more advanced filters are used to remove noise from an image. The variation in values between the noise and the image data is typically extreme, which detracts from the image clarity. Decreasing the contrast reduces the visible noise and allows the image to be properly viewed. See Removing Noise for more information on removing noise within an image.
Note
In this book, Direct Graphics examples are provided by default. Object Graphics examples are provided in cases where significantly different methods are required.
The following list introduces the image contrasting and filtering tasks and associated IDL image routines covered in this chapter.
Note
This chapter uses data files from the IDL examples/data directory. Two files, data.txt and index.txt, contain descriptions of the files, including array sizes.