You are on page 1of 27

1

ECE533 Digital Image Processing


Morphological Image
Processing
2
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Morphology
Morphology
The branch of biology that deals with the form
and structure of organisms without
consideration of function
Mathematical Morphology
Mathematical tool for processing shapes in
image, including boundaries, skeletons, convex
hulls, etc.
Use of set theoretical approach
3
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Set Theory: Definitions and Notations
SET (O)
A collection of objects
(elements)
membership (e)
If e is an element (member)
of a set O, we write e e O
Subset (c)
Let A, B are two sets. If for
every a e A, we also have a e
B, then the set A is a subset
of B, that is, A c B
If A c B and B c A, then A =
B.
Empty set (C)
Complement set
If A c O, then its
complement set A
c
= {e| e e
O, and eeA}
Union ()
A B = {e| e eA or e eB}
Intersection ()
A B = {e| e eA and e eB}
Set difference (-)
B\A = B A
c

Note that B-A =A-B
Disjoint sets
A and B are disjoint
(mutually exclusive) if A
B= C
4
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Set Relations
5
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Translation and Reflection
Translation (A)
z
= { c| c = a + z, for a eA }

Reflection:

{ } B b b w w B e = = for , |

6
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Logic Operations Between Binary Images
7
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Dilation and Erosion
Dilation
B: structure element


Erosion
A B = {z | (B)
z
_ A}
Relations
(A B)
c
=

( ) { }
( ) | | { } A A B z
A B z B A
z
z
e =
C = =

c
A B
8
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Example of Dilation
9
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Example of Erosion
10
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Opening
A B = (A B) B
11
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Closing
A - B = (A B) B
12
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Example: Opening & Closing
13
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Finger Print Processing using Opening and
Closing
14
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Hit-or-Miss Transformation
for shape detection
Figure 9.12 (a) Set A, (b) A window W and the local
Background of X w.r.t. W, W-X. (c) A
c
. (d) AOX
Intersection of (d) and (e) shows the location
of the origin of X, as desired.
(d)
(e)
A
15
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Hit-or-Miss Transform
Denote B
1
: object, B
2
: local background of B
1
, then,


or


Reason to have a local background:
Two or more objects are distinct only if they form
disjoint (disconnected) sets. This is guaranteed by
requiring that each object have at least a one-pixel-thick
background around it.
16
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Hit-or-Miss Transform
Previous example does
not contain dont care
entries.
In structure element
1 foreground
0 background
X dont care
Output is 1 if exact
match of both
foreground and
background pixels.
Hitnmiss.m
+1: foreground
-1: background
0: dont care

Hitnmiss.m
match not :
match :
(
(
(

=
(
(
(



(
(
(


(
(
(

=
(
(
(


(
(
(


1 1 1
0 1 0
1 1 1
1 1 1
1 1 1
1 1 1
* .
1 1 1
0 1 0
1 1 1
1 1 1
0 1 0
1 1 1
1 1 1
1 1 1
1 1 1
* .
1 1 1
0 1 0
1 1 1
17
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Morphological Boundary Extraction
|(A) = A (A B) (9.5-1)
18
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Example of Boundary Extraction
19
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Region Filling
( )
A X Y
k
A B X X
k
c
k k
=
=
=

, 3 , 2 , 1
;
1
Fig915.m
20
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Region Filling Example
21
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Connected Component Extraction
Y: connected component
in set A,
p: a known point in Y

( )
k
k k
k k
X Y
X X
A B X X
p X
=
=
=
=

then
if
1
1
0
Fig915.m
22
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Thinning


Thinning is often accomplished using
a sequence of rotated structuring
elements (a). Given a set A (b),
results of thinning with first element
is shown in (c), and the next 7
elements (d) (i). There is no
change between 7
th
and 8
th

elements, and no change after first 3
elements. Then it converges to a m-
connectivity.
( )
{ } { }
{ } ( ) ( ) ( )
n
n
B B B A B A
B B B B
B A hitnmiss A B A
=
=
=

2 1
2 1
, ,
,
Fig921.m
23
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Thickening
AB = A hitnmiss(A,B)
A{B} =(((AB
1
) B
2
) B
n
)

Thickening is the dual of thinning
operation. Usually, thickening a set
A is accomplished by thinning A
c
,
and then complement the result.
Then a post-processing prunning
process is applied to remove
disconnected points as shown to
the left.
24
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Skeleton
A skeleton of a set A consists of
points z that is the center of a
maximum disk
A maximum disk is a circle in A
that can not be enclosed by
another circle that is also in A.
Figure 9.23. (a) set A, (b), (c) sets
of possible maximum disks. (d)
dotted line is the skeleton.
25
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Skeleton Equations
1
0
( ) ( ) (9.5-11)
( ( ) ) (9.5-15)
K
k
k
K
k
k
S A S A
A S A kB
=
=
=
=
Define k consecutive erosions of A as:
AkB = ( (AB)B) )B) (9.5-13)
S
k
(A) = (AkB) (AkB)B (9.5-12)
Let K = max{k | (AkB) =C} (9.5-14)
Then the skeleton can be found as:
26
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Illustration of Skeleton Computation
Figure 9.24 Implementation of eq.
(9.5-11)-(9.5-15). The original set is
at the top left and its morphological
skeleton is at the bottom of the 4
th

column. The reconstructed set is at
the bottom of the 6
th
column.

Define k consecutive erosions of A as:
AkB = ( (AB)B) )B)
(9.5-13)
Sk(A) = (AkB) (AkB)B
(9.5-12)
Let K = max{k | (AkB) =C}
(9.5-14)
Then the skeleton can be found as:

1
0
( ) ( ) (9.5-11)
( ( ) ) (9.5-15)
K
k
k
K
k
k
S A S A
A S A kB
=
=
=
=
27
ECE533 Digital Image Processing
(c) 2003-2006 by Yu Hen Hu
Pruning

You might also like