Digital Image Processing
Chapter 7:
Morphological Image Processing
What are Morphological Operations?
Morphology : a branch of biology that deals with the form
and the structure of animals and plants
Mathematical morphology : a tool for extracting image
components that are useful in the representation and
description of region shape, such as boundaries,
sleketons, and the convex hull.
The language of mathematical morphology is set theory :
Sets represent objects in an image
Ex) the set of all black pixels in a binary image, the set
is in 2-D integer space Z2
What are Morphological Operations?
Morphological operations come from the word “morphing”
in Biology which means “changing a shape”.
Morphing
Image morphological operations are used to manipulate
object shapes such as thinning, thickening, and filling.
Binary morphological operations are derived from
set operations.
Basic Set Operations
Concept of a set in binary image morphology:
Each set may represent one object. Each pixel (x,y) has
its status: belong to a set or not belong to a set.
Translation and Reflection Operations
Translation Reflection
Logical Operations*
*For binary images only
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Dilation Operations
A = Object to be dilated
B = Structuring element
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Dilation Operations (cont.)
Reflection Bˆ
Structuring
Element (B)
Original image (A) Intersect pixel Center pixel
Dilation Operations (cont.)
Result of Dilation
Example: Application of Dilation
“Repair” broken characters
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Erosion Operation
Erosion means “trim”
A = Object to be eroded
B = Structuring element
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Erosion Operations (cont.)
Structuring
Element (B)
Original image (A) Intersect pixel Center pixel
Erosion Operations (cont.)
Result of Erosion
Boundary of the “center pixels”
where B is inside A
Example: Application of Dilation and Erosion
Remove small objects such as noise
Duality Between Dilation and Erosion
Opening Operation
Opening eliminates narrow and small details and corners.
Example of Opening
Closing Operation
A• B = (A B) B
Closing fills narrow gaps and notches
Example of Closing
Duality Between Opening and Closing
Example: Application of Morphological Operations
Finger print
enhancement
Hit-or-Miss Transformation
Hit-or-Miss Transformation (cont.)
Boundary Extraction
β(A) = A − A B
Original Boundary
image
Region Filling
X k = X k −1 B A
c
where X0 = seed pixel p
Original Results of region filling
image
Extraction of Connected Components
X k = (X k −1 B ) A where X0 = seed pixel p
Example: Extraction of Connected Components
X-ray image
of bones
Thresholded
image
Connected
components
Convex Hull
Convex hull H=C(A) has no concave part.
A ➔Convex hull C(A)
4
Algorithm: C( A) = D i where Di = X conv
i
i=1
X ki = (Xk−1 * Bi ) A, i = 1,2,3,4
Example: Convex Hull
(Images from Rafael C.
Gonzalez and Richard E.
Wood, Digital Image
Processing, 2nd Edition.
Thinning
A B = A − ( A * B)
= A ( A * B)c
A B= ((...(( A B1 ) B2 )...) Bn )
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Example: Thinning
Make an object
thinner.
(Images from Rafael C.
Gonzalez and Richard E.
Wood, Digital Image
Processing, 2nd Edition.
Thickening
Make an object thicker
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Skeletons
Dot lines are
skeletons of this
structure
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Skeletons (cont.)
with Sk ( A) =( A kB) ( A kB) B
where ( A kB) = (...( A B) B) ...) B
k times
and K = maxk (A kB)
Skeletons
(Images from Rafael C.
Gonzalez and Richard E.
Wood, Digital Image
Processing, 2nd Edition.
Pruning
X1 = A B = thinning
8
X 2 = ( X 1 * B ) = finding end points
k
k=1
X 3 = ( X 2 H ) A = dilation at end points
X 4 = X1 X 3 = Pruned result
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Example: Pruning
Summary of Binary Morphological Operations
(Tables from Rafael C.
Gonzalez and Richard E.
Wood, Digital Image
Processing, 2nd Edition.
Summary of Binary Morphological Operations (cont.)
(Tables from Rafael C.
Gonzalez and Richard E.
Wood, Digital Image
Processing, 2nd Edition.
Summary of Binary Morphological Operations (cont.)
(Tables from Rafael C.
Gonzalez and Richard E.
Wood, Digital Image
Processing, 2nd Edition.
Summary of Binary Morphological Operations (cont.)
(Tables from Rafael C.
Gonzalez and Richard E.
Wood, Digital Image
Processing, 2nd Edition.
Basic Types of Structuring Elements
x = don’t care
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Gray-Scale Dilation
1-D Case f b = max f (s − x) + b(x) | (s − x) D f and x Db
2-D Case f b = max f (s − x, t − y) + b( x, y) | (s − x),(t − y) D f ;( x, y) Db
Gray-Scale Dilation (cont.)
Original image Reflection
Subimage of B
+
Max
Moving
window
Structuring
element B
Note: B can be any shape and
subimage must have
the same shape as
reflection of B. Output image
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
Gray-Scale Erosion (cont.)
Original image
Subimage B
-
Min
Moving
window
Structuring
element B
Note: B can be any shape and
subimage must have
the same shape as B.
Output image
Example: Gray-Scale Dilation and Erosion
Original image After dilation
Darker Brighter
After erosion
Gray-Scale Opening
Opening cuts peaks
Gray-Scale Closing
f • b =( f b) − b
Closing fills valleys
Example: Gray-Scale Opening and Closing
Original image After opening After closing
Reduce dark
Reduce white
objects
objects
Gray-scale Morphological Smoothing
Smoothing: Perform opening followed by closing
Original image After smoothing
Morphological Gradient
g = ( f b) − ( f − b)
Original image Morphological Gradient
Top-Hat Transformation
Original image Results of top-hat transform
Example: Texture Segmentation Application
Small
blob
Original image Segmented result
Large blob
Algorithm:
1.Perform closing on the image by using successively larger
structuring elements until small blobs are vanished.
2. Perform opening to join large blobs together
3. Perform intensity thresholding
Example: Granulometry
Objective: to count the number of particles of each size
Method:
1. Perform opening using structuring elements of increasing size
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
Morphological Watersheds
Morphological Watersheds
Morphological Watersheds
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Gradient Image
Original P Surface of P
image
P at edges look
like mountain ridges.
Morphological Watersheds
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Morphological Watersheds
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Morphological Watersheds
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.
Convex Hull
(Images from Rafael C. Gonzalez and Richard E.
Wood, Digital Image Processing, 2nd Edition.