Image Processing Toolbox    

Dilating an Image

To dilate an image, use the imdilate function. The imdilate function accepts two primary arguments:

imdilate also accepts two optional arguments: PADOPT and PACKOPT. The PADOPT argument affects the size of the output image. The PACKOPT argument identifies the input image as packed binary. (See the bwpack reference page for information about binary image packing.)

This example dilates a simple binary image containing one rectangular object.

To expand all sides of the foreground component, the example uses a 3-by-3 square structuring element object. (For more information about using the strel function, see Structuring Elements.)

To dilate the image, pass the image, BW, and the structuring element, SE, to the imdilate function. Note how dilation adds a rank of 1's to all sides of the foreground object.


  Structuring Elements Eroding an Image