## Developer Reference

• 2021
• 03/26/2021
• Public Content
Contents

# Morphological Operations

This chapter describes the Intel® IPP image processing functions that perform morphological operations on images.
Generally, the erosion and dilation smooth the boundaries of objects without significantly changing their area. Opening and closing smooth thin projections or gaps. Morphological operations use a structuring element (SE) that is a a user-defined rectangular mask, or for some functions - symmetric 3x3 mask.
In a more general sense, morphological operations involve an image
A
called the object of interest and a kernel element
B
called the structuring element. The image and structuring element could be in any number of dimensions, but the most common use is with a 2D binary image, or with a 3D gray scale image. The element
B
is most often a square or a circle, but it could be of any shape. Just like in convolution,
B
is a kernel or template with an anchor point. Figure
"Dilation and Erosion of
A
by
B
"
shows dilation and erosion of object
A
by
B
. In the figure,
B
is rectangular with an anchor point at upper left shown as a dark square.
Let
B
t
is the SE with pixel
t
in the anchor position,
B
is transpose of the SE.
Dilation of binary image
A
{
A
(
t
) = 1,
t
A
; 0 - otherwise} by binary SE
B
is
It means that every pixel is in the set, if the intersection is not null. That is, a pixel under the anchor point of
B
is marked “on”, if at least one pixel of
B
is inside of
A
.
Erosion of the binary image
A
by the binary SE
B
is
That is, a pixel under the anchor of
B
is marked “on”, if
B
is entirely within
A
.
Generalization of dilation and erosion for the gray-scale image
A
and the binary SE
B
is
Generalization of dilation and erosion for the gray-scale image
A
and the gray-scale SE
B
is
Opening operation of
A
by
B
is
A
B
= (
A
Θ
B
)
B
.
Closing operation of
A
by
B
is
A
B
= (
A
B
)
Θ
B
.
Top-hat operation of
A
by
B
is
A
-
A
º
B
.
Black-hat operation of
A
by
B
is
A
B
-
A
.
Black-hat operation of
A
by
B
is
A
B
-
A
Θ
B
.
Morphological reconstruction [Vincent93]
ρ
A
(
C
) of an image
A
from the image
C
,
A
(
t
)
C
(
t
)
t
B
is an image
Morphological reconstruction
ρ
A
(
C
) of an image
A
from the image
C
,
A
(
t
)
C
(
t
)
t
B
is an image
Figure
"Morphological Operations Performed by Intel IPP"
presents the results of different morphological operations applied to the initial image. In these operations, the SE is a matrix of 3x3 size with the following values:
for common and advanced morphology, and
for gray morphology.
The anchor cell is in the center cell (1,1) of the matrix.

## Flat Structuring Elements for Grayscale Image

Erosion and dilation can be done in 3D space, that is, with gray levels. 3D structuring elements can be used, but the simplest and the best way is to use a flat structuring element
B
. Figure
"1D Cross Section of Dilation and Erosion of A by B"
is a 1D cross section of dilation and erosion of a grayscale image
A
by a flat structuring element
B
. In the figure,
B
has an anchor slightly to the right of the center as shown by the dark mark on
B
.
and erosion is
.

#### Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.