Chapter 4 - Clean
Chapter 4 - Clean
Chapter 4 - Clean
CHAPTER 4
Morphological
Image Processing
6 Periods
Department of Mechatronics
EIU - 2017
N.Huan Le
Chapter outcomes
• Understand basic concept and Logic Operations
Involving Binary Pixels and Images
• Understand methods to apply morphological
operations for image enhancement
• Basic morphological algorithms
• Extensions of basic morphological algorithms to
gray-scale images
N.Huan Le
Contents
• This lecture will cover:
– Preliminaries
– Dilation and Erosion
– Opening and Closing
– The Hit-or-Miss Transformation
– Some Basic Morphological Algorithms
– Extensions to Gray-Scale Images
N.Huan Le
What are Morphological
Operations?
Morphological operations come from the word “morphing”
in Biology which means “changing a shape”.
Morphing
• Union
• Intersection
N.Huan Le
Logic Operations Involving
Binary Pixels and Images
• The principal logic operations used in image
processing are: AND, OR, NOT (COMPLEMENT).
• These operations are functionally complete.
• Logic operations are preformed on a pixel by pixel
basis between corresponding pixels (bitwise).
• Other important logic operations:
XOR (exclusive OR), NAND (NOT-AND)
• Logic operations are just a private case for a binary
set operations, such: AND – Intersection , OR –
Union, NOT-Complement.
N.Huan Le
Basic Set Operations
Each set may represent one object. Each pixel (x,y) has
its status: belong to a set or not belong to a set.
N.Huan Le
Translation and Reflection
Operations
Translation Reflection
z = (z1,z2)
(A)z
B̂
N.Huan Le
Dilation Operations
N.Huan Le
Dilation Operations
A B z Bˆ z A
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
= Empty set
Dilate means “extend”
A = Object to be dilated
B = Structuring element
N.Huan Le
Dilation Operations (cont.)
Reflection
B̂
Structuring
Element (B)
N.Huan Le
Erosion Operation
N.Huan Le
Erosion Operation
A B z B z A
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
A = Object to be eroded
B = Structuring element
N.Huan Le
Erosion Operations (cont.)
Structuring
Element (B)
N.Huan Le
Erosion Operations (cont.)
Result of Erosion
Boundary of the “center pixels”
where B is inside A
N.Huan Le
Example: Application of
Dilation and Erosion
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
N.Huan Le
Opening And Closing
• Opening –
– First – erode A by B, and then dilate the result
by B
– In other words, opening is the unification of all
B objects entirely contained in A
N.Huan Le
Opening Operation
A B ( A B ) B
or
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
A B B z B z A
= Combination of all parts of A that can completely contain B
Example of Opening
N.Huan Le
Example of Opening
http://homepages.inf.ed.ac.uk/rbf/HIPR2/hipr_top.htm
N.Huan Le
Opening And Closing
• Closing –
– First – dilate A by B, and then erode the result by B
– In other words, closing is the group of points,
which the intersection of object B around them
with object A – is not empty
N.Huan Le
Closing Operation
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
A B ( A B ) B
N.Huan Le
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Example of Closing
N.Huan Le
Example of Closing
http://homepages.inf.ed.ac.uk/rbf/HIPR2/hipr_top.htm
N.Huan Le
Example: Application of
Morphological Operations
N.Huan Le
Example: Application of
Morphological Operations
Finger print
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
enhancement
N.Huan Le
The Hit-or-Miss
Transformation
http://homepages.inf.ed.ac.uk/rbf/HIPR2/hipr_top.htm
N.Huan Le
Hit-or-Miss Transformation
N.Huan Le
Example: Application of
Hit-or-Miss Transformation
N.Huan Le
Basic Morphological
Algorithms
1 – Boundary Extraction
2 – Region Filling
3 – Extraction of Connected Components
4 – Convex Hull
5 – Thinning
6 – Thickening
7 – Skeletons
N.Huan Le
Boundary Extraction
N.Huan Le
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
image
Original
β(A) A A
B
Boundary Extraction
Boundary
N.Huan Le
Example: Boundary
Extraction
N.Huan Le
Region Filling
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
N.Huan Le
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Region Filling
N.Huan Le
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
image
Original
Region Filling
N.Huan Le
Extraction of Connected
Components
• This algorithm extracts a component by selecting
a point on a binary object A
• Works similar to region filling, but this time we
use in the conjunction the object A, instead of it’s
complement
N.Huan Le
Extraction of Connected
Components
X k X k 1 B A where X0 = seed pixel p
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
N.Huan Le
Example: Extraction of Connected
Components
X-ray image
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
of bones
Thresholded
image
Connected
components
N.Huan Le
Example: Extraction of Connected
Components
N.Huan Le
Convex Hull
N.Huan Le
Convex Hull
Convex hull has no concave part.
Convex hull
Algorithm: 4
C ( A) D where i i
i
D X conv
i 1
X X k 1
i
k * B A,
i
i 1,2,3,4
N.Huan Le
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
N.Huan Le
Example: Convex Hull
N.Huan Le
Thinning
• The thinning of a set A by a structuring element B,
can be defined by terms of the hit-and-miss
transform:
N.Huan Le
Thinning (cont..)
N.Huan Le
Thinning (cont..)
A B A ( A B)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
*
c
A ( A * B)
N.Huan Le
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Example: Thinning
thinner.
Make an object
N.Huan Le
Example: Thinning
N.Huan Le
Thickening
N.Huan Le
Thickening - cont
N.Huan Le
Thickening example preview
N.Huan Le
A . B A ( A B)
*
*
N.Huan Le
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
(cont.)
Summary of Binary Morphological Operations
N.Huan Le
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
(cont.)
Summary of Binary Morphological Operations
N.Huan Le
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Elements
x = don’t care
Basic Types of Structuring
N.Huan Le
Gray-Scale Dilation
1-D Case
ff b max f ( s x ) b( x ) | ( s x ) D and x D
b
2-D Case
f b max f ( s x, t y ) b( x, y ) | ( s x ), (t y ) D f ; ( x, y ) Db
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
N.Huan Le
Gray-Scale Dilation (cont.)
Original image Reflection
Subimage of B
+
Max
Moving
window
Structuring
element B
N.Huan Le
Gray-Scale Erosion
1-D Case f b min f ( s x ) b( x ) | ( s x ) D f and x Db
2-D Case
f b min f ( s x, t y ) b( x, y ) | ( s x ), (t y ) D f ; ( x, y ) Db
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
N.Huan Le
Gray-Scale Erosion (cont.)
Original image
Subimage B
-
Min
Moving
window
Structuring
element B
N.Huan Le
Example: Gray-Scale Dilation and Erosion
Darker Brighter
f b ( f b) b
Gray-Scale Opening
N.Huan Le
Example: Gray-Scale
Opening
N.Huan Le
Gray-Scale Closing
f b ( f b) b
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
N.Huan Le
Example: Gray-Scale
Opening and Closing
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Reduce dark
Reduce white objects
objects
N.Huan Le
Gray-scale Morphological
Smoothing
Smoothing: Perform opening followed by closing
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
N.Huan Le
Morphological Gradient
g ( f b) ( f b)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
N.Huan Le
Top-Hat Transformation
h f ( f b)
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
N.Huan Le
Example: Texture
Segmentation Application
Images taken from Gonzalez & Woods, Digital Image Processing (2002)
Small
blob
2. Compute the difference between the original image and the result
after each opening operation
3. The differenced image obtained in Step 2 are normalized and used
to construct the size-distribution graph.
Size distribution
Original image graph N.Huan Le
N.Huan Le