![Page 1: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/1.jpg)
CS654: Digital Image Analysis
Lecture 31: Image Morphology: Dilation and Erosion
![Page 2: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/2.jpg)
Recap of Lecture 30
• Color image processing
• Color model
• Conversion of color models
• Color image processing
• Color enhancement, retouching, pseudo-coloring
![Page 3: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/3.jpg)
Outline of lecture 31
• Image morphology
• Set theoretic interpretation
• Dilation
• Erosion
• Duality
• Opening and Closing
![Page 4: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/4.jpg)
Introduction
• Study of the form, shapes, structure of artifacts
• Archaeology, astronomy, biology, linguistic, geomorphology, mathematical morphology, ….
• Image processing• Extract image components • representation and description of region shape, • boundaries, skeletons, and the convex hull
![Page 5: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/5.jpg)
Binary Morphology
• Morphological operators are used to prepare binary images for object segmentation/recognition
• Binary images often suffer from noise (specifically salt-and-pepper noise)
• Binary regions also suffer from noise (isolated black pixels in a white region).
• Can also have cracks, picket fence occlusions, etc.
• Dilation and erosion are two binary morphological operations that can assist with these problems.
![Page 6: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/6.jpg)
Goals of morphological operations
• Simplifies image data
• Preserves essential shape characteristics
• Eliminates noise
• Permits the underlying shape to be identified and optimally reconstructed from their distorted, noisy forms
![Page 7: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/7.jpg)
Some Basic Concepts from Set Theory
![Page 8: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/8.jpg)
Preliminaries
• Reflection
• Translation
1 2The translation of a set by point ( , ), denoted ( ) ,
is defined as
( ) { | , for }
Z
Z
B z z z B
B c c b z b B
The reflection of a set denoted as , defined as
�̂�={𝑤∨𝑤=−𝑏 , 𝑓𝑜𝑟 𝑏∈𝐵 }
![Page 9: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/9.jpg)
Translation
Reflection
Example: Reflection and Translation
![Page 10: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/10.jpg)
Logical operations on Binary images
![Page 11: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/11.jpg)
Logical operations on Binary imagesA B
![Page 12: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/12.jpg)
Structure elements (SE)
Small sets or sub-images used to probe an image under study for properties of interest
origin
![Page 13: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/13.jpg)
Libraries of Structuring Elements
•Application specific structuring elements created by the user
![Page 14: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/14.jpg)
X
B
No necessarily compactnor filled
A special set :the structuring element
-2 -1 0 1 2
-2 -1 0 1 2
Origin at center in this case, but not necessarily centered nor symmetric
x
y
3*3 structuring element
Notation
![Page 15: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/15.jpg)
Examples: Structuring ElementsAccommodate the entire structuring elements when its origin is on the border of the original set A
Origin of B visits every element of A
At each location of the origin of B, if B is completely contained in A, then the location is a member of the new set, otherwise it is not a member of the new set.
![Page 16: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/16.jpg)
Dilationx = (x1,x2) such that if we center B on them, then the so translated B intersects X.
X
B
difference
dilation
![Page 17: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/17.jpg)
Dilation : x = (x1,x2) such that if we center B on them, then the so translated B intersects X.
How to formulate this definition ?
1) Literal translation
Another Mathematical definition of dilation uses the concept of Minkowski’s sum
Mathematical formulation
2) Better : from Minkowski’s sum of sets 𝑋⨁ �̂�
![Page 18: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/18.jpg)
Minkowski’s Sum
l
lMinkowski’s Sum
![Page 19: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/19.jpg)
Another view of Dilation
Dilation :
l
Dilation
![Page 20: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/20.jpg)
l
l
bbbb l Dilation
Dilation
Dilation is not the Minkowski’s sum
![Page 21: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/21.jpg)
Dilation explained pixel by pixel
•
••
•
•
••
•••
••
••
••B
A BA
Denotes origin of B i.e. its (0,0)
Denotes origin of A i.e. its (0,0)
![Page 22: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/22.jpg)
Dilation explained by shape of A
•
••
•
•
••
•••
••
••
••B
A
Shape of A repeated without shift
Shape of A repeated with shift
BA
![Page 23: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/23.jpg)
Properties of Dilation
• Fills in valleys between spiky regions
• Increases geometrical area of object
• Sets background pixels adjacent to object's contour to object's
value
• Smoothens small negative grey level regions
![Page 24: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/24.jpg)
Dilation versus translation
Let A be a Subset of and .
The translation of A by x is defined as:
The dilation of A by B can be computed as the union of translation of A by the elements of B
2Z2Zx
},{)( 2 AasomeforxacZcA x
Aa
aBb
b BABA
)()(
x is a vector
![Page 25: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/25.jpg)
Dilation versus translation, illustrated
BA•
••
•
•
•
••
•
•
••
•••
••
••
)0,0(A
Shift vector (0,0)
)1,0(A
Shift vector (0,1)
•• B
Element (0,0)
![Page 26: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/26.jpg)
Dilation using Union Formula
Aa
aBb
b BABA
)()(
xB)(
BA A
Center of the circle
This circle will create one point
This circle will create no point
![Page 27: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/27.jpg)
Example of Dilation with various sizes of structuring elements
Pablo Picasso, Pass with the Cape, 1960
StructuringElement
![Page 28: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/28.jpg)
Mathematical Properties of Dilation
Commutative
Associative
Extensivity
Dilation is increasing
BAABif ,0
DBDAimpliesBA
ABBA
CBACBA )()(
![Page 29: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/29.jpg)
Illustration of Extensitivity of Dilation
•
•
•
•B
ABA
••
BAABif ,0
••
••
••
••
Here 0 does not belong to B and A is not included in A B
Replaced with
![Page 30: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/30.jpg)
More Properties of Dilation
Translation Invariance
Linearity
Containment
Decomposition of structuring element
xx BABA )()(
)()()( CBCACBA
)()()( CBCACBA
)()()( CABACBA
![Page 31: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/31.jpg)
Dilation (Summary)
1.The dilation operator takes two inputs1. A binary image, which is to be dilated2. A structuring element (or kernel), which determines the
behavior of the morphological operation
2.Suppose that is the set of Euclidean coordinates of the input image, and is the set of coordinates of the structuring element
3.Let denote the translation of so that its origin is at .
4.The DILATION of by is simply the set of all points such that the intersection of with is non-empty
![Page 32: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/32.jpg)
Erosion
x = (x1,x2) such that if we center B on them, then the so translated B is contained in X.
difference
Erosion
![Page 33: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/33.jpg)
Notation for Erosion
2) Better : from Minkowski’s substraction of sets
Erosion : x = (x1,x2) such that if we center B on them, then the so translated B is contained in X.
How to formulate this definition ?
1) Literal translation
Erosion
Minkowski’s substraction
![Page 34: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/34.jpg)
Minkowski’s substraction of sets
Erosion
Minkowski’s substraction of sets
![Page 35: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/35.jpg)
Erosion with other structuring elements
![Page 36: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/36.jpg)
Did not belong to X
When the new SE is included in old SE then a larger area is created
Erosion with other structuring elements
![Page 37: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/37.jpg)
Erosion explained pixel by pixel
•
•
•
•
••••
••
B
A BA
• •••
![Page 38: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/38.jpg)
How It Works?
• During erosion, a pixel is turned on at the image pixel under the
structuring element origin only when the pixels of the
structuring element match the pixels in the image
• Both ON and OFF pixels should match.
• This example erodes regions horizontally from the right.
![Page 39: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/39.jpg)
Mathematical Definition of Erosion
1. Erosion is the morphological dual to dilation.
2. It combines two sets using the vector subtraction of set elements.
3. Let denotes the erosion of A by BBA
){
}..,{2
2
BbeveryforAbxZx
baxtsAaanexistBbeveryforZxBA
![Page 40: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/40.jpg)
Erosion in terms of other operations:
Erosion can also be defined in terms of translation
In terms of intersection
))({ 2 ABZxBA x
Bb
bABA
)(
Observe that vector here is negative
![Page 41: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/41.jpg)
Reminder - this was A
•
•
•
•
••••
![Page 42: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/42.jpg)
• •••
Erosion: intersection and negative translation
•
•
•
•
••••
••
BA
•
•
•
•
••••)1,0(1A )0,0(A
Observe negative translation
Because of negative shift the origin is here
![Page 43: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/43.jpg)
Erosion formula and intuitive example
xB)(
A
BA
))({ 2 ABZxBA x
Center of B is here and adds a point
Center here will not add a point to the Result
![Page 44: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/44.jpg)
Pablo Picasso, Pass with the Cape, 1960
StructuringElement
Example of Erosions with various sizes of structuring elements
![Page 45: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/45.jpg)
Properties of Erosion
Erosion is not commutative!
Extensivity
Erosion is dereasing
Chain rule
ABBA
ABABif ,0
)...)(...()...( 11 kk BBABBA
CABAimpliesCBBCBAimpliesCA ,
![Page 46: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/46.jpg)
Properties of Erosion
Translation Invariance
Linearity
Containment
Decomposition of structuring element
)()()( CBCACBA
)()()( CBCACBA
)()()( CABACBA
xxxx BABABABA )(,)(
![Page 47: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/47.jpg)
1. To compute the erosion of a binary input image by the structuring element
2. For each foreground pixel superimpose the structuring element
3. If for every pixel in the structuring element, the corresponding pixel in the image underneath is a foreground pixel, then the input pixel is left as it is
4. Otherwise, if any of the corresponding pixels in the image are background, however, the input pixel is set to background value
Erosion (Summary)
![Page 48: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/48.jpg)
Erosion
![Page 49: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/49.jpg)
Erosion as Dual of Dilation
• Erosion is the dual of dilation
• i.e. eroding foreground pixels is equivalent to dilating the background pixels.
![Page 50: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/50.jpg)
• Easily visualized on binary image
• Template created with known origin
• Template stepped over entire image• similar to correlation
• Dilation• if origin == 1 -> template unioned• resultant image is large than original
• Erosion• only if whole template matches image• origin = 1, result is smaller than original
1 *1 1
Duality Relationship between erosion and dilation
Another look at duality
![Page 51: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/51.jpg)
Erosion example with dilation and negation
We want to calculate this
We dilate with negation
![Page 52: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/52.jpg)
Erosion
.. And we negate the result
We obtain the same thing as from definition
![Page 53: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/53.jpg)
= origin
x
y
Note that here :
circledisk
segments 1 pixel wide
points
Common structuring elements shapes
![Page 54: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/54.jpg)
Morphology using Generalized SE
• SE is an matrix of 0’s and 1’s
• The center pixel is at
• The neighborhood of the center pixel are all the pixels in SE that are 1
1 0 1
0 1 0
1 0 1
![Page 55: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/55.jpg)
Morphology using Generalized SE
• For each pixel in the input image, examine the neighborhood as specified by the SE
• Erosion: If EVERY pixel in the neighborhood is on (i.e. 1), then output pixel is also 1
• Dilation: If ANY pixel in the neighborhood is on (i.e. 1), then output pixel is also 1
Yet another look at Duality Relationship between erosion and dilation
![Page 56: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/56.jpg)
Edge detection using Morphology
Original image
Edge detection
results
![Page 57: CS654: Digital Image Analysis Lecture 31: Image Morphology: Dilation and Erosion](https://reader033.vdocument.in/reader033/viewer/2022061614/5697c00a1a28abf838cc7b6d/html5/thumbnails/57.jpg)
Thank youNext Lecture: Image Morphology