morphology gonzalez woods
TRANSCRIPT
-
8/12/2019 Morphology Gonzalez Woods
1/107
Lecture 5. Morphological Image
Processing
-
8/12/2019 Morphology Gonzalez Woods
2/107
2/25/2014 2
Introduction
Morphology : a branch of biology that deals with the formand structure of animals and plants
Morphological image processing is used to extract imagecomponents for representation and description of regionshape, such as boundaries, skeletons, and the convex hull
-
8/12/2019 Morphology Gonzalez Woods
3/107
2/25/2014 3
Preliminaries (1)
Reflection
Translation
The reflection of a set , denoted , is defined as
{ | , for }
B B
B w w b b B
1 2The translation of a set by point ( , ), denoted ( ) ,
is defined as
( ) { | , for }
Z
Z
B z z z B
B c c b z b B
-
8/12/2019 Morphology Gonzalez Woods
4/107
2/25/2014 4
Example: Reflection and Translation
-
8/12/2019 Morphology Gonzalez Woods
5/107
2/25/2014 5
Preliminaries (2)
Structure elements (SE)
Small sets or sub-images used to probe an image under study forproperties of interest
-
8/12/2019 Morphology Gonzalez Woods
6/107
2/25/2014 6
Examples: Structuring Elements (1)
origin
-
8/12/2019 Morphology Gonzalez Woods
7/107
2/25/2014 7
Examples: Structuring Elements (2) Accommodate theentire structuringelements when itsorigin is on theborder of theoriginal set A
Origin of B visitsevery element of A
At each location ofthe origin of B, if Bis completelycontained in A,then the location isa member of the
new set, otherwiseit is not a memberof the new set.
-
8/12/2019 Morphology Gonzalez Woods
8/107
2/25/2014 8
Erosion
2With and as sets in , the erosion of by , denoted ,
defined
| ( ) Z
A B Z A B A B
A B z B A
The set of all points such that , translated by , is contained by . z B z A
| ( ) c Z A B z B A
-
8/12/2019 Morphology Gonzalez Woods
9/107
2/25/2014 9
Exampleof
Erosion(1)
-
8/12/2019 Morphology Gonzalez Woods
10/107
2/25/2014 10
Exampleof
Erosion(2)
-
8/12/2019 Morphology Gonzalez Woods
11/107
2/25/2014 11
Dilation
2With and as sets in , the dilation of by ,
denoted , is defined as
A B= | z
A B Z A B
A B
z B A
The set of all displacements , the translated and
overlap by at least one element.
z B A
| z A B z B A A
-
8/12/2019 Morphology Gonzalez Woods
12/107
2/25/2014 12
Examples of Dilation (1)
-
8/12/2019 Morphology Gonzalez Woods
13/107
2/25/2014 13
Examples of Dilation (2)
-
8/12/2019 Morphology Gonzalez Woods
14/107
2/25/2014 14
Duality
Erosion and dilation are duals of each other with respect toset complementation and reflection
c c
c c
A B A B
and
A B A B
-
8/12/2019 Morphology Gonzalez Woods
15/107
2/25/2014 15
Duality
Erosion and dilation are duals of each other with respect toset complementation and reflection
| |
|
cc
Z
cc Z
c
Z
c
A B z B A z B A
z B A A B
-
8/12/2019 Morphology Gonzalez Woods
16/107
2/25/2014 16
Duality
Erosion and dilation are duals of each other with respect toset complementation and reflection
|
|
cc
Z
c
Z
c
A B z B A
z B A
A B
-
8/12/2019 Morphology Gonzalez Woods
17/107
2/25/2014 17
Opening and Closing
Opening generally smoothes the contour of an object,breaks narrow isthmuses, and eliminates thin protrusions
Closing tends to smooth sections of contours but itgenerates fuses narrow breaks and long thin gulfs,eliminates small holes, and fills gaps in the contour
-
8/12/2019 Morphology Gonzalez Woods
18/107
2/25/2014 18
Opening and Closing
The opening of set by structuring element ,
denoted , is defined as
A B
A B
A B A B B
The closing of set by structuring element ,
denoted , is defined as
A B
A B A B A B B
-
8/12/2019 Morphology Gonzalez Woods
19/107
2/25/2014 19
Opening
The opening of set by structuring element ,
denoted , is defined as
| Z Z
A B
A B
A B B B A
-
8/12/2019 Morphology Gonzalez Woods
20/107
2/25/2014 20
Example: Opening
-
8/12/2019 Morphology Gonzalez Woods
21/107
2/25/2014 21
Example: Closing
-
8/12/2019 Morphology Gonzalez Woods
22/107
2/25/2014 22
-
8/12/2019 Morphology Gonzalez Woods
23/107
2/25/2014 23
Duality of Opening and Closing
Opening and closing are duals of each other with respectto set complementation and reflection
( )
c c A B A B
( )c c A B A B
-
8/12/2019 Morphology Gonzalez Woods
24/107
2/25/2014 24
The Properties of Opening and Closing
Properties of Opening
Properties of Closing
(a) is a subset (subimage) of
(b) if is a subset of , then is a subset of
(c) ( )
A B A
C D C B D B
A B B A B
(a) is subset (subimage) of(b) If is a subset of , then is a subset of
(c) ( )
A A BC D C B D B
A B B A B
-
8/12/2019 Morphology Gonzalez Woods
25/107
2/25/2014 25
-
8/12/2019 Morphology Gonzalez Woods
26/107
2/25/2014 26
The Hit-or-MissTransformation
if denotes the set composed of
and its background,the match
(or set of matches) of in ,
denoted ,
* c
B
D
B A
A B
A B A D A W D
1 2
1
2
1 2
,
: object
: background
( )c
B B B
B
B
A B A B A B
-
8/12/2019 Morphology Gonzalez Woods
27/107
2/25/2014 27
Some Basic Morphological Algorithms (1)
Boundary ExtractionThe boundary of a set A, can be obtained by first eroding Aby B and then performing the set difference between Aand its erosion.
( ) A A A B
-
8/12/2019 Morphology Gonzalez Woods
28/107
2/25/2014 28
Example 1
-
8/12/2019 Morphology Gonzalez Woods
29/107
2/25/2014 29
Example 2
-
8/12/2019 Morphology Gonzalez Woods
30/107
2/25/2014 30
Some Basic Morphological Algorithms (2)
Hole Filling A hole may be defined as a background region surroundedby a connected border of foreground pixels.
Let A denote a set whose elements are 8-connectedboundaries, each boundary enclosing a background region(i.e., a hole). Given a point in each hole, the objective is tofill all the holes with 1s.
-
8/12/2019 Morphology Gonzalez Woods
31/107
2/25/2014 31
Some Basic Morphological Algorithms (2)
Hole Filling1. Forming an array X 0 of 0s (the same size as the arraycontaining A), except the locations in X 0 corresponding tothe given point in each hole, which we set to 1.
2. Xk = (X k-1 + B) A c k=1,2,3,
Stop the iteration if X k = X k-1
-
8/12/2019 Morphology Gonzalez Woods
32/107
2/25/2014 32
Example
-
8/12/2019 Morphology Gonzalez Woods
33/107
2/25/2014 33
-
8/12/2019 Morphology Gonzalez Woods
34/107
2/25/2014 34
Some Basic Morphological Algorithms (3)
Extraction of Connected ComponentsCentral to many automated image analysis applications.
Let A be a set containing one or more connectedcomponents, and form an array X 0 (of the same size as thearray containing A) whose elements are 0s, except at eachlocation known to correspond to a point in each connectedcomponent in A, which is set to 1.
-
8/12/2019 Morphology Gonzalez Woods
35/107
2/25/2014 35
Some Basic Morphological Algorithms (3)
Extraction of Connected ComponentsCentral to many automated image analysis applications.
1
-1
( ): structuring element
until
k k
k k
X X B A B
X X
-
8/12/2019 Morphology Gonzalez Woods
36/107
2/25/2014 36
-
8/12/2019 Morphology Gonzalez Woods
37/107
2/25/2014 37
-
8/12/2019 Morphology Gonzalez Woods
38/107
2/25/2014 38
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.
The convex hull H or of an arbitrary set S is the smallestconvex set containing S.
-
8/12/2019 Morphology Gonzalez Woods
39/107
2/25/2014 39
Some Basic Morphological Algorithms (4)
Convex Hull
1
Let , 1, 2, 3, 4, represent the four structuring elements.
The procedure consists of implementing the equation:
( * )1, 2,3, 4 and 1,
i
i ik k
B i
X X B Ai k
0
1
4
1
2,3,...
with .
When the procedure converges, or , let ,
the convex hull of A is
( )
i
i i i ik k k
i
i
X A
X X D X
C A D
-
8/12/2019 Morphology Gonzalez Woods
40/107
2/25/2014 40
-
8/12/2019 Morphology Gonzalez Woods
41/107
2/25/2014 41
-
8/12/2019 Morphology Gonzalez Woods
42/107
2/25/2014 42
Some Basic Morphological Algorithms (5)
ThinningThe thinning of a set A by a structuring element B, defined
( * )
( * ) c A B A A B
A A B
-
8/12/2019 Morphology Gonzalez Woods
43/107
2/25/2014 43
Some Basic Morphological Algorithms (5)
A more useful expression for thinning A symmetrically isbased on a sequence of structuring elements:
1 2 3
-1, , ,...,
where is a rotated version of
n
i i B B B B B
B B
1 2The thinning of by a sequence of structuring element { } { } ((...(( ) )...) )n
A B A B A B B B
-
8/12/2019 Morphology Gonzalez Woods
44/107
2/25/2014 44
-
8/12/2019 Morphology Gonzalez Woods
45/107
2/25/2014 45
Some Basic Morphological Algorithms (6)
Thickening:
The thickening is defined by the expression
* A B A A B
1 2
The thickening of by a sequence of structuring element { }
{ } ((...(( ) )...) )n A B
A B A B B B
In practice, the usual procedure is to thin the background of the set
and then complement the result.
-
8/12/2019 Morphology Gonzalez Woods
46/107
2/25/2014 46
Some Basic Morphological Algorithms (6)
-
8/12/2019 Morphology Gonzalez Woods
47/107
2/25/2014 47
Some Basic Morphological Algorithms (7)
Skeletons
A skeleton, ( ) of a set has the following properties
a. if is a point of ( ) and ( ) is the largest disk
centered at and contained in , one cannot find a
larger disk containing ( )
z
z
S A A
z S A D
z A
D and included in .
The disk ( ) is called a maximum disk.
b. The disk ( ) touches the boundary of at two or
more different places.
z
z
A
D
D A
-
8/12/2019 Morphology Gonzalez Woods
48/107
2/25/2014 48
Some Basic Morphological Algorithms (7)
-
8/12/2019 Morphology Gonzalez Woods
49/107
2/25/2014 49
Some Basic Morphological Algorithms (7)
0
The skeleton of A can be expressed in terms oferosion and openings.
( ) ( )
with max{ | };
( ) ( ) ( )
where is a structuring element, and
K
k k
k
S A S A
K k A kB
S A A kB A kB B
B
( ) ((..(( ) ) ...) )
successive erosions of A.
A kB A B B B
k
-
8/12/2019 Morphology Gonzalez Woods
50/107
-
8/12/2019 Morphology Gonzalez Woods
51/107
2/25/2014 51
-
8/12/2019 Morphology Gonzalez Woods
52/107
2/25/2014 52
Some Basic Morphological Algorithms (7)
0
A can be reconstructed from the subsets by using
( ( ) )
where ( ) denotes successive dilations of A. ( ( ) ) ((...(( ( ) ) )... )
K
k k
k
k k
A S A kB
S A kB k S A kB S A B B B
-
8/12/2019 Morphology Gonzalez Woods
53/107
2/25/2014 53
-
8/12/2019 Morphology Gonzalez Woods
54/107
-
8/12/2019 Morphology Gonzalez Woods
55/107
2/25/2014 55
Pruning:Example
1 { } X A B
-
8/12/2019 Morphology Gonzalez Woods
56/107
2/25/2014 56
Pruning:Example
8
2 11* k
k X X B
-
8/12/2019 Morphology Gonzalez Woods
57/107
2/25/2014 57
Pruning:Example
3 2: 3 3 structuring element
X X H A
H
-
8/12/2019 Morphology Gonzalez Woods
58/107
2/25/2014 58
Pruning:Example
4 1 3 X X X
-
8/12/2019 Morphology Gonzalez Woods
59/107
2/25/2014 59
Pruning:Example
-
8/12/2019 Morphology Gonzalez Woods
60/107
2/25/2014 60
Some Basic Morphological Algorithms (9)
Morphological Reconstruction
It involves two images and a structuring element
a. One image contains the starting points for the
transformation (The image is called marker)
b. Another image (mask) constrains the transformation
c. The structuring element is used to define connectivity
M h l i l R i G d i
-
8/12/2019 Morphology Gonzalez Woods
61/107
2/25/2014 61
Morphological Reconstruction: GeodesicDilation
(1)
(1)
Let denote the marker image and the mask image,
. The geodesic dilation of size 1 of the marker image
with respect to the mask, denoted by ( ), is defined as ( ) G
G
G
F G
F G
D F D F F B
( )
( ) (1) ( 1)
(0)
The geodesic dilation of size of the marker image
with respect to , denoted by ( ), is defined as ( ) ( ) ( )
with ( ) .
nG
n nG G G
G
n F
G D F D F D F D F
D F F
-
8/12/2019 Morphology Gonzalez Woods
62/107
2/25/2014 62
M h l i l R t ti G d i
-
8/12/2019 Morphology Gonzalez Woods
63/107
2/25/2014 63
Morphological Reconstruction: GeodesicErosion
(1)
(1)
Let denote the marker image and the mask image.
The geodesic erosion of size 1 of the marker image with
respect to the mask, denoted by ( ), is defined as ( ) G
G
G
F G
E F E F F B
( )
( ) (1) ( 1)
(0)
The geodesic erosion of size of the marker image
with respect to , denoted by ( ), is defined as ( ) ( ) ( )
with ( ) .
nG
n nG G G
G
n F
G E F E F E F E F
E F F
-
8/12/2019 Morphology Gonzalez Woods
64/107
2/25/2014 64
-
8/12/2019 Morphology Gonzalez Woods
65/107
2/25/2014 65
Morphological Reconstruction by Dilation
Morphological reconstruction by dialtion of a mask image
from a marker image , denoted ( ), is defined as
the geodesic dilation of with respect to , iterated until
stability is achieved; that
DGG F R F
F G
( )
( ) ( 1)
is,
( ) ( )
with such that ( ) ( ).
D k G G
k k G G
R F D F
k D F D F
-
8/12/2019 Morphology Gonzalez Woods
66/107
2/25/2014 66
-
8/12/2019 Morphology Gonzalez Woods
67/107
2/25/2014 67
Morphological Reconstruction by Erosion
Morphological reconstruction by erosion of a mask image
from a marker image , denoted ( ), is defined as
the geodesic erosion of with respect to , iterated until
stability is achieved; that i
E GG F R F
F G
( )
( ) ( 1)
s,
( ) ( )
with such that ( ) ( ).
E k G G
k k G G
R F E F
k E F E F
-
8/12/2019 Morphology Gonzalez Woods
68/107
2/25/2014 68
Opening by Reconstruction
( )
The opening by reconstruction of size of an image is
defined as the reconstruction by dilation of from the
erosion of size of ; that is
( )
where
n D R F
n F
F
n F
O F R F nB
F nB
indicates erosions of by .n F B
-
8/12/2019 Morphology Gonzalez Woods
69/107
2/25/2014 69
-
8/12/2019 Morphology Gonzalez Woods
70/107
2/25/2014 70
Filling Holes
Let ( , ) denote a binary image and suppose that weform a marker image that is 0 everywhere, except at
the image border, where it is set to 1- ; that is
1 ( , ) if ( , ) is on the bor ( , )
I x y F
I
I x y x y F x y
der of
0 otherwise
then
( )cc D
I
I
H R F
-
8/12/2019 Morphology Gonzalez Woods
71/107
2/25/2014 71
SE : 3 3 1s.
-
8/12/2019 Morphology Gonzalez Woods
72/107
2/25/2014 72
( )cc D
I H R F
-
8/12/2019 Morphology Gonzalez Woods
73/107
2/25/2014 73
Border ClearingIt 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.
The original image is used as the mask and the followingmarker image:
( , ) if ( , ) is on the border of( , )
0 otherwise
I x y x y I F x y
X I R
( ) D I F
-
8/12/2019 Morphology Gonzalez Woods
74/107
2/25/2014 74
-
8/12/2019 Morphology Gonzalez Woods
75/107
2/25/2014 75
Summary (1)
-
8/12/2019 Morphology Gonzalez Woods
76/107
2/25/2014 76
Summary (2)
-
8/12/2019 Morphology Gonzalez Woods
77/107
2/25/2014 77
-
8/12/2019 Morphology Gonzalez Woods
78/107
-
8/12/2019 Morphology Gonzalez Woods
79/107
2/25/2014 79
Gray-Scale Morphology
( , ) : gray-scale image( , ): structuring element
f x yb x y
Gray-Scale Morphology: Erosion and Dilation
-
8/12/2019 Morphology Gonzalez Woods
80/107
2/25/2014 80
Gray Scale Morphology: Erosion and Dilationby Flat Structuring
( , )
( , )
( , ) min ( , )
( , ) max ( , )
s t b
s t b
f b x y f x s y t
f b x y f x s y t
-
8/12/2019 Morphology Gonzalez Woods
81/107
2/25/2014 81
Gray-Scale Morphology: Erosion and Dilation
-
8/12/2019 Morphology Gonzalez Woods
82/107
2/25/2014 82
Gray Scale Morphology: Erosion and Dilationby Nonflat Structuring
( , )
( , )
( , ) min ( , ) ( , )
( , ) max ( , ) ( , )
N N s t b
N N s t b
f b x y f x s y t b s t
f b x y f x s y t b s t
l d l
-
8/12/2019 Morphology Gonzalez Woods
83/107
2/25/2014 83
Duality: Erosion and Dilation
( , ) ( , )
where ( , ) and ( , )
c c
c
c c
f b x y f b x y
f f x y b b x y f b f b
( )c c f b f b
-
8/12/2019 Morphology Gonzalez Woods
84/107
2/25/2014 84
Opening and Closing
f b f b b
f b f b b
c c
c c
f b f b f b
f b f b f b
-
8/12/2019 Morphology Gonzalez Woods
85/107
i f G l O i
-
8/12/2019 Morphology Gonzalez Woods
86/107
2/25/2014 86
Properties of Gray-scale Opening
1 2 1 2
( )
( ) if , then
( )
where denotes is a subset of and also
( , ) ( , ).
a f b f
b f f f b f b
c f b b f b
e r e r
e x y r x y
P i f G l Cl i
-
8/12/2019 Morphology Gonzalez Woods
87/107
2/25/2014 87
Properties of Gray-scale Closing
1 2 1 2
( )
( ) if , then( )
a f f b
b f f f b f bc f b b f b
-
8/12/2019 Morphology Gonzalez Woods
88/107
2/25/2014 88
M h l i l S hi
-
8/12/2019 Morphology Gonzalez Woods
89/107
2/25/2014 89
Morphological Smoothing
Opening suppresses bright details smaller than thespecified SE, and closing suppresses dark details.
Opening and closing are used often in combination asmorphological filters for image smoothing and noiseremoval.
-
8/12/2019 Morphology Gonzalez Woods
90/107
-
8/12/2019 Morphology Gonzalez Woods
91/107
-
8/12/2019 Morphology Gonzalez Woods
92/107
T h t d B tt h t T f ti
-
8/12/2019 Morphology Gonzalez Woods
93/107
2/25/2014 93
Top-hat and Bottom-hat Transformations
The top-hat transformation of a grayscale image f isdefined as f minus its opening:
The bottom-hat transformation of a grayscale image f isdefined as its closing minus f:
( ) ( )hat
T f f f b
( ) ( )hat B f f b f
T h t d B tt h t T f ti
-
8/12/2019 Morphology Gonzalez Woods
94/107
2/25/2014 94
Top-hat and Bottom-hat Transformations
One of the principal applications of these transformationsis in removing objects from an image by using structuringelement in the opening or closing operation
-
8/12/2019 Morphology Gonzalez Woods
95/107
Granulometry
-
8/12/2019 Morphology Gonzalez Woods
96/107
2/25/2014 96
Granulometry
Granulometry deals with determining the size ofdistribution of particles in an image
Opening operations of a particular size should have themost effect on regions of the input image that containparticles of similar size
For each opening, the sum ( surface area ) of the pixelvalues in the opening is computed
Example
-
8/12/2019 Morphology Gonzalez Woods
97/107
2/25/2014 97
p
-
8/12/2019 Morphology Gonzalez Woods
98/107
2/25/2014 98
Textual Segmentation
-
8/12/2019 Morphology Gonzalez Woods
99/107
2/25/2014 99
Textual Segmentation
Segmentation: the process of subdividing an image intoregions.
Textual Segmentation
-
8/12/2019 Morphology Gonzalez Woods
100/107
2/25/2014 100
Textual Segmentation
-
8/12/2019 Morphology Gonzalez Woods
101/107
Gray Scale Morphological Reconstruction (2)
-
8/12/2019 Morphology Gonzalez Woods
102/107
2/25/2014 102
Gray-Scale Morphological Reconstruction (2)
The geodesic erosion of size 1 of f with respect to g isdefined as
The geodesic erosion of size n of f with respect to g isdefined as
(1) ( )
where denotes the point-wise maximum operator.
g E f f g g
( ) (1) ( 1) (0)( ) ( ) with ( )n n g g g g E f E E f E f f
-
8/12/2019 Morphology Gonzalez Woods
103/107
Gray-Scale Morphological Reconstruction (4)
-
8/12/2019 Morphology Gonzalez Woods
104/107
2/25/2014 104
Gray-Scale Morphological Reconstruction (4)
The opening by reconstruction of size n of an image f isdefined as the reconstruction by dilation of f from theerosion of size n of f; that is,
The closing by reconstruction of size n of an image f isdefined as the reconstruction by erosion of f from thedilation of size n of f; that is,
( ) ( )n D R f O f R f nb
( ) ( )n E R f C f R f nb
-
8/12/2019 Morphology Gonzalez Woods
105/107
2/25/2014 105
Steps in the Example
-
8/12/2019 Morphology Gonzalez Woods
106/107
2/25/2014 106
Steps in the Example
1. Opening by reconstruction of the original image using a horizontalline of size 1x71 pixels in the erosion operation
2. Subtract the opening by reconstruction from original image
3. Opening by reconstruction of the f using a vertical line of size 11x1pixels
4. Dilate f1 with a line SE of size 1x21, get f2.
( ) ( )n D R f O f R f nb
( )' ( )n R f f O f
( )1 ( ') ' 'n D R f f O f R f nb
Steps in the Example
-
8/12/2019 Morphology Gonzalez Woods
107/107
Steps in the Example
5. Calculate the minimum between the dilated image f2and and f, get f3.
6. By using f3 as a marker and the dilated image f2 asthe mask,
( )2 2
( ) ( 1)2 2
( 3) 3
with k such that 3 3
D k f f
k k f f
R f D f
D f D f