Previous Image Processing : Extracting and Analyzing Shapes Next

Overview of Extracting and Analyzing Image 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.

Applying a Morphological Structuring Element to an Image

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.

Table 9-1: Shape Extraction and Analysis Tasks and Routines 

Table 9-1: Shape Extraction and Analysis Tasks and Routines 
Task
Routine(s)
Description
Reduce the size of objects in relation to their background.
Expand the size of objects in relation to their background.
Apply an erosion operation followed by a dilation operation to a binary or grayscale image.
Apply a dilation operation followed by an erosion operation to a binary or grayscale image.
Retain only the brightest pixels within a grayscale image.
Detect boundaries between similar regions in a grayscale image.
Use "hit" and "miss" structures to identify image elements that meet the specified conditions.
Subtract an eroded version of a grayscale image from a dilated version of the image, highlighting edges.
Estimate for each binary foreground pixel the distance to the nearest background pixel, using a given norm.
Subtract hit-or-miss results from a binary image. Repeated thinning results in pixel-wide linear representations of image objects.
Identify and assign index numbers to discrete regions within a binary image.
Create a contour plot and extract information about specific contours.


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)