|Image Processing Toolbox|
IM2 = imdilate(IM,SE) dilates the grayscale, binary, or packed binary image
IM, returning the dilated image,
IM2. The argument
SE is a structuring element object, or array of structuring element objects, returned by the
IM is logical and the structuring element is flat,
imdilate performs binary dilation; otherwise, it performs grayscale dilation. If
SE is an array of structuring element objects,
imdilate performs multiple dilations of the input image, using each structuring element in
SE in succession.
IM2 = imdilate(IM,NHOOD) dilates the image
NHOOD is a matrix of 0's and 1's that specifies the structuring element neighborhood. This is equivalent to the syntax
imdilate function determines the center element of the neighborhood by
IM2 = imdilate(IM,SE,PACKOPT) or
imdilate(IM,NHOOD,PACKOPT) specifies whether
IM is a packed binary image.
PACKOPT can have either of the following values.
IM2 = imdilate(...,PADOPT) specifies the size of the output image.
PADOPT can have either of the following values.
||Make the output image the same size as the input image. This is the default value. If the value of
PADOPT is analogous to the optional
SHAPE argument to the
IM can be logical or numeric and must be real and nonsparse. It can have any dimension. If
IM is logical,
SE must be flat. The output has the same class as the input. If the input is packed binary, then the output is also packed binary.
This example dilates a binary image with a vertical line structuring element.
This example dilates a grayscale image with a rolling ball structuring element.
To determine the domain of the composition of two flat structuring elements, dilate the scalar value
1 with both structuring elements in sequence, using the
imdilate automatically takes advantage of the decomposition of a structuring element object (if it exists). Also, when performing binary dilation with a structuring element object that has a decomposition,
imdilate automatically uses binary image packing to speed up the dilation.
Dilation using bit packing is described in .
 Robert M. Haralick and Linda G. Shapiro, Computer and Robot Vision, vol. I, Addison-Wesley, 1992, pp. 158-205.
 van den Boomgaard and van Balen, "Image Transforms Using Bitmapped Binary Images," Computer Vision, Graphics, and Image Processing: Graphical Models and Image Processing, vol. 54, no. 3, May, 1992, pp. 254-258.