The DILATE function implements the morphologic dilation operator on both binary and grayscale images.
Mathematical morphology is a method of processing digital images on the basis of shape. A discussion of this topic is beyond the scope of this manual. A suggested reference is: Haralick, Sternberg, and Zhuang, "Image Analysis Using Mathematical Morphology," IEEE Transactions on Pattern Analysis and Machine Intelligence , Vol. PAMI-9, No. 4, July, 1987, pp. 532-550. Much of this discussion is taken from that article.
Briefly, the DILATE function returns the dilation of Image by the structuring element Structure . This operator is commonly known as "fill", "expand", or "grow." It can be used to fill "holes" of a size equal to or smaller than the structuring element.
Used with binary images, where each pixel is either 1 or 0, dilation is similar to convolution. Over each pixel of the image, the origin of the structuring element is overlaid. If the image pixel is nonzero, each pixel of the structuring element is added to the result using the "or" operator.
Letting A B represent the dilation of an image A by structuring element B , dilation can be defined as:
where (A) b represents the translation of A by b . Intuitively, for each nonzero element b i,j of B , A is translated by i,j and summed into C using the "or" operator. For example:
In this example, the origin of the structuring element is at (0,0).
Used with grayscale images, which are always converted to byte type, the DILATE function is accomplished by taking the maximum of a set of sums. It can be used to conveniently implement the neighborhood maximum operator with the shape of the neighborhood given by the structuring element.
The opening of image B by structuring element K is defined as ( B K ) K . The closing of image B by K is defined as ( B K ) K where the "o times" symbol represents the erosion operator implemented by the IDL ERODE function.
As stated by Haralick et al , the result of iteratively applied dilations and erosions is an elimination of specific image detail smaller than the structuring element without the global geometric distortion of unsuppressed features. For example, opening an image with a disk structuring element smooths the contour, breaks narrow isthmuses, and eliminates small islands and sharp peaks or capes.
A one-, two-, or three-dimensional array upon which the dilation is to be performed. If the parameter is not of byte type, a temporary byte copy is obtained. If neither of the keywords GRAY or VALUES is present, the image is treated as a binary image with all nonzero pixels considered as 1.
A one-, two-, or three-dimensional array that represents the structuring element. Elements are interpreted as binary: values are either zero or nonzero. This argument must have the same number of dimensions as Image .
Optional parameters specifying the one-, two-, or three-dimensional coordinate of the structuring element's origin. If omitted, the origin is set to the center, ([ N x /2], [ N y /2], [ N z /2]), where N x , N y , and N z are the dimensions of the structuring element array. The origin need not be within the structuring element.
Set this keyword to perform grayscale, rather than binary, dilation. The nonzero elements of the Structure parameter determine the shape of the structuring element (neighborhood). If VALUES is not present, all elements of the structuring element are 0, yielding the neighborhood maximum operator.
The following example thresholds a gray scale image at the value of 100, producing a binary image. The result is then "opened" with a 3 pixel by 3 pixel square shape operator, using the DILATE and ERODE operators. The effect is to remove holes, islands, and peninsula smaller than the shape operator: