Dilate binary or intensity image 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.
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 block returns the dilated image as a matrix of intensity values. The size and data type 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 the 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 a 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
If the structuring element is decomposable into smaller elements, the block uses a more efficient algorithm that can execute more quickly.
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 boundary of the object.
Filling small holes and broken areas
Connecting areas separated by a space smaller than the structuring element
The direction and extent of the growth of an object in an image depends on the shape of the structuring element. Each structuring element has an origin.
If the structuring element is symmetrical, the origin coincides with its centroid.
If the structuring element is asymmetrical, the pixel in the structuring element that is close to its centroid and is in the top-left direction is considered as the origin.
The Dilation block rotates the structuring element about this origin and places the origin over each pixel of the image object. The block creates the dilated image from the local maxima values at each pixel.
The binary dilation of A by B, denoted as A ⨁ B, is defined as the set operation:
where is the reflection of the structuring element B. 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 specified 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 specifies the height values and
corresponds to the structuring element domain
Grayscale dilation is often 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.
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Introduced before R2006a