chapter 9: morphological image processingit.nrru.ac.th/krit/411304/chapter09.pdfexample: application...
TRANSCRIPT
Digital Image ProcessingChapter 9:
Digital Image ProcessingChapter 9:Chapter 9:
Morphological Image ProcessingChapter 9:
Morphological Image ProcessingMorphological Image ProcessingMorphological Image Processing
What are Morphological Operations? What are Morphological Operations?
Morphological operations come from the word “morphing”in Biology which means “changing a shape”.
MorphingMorphing
Image morphological operations are used to manipulateImage morphological operations are used to manipulateobject shapes such as thinning, thickening, and filling.
Binary morphological operations are derived fromset operationsset operations.
Basic Set Operations Basic Set Operations
C f i bi i h lConcept of a set in binary image morphology:Each set may represent one object. Each pixel (x,y) has
i b l b lits status: belong to a set or not belong to a set.
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Translation and Reflection Operations Translation and Reflection Operations Translation ReflectionTranslation Reflection
BbbwwB for ,ˆ AazaccA z for ,
AB
A
z = (z1,z2)
(A) B̂(A)z B
Logical Operations* Logical Operations*
*F bi i l(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
*For binary images only
Dilation Operations Dilation Operations
ˆ ABzBA z
= Empty setDilate means “extend”
A = Object to be dilatedB St t i l tB = Structuring element
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Dilation Operations (cont.) Dilation Operations (cont.)
ˆR fl ti BReflection
StructuringStructuringElement (B)
Original image (A) Intersect pixel Center pixel
Dilation Operations (cont.) Dilation Operations (cont.)
Result of Dilation Boundary of the “center pixels” where intersects A zB̂
Example: Application of DilationExample: Application of Dilation
“Repair” broken characters(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Repair broken characters
Erosion Operation Erosion Operation
AA ABzBA z
Erosion means “trim”
A = Object to be erodedi lB = Structuring element
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Erosion Operations (cont.) Erosion Operations (cont.)
StructuringElement (B)Element (B)
Original image (A) Intersect pixel Center pixel
Erosion Operations (cont.) Erosion Operations (cont.)
Result of ErosionB d f th “ t i l ”Boundary of the “center pixels”where B is inside A
Example: Application of Dilation and ErosionExample: Application of Dilation and Erosion
Remove small objects such as noiseRemove small objects such as noise
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Duality Between Dilation and ErosionDuality Between Dilation and Erosion
BABA cc ˆ) (
Proof:where c = complement
Proof:
ABzBA cc)( ABz
ABzBAcc
z) (
ABz
ABzc
z
z
BAc ˆ
Opening Operation Opening Operation
BBABA )( BBABA ) (
ABBBAor
ABBBA zz
= Combination of all parts of A that can completely contain B p p y
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Opening eliminates narrow and small details and corners.
Example of Opening Example of Opening
(Images from Rafael C.Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Closing Operation Closing Operation
BBBA )A( BBBA )A(
Closing fills narrow gaps and notchesClosing fills narrow gaps and notches
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Example of Closing Example of Closing
(Images from Rafael C.Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Duality Between Opening and ClosingDuality Between Opening and Closing
ˆ BABA cc ˆ
Properties OpeningProperties OpeningABA 1
BDBCDC
ABA
then If 2. .1
BABBA .3Properties ClosingProperties Closing
BAA .1Properties ClosingProperties Closing
BABBABDBCDC
3 then If 2.
BABBA .3
Idem potent property: can’t change any more
Example: Application of Morphological OperationsExample: Application of Morphological Operations
Finger print enhancement
(Images from Rafael C.Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
HitHit--oror--Miss Transformation Miss Transformation
)( XWAXAXA c )( XWAXAXA c *
h X h b d dwhere X = shape to be detectedW = window that can contain X
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
HitHit--oror--Miss Transformation (cont.) Miss Transformation (cont.)
)( XWABABA c )( XWABABA c *
(Images from Rafael C.Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Boundary Extraction Boundary Extraction
BAAβ(A) BAAβ(A)
Original B dOriginal image
Boundary
(Images from Rafael C.Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Region Filling Region Filling
cABXX kk ABXX 1
h X d i lwhere X0 = seed pixel p
Original Results of region fillingOriginal image
Results of region filling
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Extraction of Connected Components Extraction of Connected Components
ABXX kk 1 where X0 = seed pixel p
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Example: Extraction of Connected Components Example: Extraction of Connected Components
X-ray imagef bof bones
ThresholdedThresholdedimage
C t dConnectedcomponents
(Images from Rafael C.Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Convex Hull Convex Hull Convex hull has no concave partConvex hull has no concave part.
Convex hull
i
iDAC
4
1)( i
convi XD Algorithm: where
i1
4,3,2,1 , 1 iABXX ik
ik * 1kk
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Example: Convex Hull Example: Convex Hull
(Images from Rafael C.Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Thinning Thinning
cBAABAABA
)() ( *cBAA ) ( *
))...))((...(( 21 nBBBABA
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Example: Thinning Example: Thinning
Make an object thinner.
(Images from Rafael C.Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Thickening Thickening
* )( BAABA . ** ) ( BAABA . ) )...) ) ((...(( 21 nBBBABA . . . .
*
)) ))(( ((
Make an object thicker
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Make an object thicker
Skeletons Skeletons
Dot lines are skeletons of thisstructure
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Skeletons (cont.) Skeletons (cont.) K
)()(0
ASAS k
K
k
with BkB)AkB)AAS (()( with BkB)AkB)AASk ( ()(
where ...) ) ) (...( ( BBBAkB)A
k times
and kBAkK max
Skeletons Skeletons
(Images from Rafael C.Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Pruning Pruning
BAX 1
8
= thinning
) ( 1
8
12
k
kBXX
* = finding end points
AHXX )( 23 = dilation at end points
314 XXX = Pruned result
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Example: Pruning Example: Pruning
Originalgimage
After Thi i EndThinning3 times
End points
DilationPrunedresult
of end points resultp
Summary of Binary Morphological Operations 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.) 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.) 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.) Summary of Binary Morphological Operations (cont.)
(Tables from Rafael C.Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Basic Types of Structuring ElementsBasic Types of Structuring Elements
x = don’t care
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
GrayGray--Scale Dilation Scale Dilation
DDbfbf d)(|)()(1 D Case
DyxDytxsyxbytxsfbf )(;)()(|)()(max
bf DxDxsxbxsfbf and )(|)()(max2-D Case1-D Case
bf DyxDytxsyxbytxsfbf ),(;)(),(|),(),(max
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Original image
GrayGray--Scale Dilation (cont.) Scale Dilation (cont.) Reflection
SubimageOriginal image
+
Reflectionof B
+
Moving Max
gwindow
StructuringStructuring element B
Note: B can be any shape and subimage must have
Output imagethe same shape asreflection of B.
GrayGray--Scale ErosionScale Erosion1 D Case DDbfbf d)(|)()(i
DyxDytxsyxbytxsfbf )(;)()(|)()(min2-D Case1-D Case bf DxDxsxbxsfbf and )(|)()(min
bf DyxDytxsyxbytxsfbf ),(;)(),(|),(),(min
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Original image
GrayGray--Scale Erosion (cont.) Scale Erosion (cont.)
SubimageOriginal image
B
-
Moving
Min
Moving window
StructuringStructuring element B
Note: B can be any shape and subimage must have
Output imagethe same shape as B.
Example: GrayExample: Gray--Scale Dilation and ErosionScale Dilation and ErosionOriginal image After dilationOriginal image After dilation
Darker Brighter
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
After erosion
GrayGray--Scale OpeningScale Opening
bbfbf )( bbfbf )(
Opening cuts peaks
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
GrayGray--Scale ClosingScale Closing
bbfbf )( bbfbf )(
Cl i fill ll(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Closing fills valleys
Example: GrayExample: Gray--Scale Opening and ClosingScale Opening and Closing
Original image After closingAfter opening
Reduce whitebj
Reduce darkobjects
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
objects j
GrayGray--scale Morphological Smoothing scale Morphological Smoothing
S hi P f i f ll d b l iSmoothing: Perform opening followed by closing
Original image After smoothingOriginal image After smoothing
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Morphological Gradient Morphological Gradient
)()( bfbf )()( bfbfg
Original image Morphological Gradient
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
TopTop--Hat Transformation Hat Transformation
)( bffh
Original image Results of top-hat transform
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Example: Texture Segmentation Application Example: Texture Segmentation Application
Small blob
Original image Segmented result
Algorithm:f l i h i b i i l l
Large blob
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
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
2. Perform opening to join large blobs together3. Perform intensity thresholding
Example: Granulometry Example: Granulometry Objective: to count the number of particles of each sizeObjective: to count the number of particles of each sizeMethod:1. Perform opening using structuring elements of increasing size2. Compute the difference between the original image and the result
after each opening operation3 The differenced image obtained in Step 2 are normalized and used3. The differenced image obtained in Step 2 are normalized and used
to construct the size-distribution graph.
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Original imageSize distribution
graph
Morphological Watershads Morphological Watershads
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Morphological Watershads Morphological Watershads
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Morphological Watershads Morphological Watershads
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Gradient ImageGradient Image
Surface of POriginalimage
P
at edges looklik t i idP
g
like mountain ridges.
Morphological Watershads Morphological Watershads
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Morphological Watershads Morphological Watershads
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Morphological Watershads Morphological Watershads
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.
Convex Hull Convex Hull
(Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.