Image Processing : Extracting and Analyzing Shapes |
Morphological image processing operations reveal the underlying structures and shapes within binary and grayscale images, clarifying basic image features. While individual morphological operations perform simple functions, they can be combined to extract specific information from an image. Morphological operations often precede more advanced pattern recognition and image analysis operations such as segmentation. Shape recognition routines commonly include image thresholding or stretching to separate foreground and background image features. See Determining Intensity Values for Threshold and Stretch for tips on how to produce the desired results.
This chapter also provides examples of more advanced image analysis routines that return information about specific image elements. One example identifies unique regions within an image and the other finds the area of a specific image feature. See Analyzing Image Shapes for more information.
Note In this book, Direct Graphics examples are provided by default. Object Graphics examples are provided in cases where significantly different methods are required. |
Morphological operations apply a structuring element or morphological mask to an image. A structuring element that is applied to an image must be 2 dimensional, having the same number of dimensions as the array to which it is applied. A morphological operation passes the structuring element, of an empirically determined size and shape, over an image. The operation compares the structuring element to the underlying image and generates an output pixel based upon the function of the morphological operation. The size and shape of the structuring element determines what is extracted or deleted from an image. In general, smaller structuring elements preserve finer details within an image than larger elements. For more information on selecting and creating a structuring element, see Determining Structuring Element Shapes and Sizes.
Morphological operations can be applied to either binary or grayscale images. When applied to a binary image, the operation returns pixels that are either black, having a logical value of 0, or white, having a logical value of 1. Each image pixel and its neighboring pixels are compared against the structuring element to determine the pixel's value in the output image. With grayscale images, pixel values are determined by taking a neighborhood minimum or neighborhood maximum value (as required by the morphological process). The structuring element provides the definition of the shape of the neighborhood.
The following table introduces image processing tasks and associated IDL image processing routines covered in this chapter.
Note For an example that uses a combination of morphological operations to remove bridges from the waterways of New York, see Combining Morphological Operations. |
IDL Online Help (March 06, 2007)