You are on page 1of 24

Digital Image Processing

Erosion & Dilation


It is typically applied to binary image, but there are
versions that work on gray scale image.
Digital Image Processing
Structuring Element

A structuring element is a matri consisting o! only "#s


and $#s that can have any arbitrary shape and si%e.
&he piels with values o! $ de!ine the neighborhood .
Eample'
(eighborhood
" " " $ " " "
" " $ $ $ " "
" $ $ $ $ $ "
$ $ $ $ $ $ $
" $ $ $ $ $ "
" " $ $ $ " "
" " " $ " " "
Digital Image Processing
Eample o! dilation
on a binary image
Digital Image Processing
Eample o! dilation
on a grayscale image
Digital Image Processing
Applications o! dilation
)or bridging gaps in an image
Effect of dilation using a 33 square structuring element
Digital Image Processing
Applications o! erosion '
Eliminating unwanted detail
Effect of erosion using a 33 square structuring element
Digital Image Processing
*pening & +losing
,&he de!inition o! a morphological opening o! an
image is 'an erosion followed by a dilation,
using the same structuring element !or both
operations.
,&he related operation, morphological closing o!
an image, is the reverse'
it consists o! dilation followed by an erosion
with the same structuring element.
Digital Image Processing
Eample o! opening
Effect of opening using a 33 square structuring element
Digital Image Processing
Remove small objects
Example of an Opening
Digital Image Processing
Eample o! closing
Effect of closing using a 33 square structuring element
Digital Image Processing
Skeletoni%ation

&o reduce all ob-ects in an image to lines,


without changing the essential structure o!
the image
Digital Image Processing
Eample o! Practical
Applications o! .orphology
Boundary Extraction
The boundary of a set X is obtained by first eroding X by
structuring element and then ta!ing the set difference of
X and it"s erosion#
The resultant image after subtracting the eroded image from
the original image has the boundary of the objects extracted#
The thic!ness of the boundary depends on the si$e of the
structuring element#
Digital Image Processing
/oundary Etraction
eample
Digital Image Processing
.orphological 0top hat0
operation

.orphological 0top hat0 operation


returns the image minus the
morphological opening o! the
image.
Eample'
Input image
1esult
Digital Image Processing
.orphological 0bottom hat0
operation

.orphological 0bottom hat0 operation


per!orms closing 2dilation !ollowed by
erosion3 and than subtracts the original
image.
Eample'
Input image 1esult
Digital Image Processing
Morphological Gradient
Operator

&his morphological operator is a composition o!

a dilation,

an erosion o! the input image by the same structuring


element

and than the subtraction o! these two results.

*ne important application o! the morphologic


gradient on binary images is the boundary etraction.

&he same operator can be applied to gray level


images.
Digital Image Processing
Morphological Gradient
Operator
Dilation
Erosion
Subtraction
" $ "
$ $ $
" $ "
Structuring element used
Input image
Digital Image Processing
Morphological Gradient: An
Example of a Grayscale Image
Input image
(egation o! the morphological gradient.
4sed structural element ' 55 s6uare
% & % & b f b f g =
Digital Image Processing
&'mages from Rafael (# )on$ale$ and Richard E#
*ood+ ,igital 'mage -rocessing+ .
nd
Edition#
Morphological Gradient: An
Example of a Grayscale Image
Original image
/orphological )radient
% & % & b f b f g =
Digital Image Processing
Hit-or-Miss operation

&he hit7or7miss operation is a basic tool !or shape detection.

&his operation re6uires two structuring elements. &he


neighborhoods o! those structuring elements /$ and/8
should not have any overlapping elements.

&he hit7or7miss operation preserves piels whose


neighborhoods match the shape o! structuring element /$
and don#t match the shape o! /8

hit7or7miss is de!ined as the intersection o! the erosion o! A


by the !irst structure element and the erosion o! the
complement o! A by the second structure element'

9it*r.iss : Intersect 2Erosion 2A, SE$3, Erosion 2;A,


SE833.
Digital Image Processing
Example of the Hit-or-Miss
Operation
Input image
1esult image
Structuring elements'
Digital Image Processing
.orphological 1econstruction
Morphological reconstruction
can be thought of
conceptually as repeated
dilations of an image, called
the marker image, until the
contour of the marker image
fits under a second image,
called the mask image.
In morphological
reconstruction, the peaks in
the marker image "spread
out,"
Digital Image Processing
.orphological 1econstruction
Eamples
Examples of the image-
preprocessing and segmentation.
a) Original
!) mar"er image
c) reconstructed image
a) !) c)
Digital Image Processing
&he <atershed &rans!ormation
,Principle'
Any greytone image can be considered as a topographic
sur!ace. &he watershed algorithm is an image processing
segmentation algorithm that splits an image into areas, based
on the topology o! the image.

You might also like