Lecture 14

Digital Image Processing
Lecture 14: Morphology
April 21, 2005
Prof. Charlene Tsai
What is morphology?
 Back to lecture 1 …
Erosion
Dilation
2
Preliminaries – Set Theory
 Let A be a set in Z2. If a=(a1,a2) is an element of A, then
we write a  A (if not, a  A )
 If A contains no element, it is called null or empty set 
 If every element of a set A is also an element of another
set B, then A is said to be a subset of B, denoted as A  B
 More definitions:
Ac  w | w  A
A  B  w | w  A, w  B  A  B c
3
Preliminaries – Set Theory (more)
 Two more definitions particularly important to
morphology:
 Reflection of set B, denoted B̂ , is
Bˆ  w | w  b, for b  B
 Translation of set A by point z=(z1,z2),
denoted (A)Z, is
 AZ  c | c  a  z,
for a  A
4
Dilation & Erosion
 Most primitive operations in morphology.
 All other operations are built from a
combination of these two.
5
Dilation
 Dilation of A by B, denoted A B , is defined
as
A  B   Az  x, y   u, v  : x, y  A, u, v  B
zB
 Intuition: for every point z  B, we translate A
by those coordinates. We then take the union
of all these translation.
 From the definition, we see that dilation is
commutative, A  B  B  A
 B is referred to as a structuring element or as
a kernel.
6
Example
1 2
3 4 5
1
-1 0 1
2
-1
3
0
4
1
5
B
6
7
A
A(0,0) is itself
7
A(1,1) & A(-1,1)
1 2
1 2
3 4 5
1
1
2
2
3
3
4
4
5
5
6
6
7
7
A(1,1)
3 4 5
A(-1,1)
8
A(1,-1) & A(-1,-1)
1 2
3 4 5
1 2
1
1
2
2
3
3
4
4
5
5
6
6
7
7
A(1,-1)
3 4 5
A(-1,-1)
9
Result
1 2
3 4 5
1
2
3
4
5
6
7
A B
10
Some Remarks
 Dilation has the effect of increasing the size
of an object.
 However, it is not necessarily true that the
original object A will lie within its dilation.
 Try out B={(7,3),(6,2),(6,4),(8,2),(8,4)}
11
Application
 An simple application is bridging gaps.
 Max length of break is 2 pixels
12
Erosion
 Erosion of A by B is AB  w : Bw  A
 Intuition: all point w=(x,y) for which Bw is in A.
 Consider A and B below:
B
A
13
Moving B around
AB
14
Application
 One simple application is eliminating
irrelevant detail from a binary image.
15
Opening and Closing
 Some combination of dilation and erosion
 Opening: breaking narrow isthmuses, and
eliminating protrusions.
A  B   AB  B
 Closing: fusing narrow breaks and long thin
gulfs.
A  B   A  BB
16
Geometric Interpretation: Opening
Opening of A by B is obtained by taking the
union of all translates of B that fit into A
17
Geometric Interpretation: Closing
x  A  B if all translation Bw that contain
x have nonempty intersections with A
18
Another Illustration
Erosion
Opening
Dilation
Closing
19
Properties of Opening & Closing
 Opening:
 A B is a subset (subimage) of A
 If C is a subset of D, then C  B is a subset
of D  B
  A  B  B  A  B (idempotence, meaning
opening cannot be done multiple times)
 Closing:
 A is a subset (subimage) of A B
 If C is a subset of D, then C  B is a subset
of D  B
  A  B  B  A  B (same as opening)
20
Application: Noise Removal
 Similar in concept to the spatial filtering
 Let’s take a look at the fingerprint image
corrupted by noise.
 What morphological operations can be done
to remove the black and white dots?
A
B
21
Application: Noise Removal
22
Hit-or-Miss Transformation
 A powerful method for finding objects of a specific
shape in an image.
 Only need erosion.
 Now consider set A below, and we want to find
subset X using structuring element B, the same as X
23
Hit-or-Miss Transformation: Example
Step 1
Step 2
Final
24
Summary
 Morphological operations:
 Dilation
 Erosion
 Opening (erosion then dilation)
 Closing (dilation then erosion)
 Morphological algorithm
 Hit-or-Miss transform
25