Professional Documents
Culture Documents
1
Introduction
11/17/2023 2
Types of Morphological
Operations
► Erosion
► Dilation
► Opening
► Closing
11/17/2023 3
Motivation: Morphological Operations
Blood vessel detection in retinal images
4
Application: Cell segmentation
11/17/2023 5
Preliminaries (1)
► Reflection
► Translation
11/17/2023 6
Example: Reflection and Translation
11/17/2023 7
Preliminaries (2)
OR
11/17/2023 8
Examples: Structuring Elements (1)
origin
11/17/2023 9
Examples: Structuring Elements (2)
Accommodate the
entire structuring
elements when its Origin of B visits
origin is on the every element of A
border of the
original set A
At each location of
the origin of B, if B
is completely
contained in A,
then the location is
a member of the
new set, otherwise
it is not a member
of the new set.
11/17/2023 10
Erosion
A B z | ( B ) Z A c
Take all possible translations of SE B, and take its intersection with the non-image,
comp A. If for any image element this is a disjoint set, it will remain part of the erosion
result and all image elements for which its not a disjoint set, it would be discarded, i.e.
11/17/2023 11
marked zero
Erosion:
Example
11/17/2023 12
Example
of
Erosion
(1)
11/17/2023 13
Example
of
Erosion
(2)
11/17/2023 14
Dilation
2
With A and B as sets in Z , the dilation of A by B,
denoted A B, is defined as
A
A B= z | B
z
and A
The set of all displacements z, the translated B
overlap by at least one element, and all such points which
allow at least one overlap, will become part of A.
A B z | B
A A
z
Every common element between all the possible translations and reflectance
of 11/17/2023
SE B and image A (should not be disjoint) will become the part of the image A, i.e.
15
A
will contain the common elements
Dilation:
Example
11/17/2023 16
Examples of Dilation (1)
11/17/2023 17
Examples of Dilation (2)
11/17/2023 18
Duality
A B
c
A B
c
and
A B
c
Ac B
11/17/2023 19
Duality
A B z | B Z A
c c
z | B Z A
c c
z | B Z Ac
Ac B
11/17/2023 20
Duality
A
c
A B
c
z| B
Z
z | B
A
c
Z
Ac B
11/17/2023 21
Opening and Closing
23
Opening
The opening of set A by structuring element B,
denoted A B, is defined as
A B A B B
OR
A B B Z | B Z A
11/17/2023 24
Closing
11/17/2023 25
SE could not fit Helps
Opening: Removes completely the regions that can not contained the SE,
breaks thin connections, smoothens object contours
Closing:
11/17/2023 Smoothens the object contours, Joins narrow breaks, fills long 26
11/17/2023 27
Example: Closing
AB
c )
(A B
c
A B
c )
( A B
c
11/17/2023 30
The Properties of Opening and Closing
► Properties of Opening
(a) A B is a subset (subimage) of A
(b) if C is a subset of D, then C B is a subset of D B
(c) ( A B) B A B
► Properties of Closing
B B1 , B2
B1 : object
B2 : background
A B A B1 ( Ac B2 )
11/17/2023 33
Example:
► AIM-
How to identify
the locations
Of following
cross-shaped pixel
configuration
11/17/2023 34
Example
:
► How to locate upper left corner pixels of square objects in first image
using hit-or-miss transformation ?
► i.e., we want to locate foreground pixels that have east and south
neighbors (these are “hits”) and
► that have no north, northwest, west or southwest neighbors (these are
“misses”)
11/17/2023 35
Some Basic Morphological Algorithms (1)
► Boundary Extraction
The boundary of a set A, can be obtained by first eroding A
by B and then performing the set difference between A
and its erosion.
( A) A A B
11/17/2023 36
Example 1
11/17/2023 37
Example 2
11/17/2023 38
Some Basic Morphological Algorithms (2)
► Hole Filling
A hole may be defined as a background region surrounded
by a connected border of foreground pixels.
11/17/2023 39
Some Basic Morphological Algorithms (2)
► Hole Filling
1. Forming an array X0 of 0s (the same size as the array
containing A), except the locations in X0 corresponding to
the given point in each hole, which we set to 1. Let A be
the original image and B the Structural Element
11/17/2023 40
Example
11/17/2023 41
11/17/2023 42
Some Basic Morphological Algorithms (3)
11/17/2023 43
Some Basic Morphological Algorithms (3)
X k ( X k 1 B ) A
B : structuring element
until X k X k -1
11/17/2023 44
11/17/2023 45
11/17/2023 46
Some Basic Morphological Algorithms (5)
► Thinning
The thinning of a set A by a structuring element B, defined
A B A ( A * B)
A ( A * B) c
11/17/2023 47
Some Basic Morphological Algorithms (5)
B B1
, B 2
, B 3
,..., B n
where B i is a rotated version of B i-1
11/17/2023 48
11/17/2023 49
Some Basic Morphological Algorithms (6)
► Thickening:
11/17/2023 50
Some Basic Morphological Algorithms (6)
11/17/2023 51
Some Basic Morphological Algorithms (4)
► Convex Hull
A set A is said to be convex if the straight line segment
joining any two points in A lies entirely within A.
11/17/2023 52
Some Basic Morphological Algorithms (4)
► Convex Hull
Let B i , i 1, 2, 3, 4, represent the four structuring elements.
The procedure consists of implementing the equation:
X ki ( X k 1 * B i ) A
i 1, 2,3, 4 and k 1, 2,3,...
with X 0i A.
When the procedure converges, or X ki X ki 1 , let Di X ki ,
the convex hull of A is
4
C ( A) D i
i 1
11/17/2023 53
11/17/2023 54
11/17/2023 55
Some Basic Morphological Algorithms (7)
► Skeletons
11/17/2023 56
Some Basic Morphological Algorithms (7)
11/17/2023 57
Some Basic Morphological Algorithms (7)
with K max{k | A kB };
S k ( A) ( A kB ) ( A kB ) B
where B is a structuring element, and
( A kB) ((..(( A B) B) ...) B)
k successive erosions of A.
11/17/2023 58
11/17/2023 59
11/17/2023 60
Some Basic Morphological Algorithms (7)
11/17/2023 61
11/17/2023 62
Some Basic Morphological Algorithms (8)
► Pruning
11/17/2023 63
Pruning:
Example
X 1 A {B}
11/17/2023 64
Pruning:
Example
X 2 X1 * Bk
8
k 1
11/17/2023 65
Pruning:
Example
X3 X2 H A
H : 3 3 structuring element
11/17/2023 66
Pruning:
Example
X 4 X1 X 3
11/17/2023 67
Pruning:
Example
11/17/2023 68
Some Basic Morphological Algorithms (9)
► Morphological Reconstruction
11/17/2023 69
Morphological Reconstruction: Geodesic
Dilation
RGD ( F ) DG( k ) ( F )
RGE ( F ) EG( k ) ( F )
11/17/2023 77
11/17/2023 78
Filling Holes
1 I ( x, y ) if ( x, y ) is on the border of I
F ( x, y )
0 otherwise
then
c
H R ( F )
D
Ic
11/17/2023 79
SE : 3 3 1s.
11/17/2023 80
c
H R ( F )
D
Ic
11/17/2023 81
Border Clearing
It can be used to screen images so that only complete objects
remain for further processing; it can be used as a singal that
partial objects are present in the field of view.
11/17/2023 82
11/17/2023 83
Summary (1)
11/17/2023 84
Summary (2)
11/17/2023 85
11/17/2023 86
11/17/2023 87
Gray-Scale Morphology
f ( x, y ) : gray-scale image
b( x, y ): structuring element
11/17/2023 88
Gray-Scale Morphology: Erosion and Dilation
by Flat Structuring
f b ( x, y) (min
s ,t )b
f ( x s, y t )
f b ( x, y) max
( s ,t )b
f ( x s, y t )
11/17/2023 89
11/17/2023 90
Gray-Scale Morphology: Erosion and Dilation
by Nonflat Structuring
f bN ( x, y ) (min
s ,t )b
f ( x s, y t ) bN ( s, t )
f bN ( x, y ) max
( s ,t )b
f ( x s, y t ) bN ( s, t )
11/17/2023 91
Duality: Erosion and Dilation
c
f b
c
( x, y ) f b ( x, y )
where f c f ( x, y ) and b b( x, y )
c
f b
c
f b
c
f b ( f c
b)
11/17/2023 92
Opening and Closing
f b f b b
f b f b b
f b
c
f b f b
c
f b
c
f b f b
c
11/17/2023 93
11/17/2023 94
Properties of Gray-scale Opening
(a ) f bf
(b) if f1f 2 , then f1 b f 2 b
(c ) f bb f b
11/17/2023 95
Properties of Gray-scale Closing
(a) f f b
(b) if f1f 2 , then f1 b f 2 b
(c ) f b b f b
11/17/2023 96
11/17/2023 97
Morphological Smoothing
11/17/2023 98
Morphological Smoothing
11/17/2023 99
Morphological Gradient
g ( f b) ( f b)
► The edges are enhanced and the contribution of the
homogeneous areas are suppressed, thus producing a
“derivative-like” (gradient) effect.
11/17/2023 100
Morphological Gradient
11/17/2023 101
Top-hat and Bottom-hat Transformations
That ( f ) f ( f b)
► The bottom-hat transformation of a grayscale image f is
defined as its closing minus f:
Bhat ( f ) ( f b) f
11/17/2023 102
Top-hat and Bottom-hat Transformations
11/17/2023 103
Example of Using Top-hat Transformation in
Segmentation
11/17/2023 104
Granulometry
11/17/2023 105
Example
11/17/2023 106
11/17/2023 107
Textual Segmentation
11/17/2023 108
Textual Segmentation
11/17/2023 109
Gray-Scale Morphological Reconstruction (1)
► Let f and g denote the marker and mask image with the
same size, respectively and f ≤ g.
The geodesic dilation of size 1 of f with respect to g is
defined as
Dg(1) ( f ) f g g
where denotes the point-wise minimum operator.
The geodesic dilation of size n of f with respect to g is
defined as
Eg(1) ( f ) f g g
where denotes the point-wise maximum operator.
11/17/2023 111
Gray-Scale Morphological Reconstruction (3)
OR( n ) ( f ) R Df f nb
CR( n ) ( f ) R Ef f nb
11/17/2023 113
11/17/2023 114
Steps in the Example
f ' f OR( n ) ( f )
3. Opening by reconstruction of the f’ using a vertical line of size 11x1
pixels
11/17/2023 115
Steps in the Example
R Df 2 ( f 3) D (f k2) f 3
with k such that D (f k2) f 3 D (f k21) f 3
11/17/2023 116