Вы находитесь на странице: 1из 27

Morphological Image

Processing

ECE533 Digital Image Processing 1


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

ECE533 Digital Image Processing 2


(c) 2003-2006 by Yu Hen Hu
Set Theory: Definitions and Notations

 SET ()  Complement set


» A collection of objects » If A  , then its
(elements) complement set Ac = {|  
 membership () , and A}
» If  is an element (member)  Union ()
of a set , we write    » A B = {|  A or  B}
 Subset ()  Intersection ()
» Let A, B are two sets. If for » A  B = {|  A and  B}
every a  A, we also have a   Set difference (-)
B, then the set A is a subset
» B\A = B Ac
of B, that is, A  B
» Note that B-A A-B
» If A  B and B  A, then A =
B.  Disjoint sets
 Empty set () » A and B are disjoint
(mutually exclusive) if A 
B= 
ECE533 Digital Image Processing 3
(c) 2003-2006 by Yu Hen Hu
Set Relations

ECE533 Digital Image Processing 4


(c) 2003-2006 by Yu Hen Hu
Translation and Reflection

Translation (A)z = { c| c = a + z, for a A }

Reflection: Bˆ  w | w  b, for b  B

ECE533 Digital Image Processing 5


(c) 2003-2006 by Yu Hen Hu
Logic Operations Between Binary Images

ECE533 Digital Image Processing 6


(c) 2003-2006 by Yu Hen Hu
Dilation and Erosion

 Dilation
B: structure element
 
A  B  z | Bˆ  A  
z 
 z | Bˆ   A A
z

 Erosion
A  B = {z | (B)z  A}
 Relations
(A  B)c = Ac  Bˆ

ECE533 Digital Image Processing 7


(c) 2003-2006 by Yu Hen Hu
Example of Dilation

ECE533 Digital Image Processing 8


(c) 2003-2006 by Yu Hen Hu
Example of Erosion

ECE533 Digital Image Processing 9


(c) 2003-2006 by Yu Hen Hu
Opening

A  B = (A  B)  B

ECE533 Digital Image Processing 10


(c) 2003-2006 by Yu Hen Hu
Closing

A  B = (A  B)  B

ECE533 Digital Image Processing 11


(c) 2003-2006 by Yu Hen Hu
Example: Opening & Closing

ECE533 Digital Image Processing 12


(c) 2003-2006 by Yu Hen Hu
Finger Print Processing using Opening and
Closing

ECE533 Digital Image Processing 13


(c) 2003-2006 by Yu Hen Hu
Hit-or-Miss Transformation
for shape detection

(e)

(d)

Figure 9.12 (a) Set A, (b) A window W and the local


Background of X w.r.t. W, W-X. (c) Ac. (d) AX
Intersection of (d) and (e) shows the location
of the origin of X, as desired.
ECE533 Digital Image Processing 14
(c) 2003-2006 by Yu Hen Hu
Hit-or-Miss Transform

 Denote B1: object, B2: local background of B1, 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.

ECE533 Digital Image Processing 15


(c) 2003-2006 by Yu Hen Hu
Hit-or-Miss Transform

 Previous example does  Hitnmiss.m


not contain don’t care » +1: foreground
entries. » -1: background
 In structure element » 0: don’t care
» 1 – foreground
» 0 – background
» X – don’t care
 1  1  1  1  1  1 1 1 1
 Output is 1 if exact  0 1 0 . *  1 1  1  0
     1 0 : match
match of both  1 1 1   1 1 1  1 1 1
foreground and  1  1  1  1  1  1 1 1 1
background pixels.  0 1 0 . *  1  1  1  0
      1 0 : not match
 1 1 1   1 1 1  1 1 1

(c) 2003-2006 by Yu Hen Hu ECE533 Digital Image Processing Hitnmiss.m 16


Morphological Boundary Extraction

(A) = A − (A  B) (9.5-1)
ECE533 Digital Image Processing 17
(c) 2003-2006 by Yu Hen Hu
Example of Boundary Extraction

ECE533 Digital Image Processing 18


(c) 2003-2006 by Yu Hen Hu
Region Filling

X k   X k 1  B   Ac ;
k  1, 2, 3, 
Y  Xk  A

ECE533 Digital Image Processing Fig915.m 19


(c) 2003-2006 by Yu Hen Hu
Region Filling Example

ECE533 Digital Image Processing 20


(c) 2003-2006 by Yu Hen Hu
Connected Component Extraction

Y: connected component
in set A,
p: a known point in Y
X0  p
X k   X k 1  B   A
if X k  X k 1
then Y  X k

ECE533 Digital Image Processing Fig915.m 21


(c) 2003-2006 by Yu Hen Hu
Thinning

A  B  A  hitnmiss  A, B 
B  B1 , B 2 ,  B n 
A  B  A  B1  B 2   B n 

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 7th and 8th
elements, and no change after first 3
elements. Then it converges to a m-
connectivity.

ECE533 Digital Image Processing Fig921.m 22


(c) 2003-2006 by Yu Hen Hu
Thickening

AB = A hitnmiss(A,B)
A{B} =((…(AB1) B2) … Bn)

Thickening is the dual of thinning


operation. Usually, thickening a set
A is accomplished by thinning Ac,
and then complement the result.
Then a post-processing prunning
process is applied to remove
disconnected points as shown to
the left.

ECE533 Digital Image Processing 23


(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.

ECE533 Digital Image Processing 24


(c) 2003-2006 by Yu Hen Hu
Skeleton Equations

 Define k consecutive erosions of A as:


AkB = ( …(AB)B) …)B) (9.5-13)
Sk(A) = (AkB) − (AkB)B (9.5-12)
 Let K = max{k | (AkB) } (9.5-14)
Then the skeleton can be found as:
K
S ( A)  S k ( A) (9.5-11)
k 1
K
A ( S k ( A)  kB ) (9.5-15)
k 0

ECE533 Digital Image Processing 25


(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 4th
column. The reconstructed set is at
the bottom of the 6th column.

Define k consecutive erosions of A as:


AkB = ( …(AB)B) …)B)
(9.5-13)
Sk(A) = (AkB) − (AkB)B
(9.5-12)
Let K = max{k | (AkB) }
(9.5-14)
Then the skeleton can be found as:

K
S ( A)  S k ( A) (9.5-11)
k 1
K
A ( S k ( A)  kB) (9.5-15)
k 0

ECE533 Digital Image Processing 26


(c) 2003-2006 by Yu Hen Hu
Pruning

ECE533 Digital Image Processing 27


(c) 2003-2006 by Yu Hen Hu

Вам также может понравиться