Morphological Image Processing - 12thmarch2023
Morphological Image Processing - 12thmarch2023
• Morphological operations
• Segmentation
– Thresholding
– Edge detection
• Representation of objects
Morphological Image Processing
• Reflection
The reflection of a set B, denoted B, is defined as
B {w | w b, for b B}
• Translation
The translation of a set B by point z ( z1 , z2 ), denoted ( B) Z ,
is defined as
( B) Z {c | c b z, for b B}
Example: Reflection and Translation
origin
Examples: Structuring Elements (2)
At each location of
the origin of B, if B is
Accommodate the completely
entire structuring contained in A, then
elements when its the location is a
origin is on the member of the new
border of the set, otherwise it is
original set A not a member of the
new set.
Origin of B visits
every element of A
A B z ( Bˆ ) z A
^
•The dilation of A and B is a set of all displacements, z , such that B and A
overlap by at least one element. The definition can also be written as:
A B z ( Bˆ ) z A A
•Set B is referred to as the structuring element and used in dilation as well as in
other morphological operations. Dilation expands/dilutes a given image.
• Dilation: Given the structuring element B and set A.
• Dilation: Given the following distorted text image where the maximum length
of the broken characters are 2 pixels. The image can be enhanced by bridging the
gaps by using the structuring element given below:
B
3x3 structuring
element
A A B
•Note that the broken characters are joined.
Dilation Example
Original Image Processed Image With Dilated Pixels
Structuring Element
Dilation Example 2
A B z ( B ) z A
•The erosion of A by structuring element B is the set of all points z, such that B,
translated by z, is contained in A.
structuring
element
•Note that in erosion the structuring element B erodes the input image A at its boundaries.
Erosion shrinks a given image.
• Erosion: Given the structuring element B and set A.
structuring
element
Erosion Example
Original Image Processed Image
Structuring Element
Erosion Example 2
After erosion
Original
with a disc of
image
radius 10
•Given set A and the structuring element B. Closing of A by structuring element B is defined
by:
A B ( A B) B
Opening
A B Bz ( Bz ) A
Outer boundary of A
Origin of B
Circular structuring element Shaded area: complete opening
Possible translations of B in A
Closing
• Closing: The closing has a similar geometric interpretation except that we roll
B on the outside of the boundary.
•The opening operation can also be expressed by the following formula:
A B ( Bz ) ( Bz ) A
Outer boundary of A
Original image
B
circular structuring
element
result of erosion of A by B
result of opening of A by B
result of dilation of A by B
result of closing of A by B
Impulsive noise within the background and th
fingerprints is removed.
The Hit-or-Miss Transformation
The Hit-or-Miss Transformation is a method to find
the location of a shape (defined by structuring
element) in an image
it is an operation that detects a given pattern in a
binary image using a structuring element containing
1’s, 0’’s and blanks for don’t cares
Used to thin and skeletonize a shape in a binary image
Hit-or-Miss exp:
The Hit-or-Miss Transformation
A basic morphological tool for shape detection.
Let the origin of each shape be located at its center of
gravity.
If we want to find the location of a shape , say – X ,
at (larger) image, say – A :
Let X be enclosed by a small window, say – W.
The local background of X with respect to W is defined as
the set difference (W - X).
Apply erosion operator of A by X, will get us the set of
locations of the origin of X, such that X is completely
contained in A.
It may also be viewed geometrically as the set of all locations
of the origin of X at which X found a match (hit) in A.
The Hit-or-Miss Transformation
Cont.
Apply erosion operator on the complement of A by the local
background set (W – X).
Notice, that the set of locations for which X exactly fits inside
A is the intersection of these two last operators above.
This intersection is precisely the location sought.
Formally:
If B denotes the set composed of X and it’s background –
B = (B1,B2) ; B1 = X , B2 = (W-X).
The match (or set of matches) of B in A, denoted is:
The Hit-or-Miss Transformation
The reason for using these kind of structuring element –
B = (B1,B2) is based on an assumed definition that,
two or more objects are distinct only if they are
disjoint (disconnected) sets.
In some applications, we may interested in detecting
certain patterns (combinations) of 1’s and 0’s and
not detecting individual objects.
In this case a background is not required.
the hit-or-miss transform reduces to simple erosion.
This simplified pattern detection scheme is used in
some of the algorithms for – identifying characters
within a text.
Boundary Extraction
• First, erode A by B, then make set difference
between A and the erosion
• The thickness of the contour depends on the
size of constructing object – B
F ( A) X k A
• Region Filling Example
A non-boundary pixel
nput image
Chicken fillet)
Thresholded
image
15 connected
components
with different
number of
pixels
After erosion
by 5x5 square
structuring
element of 1’s
Thinning
A B A (A
* B) hit-or-miss transform/template matching
•The process is to thin A by one pass with B1, then the result with one pass of B2, and
continue until A is thinned with one pass of Bn.
A {B} ((...(( A B1 ) B 2 )...) B n )
Thinning Example
• Thinning: The following set of structuring elements are used for thinning operation.
...