Morphological Image Processing
Morphological Image Processing
1
Mathematic Morphology
used to extract image components that are
useful in the representation and description of
region shape, such as
boundaries extraction
skeletons
convex hull
morphological filtering
thinning
pruning
2
Z2 and Z3
set in mathematic morphology represent
objects in an image
binary image (0 = white, 1 = black) : the
element of the set is the coordinates (x,y)
of pixel belong to the object Z2
gray-scaled image : the element of the set
is the coordinates (x,y) of pixel belong to the
object and the gray levels Z3
3
Image is represented =
by a set I {( x, y ) /( x, y) ∈ R } 2
A
=A {=
( x, y ) / I ( x, y ) 1}
This is called Binary Image Morphology.
The value of ‘z’ is important as it gives the gray value, (x, y) gives the gray
point.
4
Basic Set Theory
5
Reflection and Translation
Bˆ = {w | w ∈ −b, for b ∈ B}
( A) z = {c | c ∈ a + z , for a ∈ A}
6
B (0,0)
(1) Reflection Operation:
Reflection of ‘B’ is given by,
B̂
=Bˆ {( x, y) /(− x, − y) ∈ B} (0,0)
7
Logic Operations
8
Example
9
Structuring element (SE)
small set to probe the image under study
for each SE, define origo
shape and size must be adapted to geometric
properties for the objects
10
Structuring Element:
Structuring element
Entire image
A
X
x
11
Basic idea
For each pixel in binary image:
check if SE is ”satisfied”
output pixel is set to 0 or 1 depending on
used operation
12
Basic morphological operations
Erosion
Dilation
Opening object
Closening background
13
Increases the object size
A= Object and B= Structuring element
∧
B and A overlap by at least one element.
B = structuring element
A ⊕ B = {z|(Bˆ )z ∩ A ≠ Φ}
15
Dilation
16
Dilation
17
Why Dilation?
If there is a very small object, say (hole) inside the object ‘A’, then
this unfilled hole inside the object is filled up.
Small disconnected regions outside the boundary may be connected
by dilation.
Irregular boundary may be smoothened out.
Properties of Dilation:
1. A ⊕ B = B ⊕ A
2. A ⊕ ( B ⊕ C ) = ( A ⊕ B) ⊕ C
3. ( A ⊕ B) x =Ax ⊕ B Dilation is translation invariant.
18
Dilation : Bridging gaps
19
Decreases the object size
20
Erosion
A − B = {z|(B)z ⊆ A}
21
Erosion
22
Erosion
23
Advantages:
Properties of Erosion:
( )
C
A⊕ B
ˆ =AC ΘB 24
∧
( AΘB) = A ⊕ B
C C
{ z /( B)Z ⊆ A}
C
Since ( AΘB=
C
)
{ }
C
ϕ as ( B) Z is completely
= z /( B) Z ∩ A =C
ϕ
inside A. So, ( B) Z ∩ AC =
{
= z /( B) Z ∩ AC ≠ ϕ }
∧
∴ ( AΘB) = A ⊕ B
C C
∧
and ( A ⊕ B)C =AC ΘB
25
useful
erosion
removal of structures of certain shape and
size, given by SE
Dilation
filling of holes of certain shape and size,
given by SE
26
Opening
erosion followed by dilation, denoted ∘
A B = ( A − B) ⊕ B
eliminates protrusions (projecting out from something)
breaks necks
smoothes contour
( A B) B = A B
27
Opening
28
Opening
29
Opening
A B = ( A − B) ⊕ B
A B = ∪{( B ) z | ( B) z ⊆ A} 30
Closing
dilation followed by erosion, denoted •
A • B = ( A ⊕ B) − B
smooth contour
fuse narrow breaks and long thin gulfs
eliminate small holes
fill gaps in the contour
31
Closing Operation:
Dilation followed by erosion. A • B = ( A ⊕ B ) ΘB
After Dilation operation, the size of the object is increased and it is brought
back to the original size by erosion operation.
Closing
⇒
Object A Structuring
Element B
32
Closing
33
Closing
34
Closing
A • B = ( A ⊕ B) − B
35
Properties
Opening
(i) A°B is a subset (subimage) of A
(ii) If C is a subset of D, then C °B is a subset of D °B
(iii) (A °B) °B = A °B
Closing
(i) A is a subset (subimage) 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
( A • B) = ( A Bˆ )
c c
37
38
Useful: open & close
39
Application: filtering
40
Hit-or-Miss Transformation
⊛ (HMT)
find location of one shape among a set of shapes
”template matching
A ∗ B = ( A − X ) ∩ [ A − (W − X )]
c
42
Boundary Extraction
β ( A) = A − ( A − B)
43
Example
44
Thinning Operation:
This gives the image as single pixel width line
Thinning
Object
Skeletonizing
Object
Thinning operator A ⊗ B = A − ( A∗ B) 45
Thinning
A ⊗ B = A − ( A ∗ B)
= A ∩ ( A ∗ B) c
46
Thickening
A • B = A ∪ ( A ∗ B)
47
Skeletons
Obtained from thinning or skeletonizing processes
49
K
S ( A) = ∪ S k ( A)
Skeletons k =0
S k ( A) = ( A − kB) − ( A − kB) B
K = max{k | ( A − kB) ≠ Φ}
K is the last iterative step before A erodes to an empty set.
Reconstruction of A :
K
A = ∪ ( S k ( A) ⊕ kB)
k =0
50
51
5 basic structuring elements
52
53
Dilation at a point (s,t) of f with b:
( f ⊕ b )(=
s, t ) max { f ( s − x, t − y ) + b ( x, y ) , s − x, t − y ∈ D f , ( x, y ) ∈ Db }
We can also write like convolution i.e f ( x, y ) + b ( s − x, t − y )
Here mask is rotated. When mask is placed over the object from overlapping
pixels, maximum value is considered..
Applications:
1. Pepper noise can be removed.
2. Size of the image is also changed because of dilation.
54
Erosion operation:
( f Θb )(=
s, t ) min { f ( s + x, t + y ) − b ( x, y ) , s + x, t + y ∈ D f , ( x, y ) ∈ Db }
Since it is minimum operation, bright details will be reduced.
Subtract values from f.
Application: salt noise is removed.
55
Closing operation: dilation followed by erosion.
f •b = ( f ⊕ b ) Θb
It removes pepper noise by keeping intensity approximately constant.
f b = ( f Θb ) ⊕ b
It removes the salt noise and at the same time brightness level is maintained.
(Keeping the intensity approximately constant)
56