Professional Documents
Culture Documents
Morphology
Idea of MM
• Mathematical Morphology
– Combines two ideas
• Morphology part
– The study of shape
• Mathematical part
– Refers to the use of “Set Theory”
1
A tuple is a fixed fixed-
length list containing
Example
Binary Image
01 23 45
0
1
2
3
4
5
2
Basic Definitions
• Let A and B be sets in Z2
• with components a=(a1, a2) and b=(b1,b2), respectively
( A) x = {c | c = a + x, for a ∈ A}
Basic Definitions
• The reflection of B, denoted by B^ is
defined as:
Bˆ = {x | x = −b, for b ∈ B}
• The complement of set A is:
Ac = {x | x ∉ A}
3
Basic Definitions
• The difference of two sets A and B,
denoted by A-B, is defined by:
A − B = {x | x ∈ A, x ∉ B} = A ∩ B c
Example
Translation Reflection
Difference
4
Dilation Operator
• With A and B as sets in Z2 and denoting the empty set,
the dilation of A by B, denoted by A ⊕ B is defined as:
A ⊕ B = {x | ( Bˆ ) x ∩ A ≠ φ }
or
A ⊕ B = {x | ( Bˆ ) x ∩ A ⊆ A}
Dilation
• Process consists of obtaining the reflection of B,
about its origin
5
Example
Erosion
• For sets A and B in Z2, the erosion of A by
B, denoted by A B, is defined by:
A B = {x | ( B ) x ⊆ A}
6
Example
( A B ) c = Ac ⊕ Bˆ
7
Duality Proof
• Proof
( A B ) c = {x | ( B) x ⊆ A}c
If set ( B ) x is contained in set A, then ( B ) x ∩ A c = φ ,
in which case the preceding equation becomes
( A B ) c = {x | ( B ) x ∩ Ac = φ }c
Duality Proof
But the complement of the set of x' s that satisfy
( B ) x ∩ A c = φ , is the set of x' s such that ( B ) x ∩ A c ≠ φ
• thus
( A B ) c = { x | ( B ) x ∩ Ac ≠ φ }
= Ac ⊕ Bˆ
8
Dilation and Erosion
• Dilation
– expands an image
• Erosion
– shrinks an image
Opening
• The opening of set A, by structuring
element B is:
A o B = ( A B) ⊕ B
9
Example
Closing
• The closing of set A, by structuring
element B is:
A • B = ( A ⊕ B) B
10
Example
Geometric Interpretation
• Opening
– can be considered a geometric fitting
problem
– it is the union of all translates of B that
fit into A
A o B = U{( B ) x | ( B ) x ⊂ A}
11
Example
Geometric Interpretation
• Alternative Interpretation
• Opening
– If you are painting A, using a brush
shaped like B, then the opening is all the
points that you can paint.
12
Geometric Interpretation
• Closing
– If you are painting the outside of A (ie,
you are paint Ac), it is all the points you
cannot paint.
Example
A Ac
Example
13
Interesting Property
• Like dilation and erosion, opening and closing are
duals with respects to set complementation and
reflection
( A • B ) c = Ac o Bˆ
• CLOSING
(i) A is a subset of A • B
(ii) If C is a subset of D, then C • B is a subset of D • B
(iii) (A • B) • B = (A • B)
14
Filters: Closing of the Opening
Hit-or-Miss Transform
• Basic tool for shape detection
• Construct two elements
– X and (W-X) where W is window
slightly larger than X
– Our goal is to find X in the image
• Solution
A * B = (A X ) ∩ ( Ac [W-X] )
15
Hit-or-Miss Transform
Hit-or-Miss Transform
• Original
A * B = (A X ) ∩ ( Ac [W-X] )
• New notation
• Let B1 = X and B2= (W-X)
A * B = ( A B1 ) − ( A ⊕ Bˆ 2 )
16
Hit-or-Miss Transform
• Alternative Usage
– B1 and B2 are two (distinct) structuring
elements
A* B = (A B1 ) ∩ ( A c B2 )
• is therefore-
– all the points that B1 hits in A
• AND
– all the points that B2 hits in Ac (misses in A)
Hit-or-Miss Transform
• For a normal structuring element used by
dilation or erosion, zeros are ignored
– For example:
0 1 0
1 1 1
0 1 0 Ignore these
17
Hit-or-Miss Transform
• Example 1
1
x
0
x
x
1 x x
1 x x
A Ac
B= 1 0 x
1 x x
* * * *
* * * * * *
* *
* *
A B1 Ac B2 A*B
18
Hit-or-Miss Transform
• Using ‘x’, ‘0’, and ‘1’ is a common way
of denoting hit-or-miss structuring
elements
• Boundary extraction
β ( A) = A − ( A B)
19
Region Filling
• Let A denote a set with a N_8 connected boundary
X k = ( X k −1 ⊕ B ) ∩ Ac k = 1,2,3,....
– Algorithm terminates when Xk = Xk-1
20
Region Filling
• The repeated dilation of region filling
would fill the entire image
X k = ( X k −1 ⊕ B ) ∩ A k = 1,2,3,...
– Algorithm terminates when Xk = Xk-1
Side Note: Recall that MM routines often take a variable, N, denoting the number of times to
apply the operator. If N=inf, this generally means stop when Xk = Xk-1 (that is, terminate
when the image stops changing)
21
Example
Convex Hull
• Let C(A) be the convex hull of A
• Let Bi, i=1,2,3,4, represent four structuring
elements
• Let
22
Convex Hull
• Now, let Di = Xiconv where “conv” means Xi
has converged
X i k = X i k −1
Example
23
Thinning
• Thinning of A by structuring element
B is defined as:
A ⊗ B = A − ( A * B)
= A ∩ ( A * B)c
• Let B = {B} = {B1, B2, B3, . . . . , Bn}
Thinning
• B is a set of structuring elements
A ⊗ {B} = ((K (( A ⊗ B1 ) ⊗ B 2 ) K) B n )
24
Example of Thinning
Example of Thinning
25
Thickening
• A thickened by B is:
A B = A ∪ ( A * B)
• Easy
– To thickening set A,
– Thin set C, where C=Ac
– A B = Cc
Thickening Example
A C =AC
C⊗ B CC
Remove disconnected
components
26
Skeletons
• Skeleton extraction ,S(A), of A, using
structure element B
K
S (A) = US k ( A)
k=0
• where
K
S k (A) = U {( A kB ) − [( A kB ) o B ]}
k =0
Skeletons cont’
• B is a structuring element and (A kB), indicates k
successive erosions of A; such that
(A k B ) = (( K ( A B) B )K B )
K = max{ k | ( A kB ) ≠ φ }
27
Skeleton
Example
A S(A)
28
Pruning
• Sometimes thinning and
skeletonization leaves “spurs” or
“parasite” structures
Pruning
• 4 Steps
• First X 1 = A ⊗ {B}
– Let {B} be a sequence of structuring elements
– Apply this K times
• Second
– Find the end points of X1 8
X 2 = U ( X1 * Bk )
k =1
29
Pruning
• Third X3 = (X2 ⊕ H ) ∩ A
– Use an N8 structuring element, H
to grow the end-points K times
• Fourth
– The union of X1 and X3 is the desired results
X 4 = X1 ∩ X 3
Pruning Example
8
X 1 = A ⊗ {B} X 2 = U ( X1 *
k
*B )
k =1
(Performed 3 times)
30
X3 = (X2 ⊕ H ) ∩ A Pruning Example
(performed 3 times)
X 4 = X1 ∩ X 3
Modifications
• You can make modifications to MM
operators
31
Extension to Grayscale
• MM can be extended to grayscale image
– f is a 2D discrete function (image)
– b is a 2D discrete function (smaller image)
• Dilation
( f ⊕b)(s, t) = max{ f (s − x, t − y) + b(x, y) | (s − x),(t − y) ∈Df ; (x, y) ∈Db}
• Erosion
(f b)(s, t) = min{ f (s + x, t + y) −b(x, y) | (s + x),(t + y) ∈Df ; (x, y) ∈Db}
Extension to Grayscale
• Grayscale MM operators are very
similar to spatial domain convolution
32
Grey-Level MM Example
Dilation Erosion
1 2 2 3 2 2 1
2 2 3 4 3 2 2
B= 2
3
3
4
4
4
4
5
4
4
3
4
2
3
2 3 4 4 4 3 2
2 2 3 4 3 2 2
1 2 2 3 2 2 1
Grey Level MM
• Dilation
– Tends to brighten the image, remove dark
regions
• Erosion
– Tends to darken the image, remove bright
regions
33
Summary
• Mathematical Morphology
– image processing approach based on set theory and shape
(structuring elements)
– provides a powerful framework for many operations
– some operations can be easily expressed using MM
• such as boundary extraction
• Often used to post-process “thresholded” images
– Threshold
– Perform some MM operation (clean up noise, fill in holes)
– Result provides a nice segmented region
• ISMM
– International Symposium on Mathematical Morphology
• 3D image analysis
• Scale Spaces
34
Active Research Areas
• Revisiting old problems
– Using MM
– Old examples
• Segmentation
• Edge Detection (Using gray-level MM)
• You’ll find MM mentioned in
conjunction with other techniques
35