Image Processing Toolbox    
imdilate

Dilate image

Syntax

Description

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 strel function.

If 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 IM, where NHOOD is a matrix of 0's and 1's that specifies the structuring element neighborhood. This is equivalent to the syntax imdilate(IM,strel(NHOOD)). The imdilate function determines the center element of the neighborhood by floor((size(NHOOD)+1)/2).

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.

'ispacked'
IM is treated as a packed binary image as produced by bwpack. IM must be a 2-D uint32 array and SE must be a flat 2-D structuring element. If the value of PACKOPT is 'ispacked', PADOPT must be 'same'.
'notpacked'
IM is treated as a normal array. This is the default value.

IM2 = imdilate(...,PADOPT) specifies the size of the output image. PADOPT can have either of the following values.

'same'
Make the output image the same size as the input image. This is the default value. If the value of PACKOPT is 'ispacked', PADOPT must be 'same'.
'full'
Compute the full dilation.

PADOPT is analogous to the optional SHAPE argument to the conv2 and filter2 functions.

Class Support

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.

Examples

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 'full' option.

Algorithm

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 [2].

See Also

bwpack, bwunpack, conv2, filter2, imclose, imerode, imopen, strel

References

[1]  Robert M. Haralick and Linda G. Shapiro, Computer and Robot Vision, vol. I, Addison-Wesley, 1992, pp. 158-205.

[2]  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.


  imcrop imdivide