Morphology
Morphology
Morphology
Morphological processing
1
.
Definitio
ns
(a) (b)
(c)
2
.
Structuring element
3
.
Erosion
Given A and B, the erosion of A through B, A B, is defined as:
A B = {z | (B)z ⊆ A}
A B = {z | (B)z ∩ Ac = ∅}
Erosion (2)
► If A and B are images, the morphological operations
are computed shifting the origin of the
structuring element in each pixel of the image A,
evaluating if the definition of the operation is
satisfied.
► Padding can be required.
► For the erosion:
► the origin of B is translated on a pixel a ∈ A;
► if all the elements of B are covered
by an element of A, the pixel a belong to A B.
4
.
Morphological
filtering
► The erosion can be
used for
realizing a shape
based filtering
(morphological
filtering).
(a) 486×486 binary
image;
(b) erosion of (a) with
11×11 square
structuring element;
a (c) with 15×15 square;
b (d) and with 45×45
c square.
d ► Erosion cancels the
details smaller
than the
structuring
element.
Dilation
A ⊕ B = {z | (Bˆ )z ∩ A /=
∅}
Equivalently, A dilated B
can be defined as:
A ⊕ B = {z | ((Bˆ )z ∩ A)
⊆ A}
5
.
Dilation (example)
Duality
► Erosion and dilation are operations dual with
respect to the complement and reflection:
(A B)c = Ac ⊕ Bˆ
and
(A ⊕ B)c = Ac Bˆ
► If the structuring element is symmetric (Bˆ = B), the
erosion of A can be obtained dilating the
background, AC , with the same structuring
element, and complementing the result (vice versa
for the dilation).
6
.
Opening
The opening of a set A through B, A ◦ B, is defined as:
A ◦ B = (A B) ⊕ B
Closing
The closing of a set A through B, A • B, is defined as:
A • B = (A ⊕ B) B
7
.
8
.
A B
AB (A B) ⊕ B = A ◦ B
(A ◦ B) ⊕
B
((A ◦ B) ⊕ B) B = (A ◦ B) • B
9
.
Hit or miss
► The hit-or-miss transformation allows to detect
disjointed shapes.
► The objects have to be separated by
at least one background pixel.
► The processing is based on a structuring element
(shaped as the object to be detected) and its local
background (a window larger than the structuring
element).
► Let A a set constituted of several regions, A = C ∪ D
∪E,B
the shape to be detected and its local background,
B = (D, W − D) = (B1, B2).
► The hit-or-miss transform A ® B is defined as:
A ® B = A D ∩ (Ac (W − D))
► Equivalent definitions:
►
A ® B = A B1 ∩ Ac B 2
►
A ® B = A B1 − Ac ⊕ Bˆ 2
Hit or miss (2)
10
.
Border extraction
β(A) = A − (A B)
Hole filling
► A hole is a background region surrounded by a
connected border of foreground elements.
► Let A a set containing 8-connected borders that
enclose a background region (holes), which have to
be filled (i.e., set to 1).
► The sequence X0, . . . , Xk can be constructed, where
X0 is a set containing a point of each hole and Xj
is defined as:
0 1 0 Xj = (X j − 1 ⊕ B) ∩ Ac
1 1 1
0 1 0
for B =
a b c
12
.
Thinning
A ⊗ B = A − (A ® B) = A ∩ (A ® B)c
A ⊗ {B} = (· · · ((A ⊗ B 1 ) ⊗ B 2 ) · · · ) ⊗ Bn
Thinning: an example
13
.
Thickening
A 0 {B} = (· · · ((A 0 B 1 ) 0 B 2 ) · · · ) 0 Bn
Thickening: an example
14