Title: Morphological Image Processing
1Morphological Image Processing
- Preliminaries
- Applications
- -- extracting image components for region
shape representation and description, e.g.,
boundary, skeleton, structure, etc. - -- image post pre-processing, e.g.,
morphological filtering, thinning and pruning. - Set theory the language of mathematical
morphology
2Preliminary
- Set theory
- -- If a(a1, a2) is an element of A (A is a set
in 2D integer space Z2), then a ?A - Example A a, a(x,y) coordinates of
pixels - If b is not an element of A, then b ?A
3Preliminary (contd)
- Relationship of set A and set B
- (a) A ? B
- A is a set of B (any element in A is also the
element of B) - (b) C A ?B
- Union of two sets A and B (all elements belong
to either A, B or both) - (c) D A? B
- Intersection of two sets A and B (all elements
belong to both A and B)
4Preliminary (contd)
- Relationship of set A and set B (contd)
- (d) A? B ?
- Disjoint or mutually exclusive (no common
elements) - (e) Ac w w ?A
- Complement of A (set of elements not contained
in A) - (f) A-B ww ?A, w ?B A ? Bc
- Difference of two sets A and B (set of
elements that belong to A, but not to B)
5Preliminary (contd)
- Relationship of set A and set B (contd)
- (g) (B) w w -b for b ? B
- reflection of set B
- (h) (A )z c c az, for a ? A
- translation of set A by point z (z1, z2)
- (f) A-B ww ?A, w ?B A ? Bc
- Difference of two sets A and B (set of
elements that belong to A, but not to B)
6Preliminary (contd)
- Logic operation on Binary images
- -- principal logic operations
- AND, OR, NOT (complement), XOR (exclusive
OR), - NOT-AND (not(A) AND (B))
- -- Logic operations are performed on a
pixel-by-pixel basis between corresponding pixels
of two or more images - -- Note
- - set operation is a pixel-coordinates
operation geometrically - - logic operation is a pixel-value operation.
7Dilation on Binary Image
- Binary dilation of A by B (A and B are
two sets in space Z2) - -- Definition 1
- A ? B Z (B)z? A
?? - - B is called structuring element. (B)z is the
operation as follow - First, reflecting B about its origin Second,
shifting this reflection (B) by Z - - Dilation of A by B is the set of all
displacements (Z), which satisfies the following
condition (B) and A are overlapped by at least
one element. - - We can rewrite the definition as A ? B Z
(B)z? A ?A -
8Dilation on Binary Image (contd)
- Binary dilation of A by B (contd)
- -- Definition 2 (Minkowsky addition of two
sets A and B) - A ? B Ub ?B (A)b
- - Example
- (A)x translation (shift) of a set A by a
point x - A a
- (A)x ax a? A
-
(A)x
A
x
9Dilation on Binary Image (contd)
- Binary dilation of A by B (contd)
- -- Example of dilation
- A (0,1), (1,1), (2,1), (2,2), (3,0)
- x (0,1)
A
(A)x
x
Origin of domain
10Dilation on Binary Image (contd)
- Binary dilation of A by B (contd)
- -- Example of dilation
-
A
A ? B
B
Origin of domain
11Dilation on Binary Image (contd)
- Binary dilation of A by B (contd)
- -- Example of dilation
- A a, Bb, A ? B Ub ?B (A)b
-
- B(4,1), (5,1), (5,2), A ? B (A) (4,1) U
A(5,1) U A(5,2)
A ? B
A
B
12Dilation on Binary Image (contd)
- Binary dilation of A by B (contd)
- -- Example of dilation
-
A ? B
d
A
d
B
d/4
d/4
d/8
13Dilation on Binary Image (contd)
- Property of Binary dilation
- (A)x ? B (A ? B)x
-
- A? C ? A ? B ? C ? B
-
- A ? B B ? A
- A ? (B ? C) (A ? B) ? C
- (A ? B) ? C ? (A ? C) ? (B ? C)
- (A ? B) ? C (A ? C) ? (B ? C)
14Erosion on Binary Image
- Binary erosion of A by B (A and B are
two sets in space Z2) - -- Definition 1
- A B Z (B)z ?
A - the result is a set of points Z which satisfies
following condition - B shifted by Z is contained in A
- - Definition 2
- A B ? b?B (A)-b
- Minkowsky subtraction of two sets A and B
- ? b?B (A)b
15Erosion on Binary Image (contd)
- Binary erosion of A by B (contd)
- -- Example of Minkowsky subtraction
A
B
16Erosion on Binary Image (contd)
- Binary erosion of A by B (contd)
- -- Example of erosion
A
A B Z BZ ? A
B
17Erosion on Binary Image (contd)
- Binary erosion of A by B (contd)
- -- Example of erosion
A B Z BZ ? A
A
B
18Erosion on Binary Image (contd)
- Binary erosion of A by B (contd)
- -- Example of erosion
-
A B
A
B
Origin of domain
19Erosion on Binary Image (contd)
- Binary erosion of A by B (contd)
- -- Example of erosion
-
A B
d
A
d
B
d/4
d/4
d/8
20Erosion on Binary Image (contd)
- Property of Binary erosion
- (A)x B (A B)x
-
- A? C ? A B ? C B
-
- A? B ? D A ? D B
-
- (A ? B) C (A C) ? (B C)
- Duality (A B)c (Ac ? B)
21Opening and Closing
- Dilation
- - expanding image
- Erosion
- - shrinking image
- Opening
- - smoothing contour, removing isolated
noise, breaking bridge - Closing
- - fusing breaks, filling gaps, removing
holes
22Opening and Closing (contd)
- Definition
- Opening
- A ? B (A B) ? B
-
- Closing
- A? B (A ? B) B
- Duality (A ? B)c (Ac ? B)
-
- A ? B (Ac ? B)c
23Opening and Closing (contd)
- Example
- Opening
- A ? B
(A B) ? B -
A
Translate of B in A
B
24Opening and Closing (contd)
- Example
- Closing
-
A? B (A ? B) B -
A
B
25Opening and Closing (contd)
- Property
- Opening
- A B ? A
- C ? D ? C ? B ? D ? B
- (A B) B A B
-
- Closing
- A ? A B
- C ? D ? C B ? D B
- (A B) B A B
26Opening and Closing (contd)
-- Example of opening
A ? B
A
B
27Hit-or-miss transformation
-- Shape detection -- Using two structure
elements
W - X
At least one pixel width
X
Structure element II complement of X with
respect to W
Structure element I
28Hit-or-miss transformation (contd)
-- The match (or fit) of B in A is called
hit-or-miss transform, denoted A ? B -- B is
composed of X and W-X A ? B (A
X) ? Ac (W-X)
W - X
X
29Hit-or-miss transformation (contd)
- General notation
- structure element B (B1, B2)
-
- e.g., B1 X (object)
- B2 W-X (background)
- A ? B (A B1) ? Ac
B2 - This set contains all the (origin) points,
at which, B1 found a match - (hit) in A and B2 found a match in Ac,
simultaneously.
30Hit-or-miss transformation (contd)
- Hit-or-miss definition by set difference
- A ? B (A B1) - A ? B2
- Note
- Hit-or-miss is the object match plus
background match
31Hit-or-miss transformation (contd)
- Example of Hit-or-miss
-
- X ? T X T1x ? X, T2x ? Xc
X
hit
miss
T
T1 T2
X ? T
X
X ? T
T
T1 T2
32Applications of Morphological algorithm
- Boundary extraction
- Boundary(A) A
(A B) - Region filling
- - given a set A which defines a
region boundary - - start with a non-boundary point
P within the region - - let X0 P
- - Xk (Xk-1 ? B ) ? Ac, k
1,2,3, - - iteration at each step k
- - terminate if Xk Xk-1
- Note A ? Xk includes the filled set and the
boundary
33Applications of Morphological algorithm (contd)
- Connected component extraction
- - similar to the region filling
- - start with a point P which is contained
in A - - let X0 P
- - Xk (Xk-1 ? B ) ? A, k 1,2,3,
- - iteration at each step k
- - terminate if Xk Xk-1
-
34Applications of Morphological algorithm (contd)
- Convex hull extraction
-
- - set A is convex if any line ab? A (a?A,
b?A)
a
a
b
b
convex
concave
- convex hull H of an arbitrary set S is the
smallest convex set - which contains S
35Applications of Morphological algorithm (contd)
- Convex hull extraction (contd)
-
- - Example of detection of convex hull of
set A -
- Given a set A and four structure
elements B1,B2,B3,B4 - calculate the convex hull region C(A)
D1 ?D2 ?D3?D4 - where
- Di is derived from Xik (Xik-1 ? Bi
) ? A - (i1,2,3,4), (k1,2,)
-
- Di Xik when Xik Xik-1
- Initial Xi0 A
36Applications of Morphological algorithm (contd)
- Thinning
-
- - peel from outside into inside,
which is defined in terms of - the hit-or-miss transform
-
- A ? B A (A ? B)
- B B1, B2,, Bn
- A ?B (((A ? B1) ? B2)) ? Bn)
-
37Applications of Morphological algorithm (contd)
- Thickening
-
- - The structure element B is similar to
the structure element for thinning, except that
1s and 0s are exchanged. - - morphological dual of thinning
- A ? B A ?(A ? B)
- B B1, B2,, Bn
-
- - Alternative algorithm
- To thicken a set A, we can also
- - apply thinning algorithm on Ac,
- - obtain region R
- - then take Rc as the thickening
result
38Applications of Morphological algorithm (contd)
- Skeletons
- - skeletons can be implemented by the
operations of erosions and - openings
-
- S(A) Uk0K(Sk(A))
-
- Sk(A) (A kB) (A kB) ? B
- A kB (((A B) B))
B) -
- K maxk (A kB) ??
39Applications of Morphological algorithm (contd)
- Pruning
- - it is complement to thinning and
skeletonizing algorithm - - example hand-writing recognition
- - X A ? B
- - Ending points detection
- - Dilation of ending points ?
obtain Y - - X U Y
-
40Morphology in gray-scale image
- Dilation
-
- (f ? b)(s,t) maxf(s-x, t-y) b(x,y)
(s-x), (t-y) ? Df , (x,y) ? Db - Where
- Df - domain of f
- Db - domain of b
41Morphology in gray-scale image (contd)
- Erosion
- (f b)(s,t) minf(sx, ty) - b(x,y)
(sx), (ty) ? Df , (x,y) ? Db - Where
- Df - domain of f
- Db - domain of b
- Property
- Dilation will generate brighter image and
reduce smalldark details - Erosion will generate darker image and reduce
smallbright features -
42Morphology in gray-scale image (contd)
- Opening
- f ? b (f b) ? b
- Closing
- f b (f ?b ) b
43Morphology in gray-scale image (contd)
- Example of opening and closing
f b
f
b
b
f
f b
44Morphology in gray-scale image (contd)
- Applications
- - Smoothing
- - example opening closing for
removing noise - - Morphological gradient
- - example g (f ? b) - (f b)
- - Top-hat transform
- - example h f (f b)
- - Texture segmentation
- - example closing opening
thresholding