Dilate binary or intensity images by finding local maxima
Computer Vision Toolbox / Morphological Operations
The Dilation block performs morphological dilation on an intensity or binary image and outputs the dilated image.
To define the structuring element that the block applies to the image, use the
Neighborhood or structuring element parameter. Specify this element by
entering a vector or matrix of
0s or by using the
The Dilation block rotates the structuring element about its origin (if it is unsymmetrical), and places this origin over each pixel of the image object. The block creates the output matrix, that is, the dilated image, from the local maxima values found at each pixel.
This block uses two-dimensional flat structuring elements only.
I — Input image
Specify an input image as a matrix of intensity values. This port is unnamed
unless you set the Neighborhood or structuring element source
Nhood — Neighborhood values
vector | matrix
Specify neighborhood values representing a structuring element as a vector or
0s or by using the
To enable this port, set the Neighborhood or structuring element
source parameter to
Port_1 — Dilated image
The dilated image is returned as a matrix of intensity values. The size and datatype of the output image are the same as those of the input image.
Neighborhood or structuring element source — Source of neighborhood or structuring element
Specify via dialog (default) |
Specify the source of neighborhood or structuring element as one of these options:
Specify via dialog— Use the Neighborhood or structuring element parameter to specify a neighborhood or structuring element.
Input port— Use the Nhood input port to specify neighborhood values representing a structuring element.
Neighborhood or structuring element — Neighborhood or structuring element
[1 1; 1 1] (default) | vector | matrix
Specify neighborhood or structuring element as a vector or matrix of
strel object or an array of
strel objects. When you specify an array of
strel objects, the block applies each object to the entire image in
If the structuring element is decomposable into smaller elements, the block executes at higher speed due to the use of a more efficient algorithm.
To enable this parameter, set the Neighborhood or structuring element
source parameter, to
Dilation and Structuring Element
Performing dilation on an image includes,
Increasing the size of the object by expanding the image pixels and adding pixels to the object's boundaries
Filling small holes and broken areas and
Connecting the areas that are separated by a space smaller than the structuring element
The specific way and extent of the object's growth in an image is dependent on the shape of the structuring element. Each structuring element has an origin. If the element is symmetrical, the origin coincides with its centroid and if it is unsymmetrical, the origin is taken as that pixel, which is slightly towards the top left corner.
The binary dilation of A by B, denoted A ⨁ B, is defined as the set operation:
where is the reflection of the structuring element B. In other words, it is the set of pixel locations z, where the reflected structuring element overlaps with foreground pixels in A when translated to z. Note that some applications use a definition of dilation in which the structuring element is not reflected.
In the general form of grayscale dilation, the structuring element has a height. The grayscale dilation of A(x, y) by B(x, y) is defined as:
where DB is the domain of the
structuring element B and A(x,
y) is assumed to be –∞ outside the domain of the image. To create a
structuring element with nonzero height values, use the syntax
height gives the height
nhood corresponds to the structuring element domain,
Most commonly, grayscale dilation is performed with a flat structuring element (B(x,y) = 0). Grayscale dilation using such a structuring element is equivalent to a local-maximum operator:
All of the
strel syntaxes except for
strel('ball',...) produce flat structuring elements.
 Soille, Pierre. Morphological Image Analysis. Berlin, Heidelberg: Springer Berlin Heidelberg, 2004. https://doi.org/10.1007/978-3-662-05088-0.
 Gonzalez, Rafael C., Richard E. Woods, and Steven L. Eddins. Digital Image Processing Using MATLAB. Third edition. Knoxville: Gatesmark Publishing, 2020.