| Image
Processing Articles
Inde |
 |
| Overview |
| Dilation
is one of the two
basic operators in
the area of mathematical
morphology, The basic
effect of the operator
on a binary image
is to gradually enlarge
the boundaries of
regions of foreground
pixels (i.e. white
pixels, typically).
Thus areas of foreground
pixels grow in size
while holes within
those regions become
smaller. |
 |
| General
Working |
|
The dilation operator
takes two pieces of
data as inputs. The
first is the image
which is to be dilated.
The second is a set
of coordinate points
known as a Structuring
Element. It is this
structuring element
that determines the
precise effect of
the dilation on the
input image. The mathematical
definition of grayscale
dilation is identical
except for the way
in which the set of
coordinates associated
with the input image
is derived. In addition,
these coordinates
are 3-D rather than
2-D. The brief procedure
for implementing the
dilation in the binary
image, and in the
graylevel image are
explained below. |
 |
| The
dilation is applied
on the binary image
in a single pass.
During the pass, if
the pixel in hand
is equal to binary
1, then apply the
structuring element
on the image by starting
from that particular
pixel as the origin |
 |
| The
sample project supposes
that, in the thresholded
image, the background
is black and the forground
is white. If the sample
image is not so, then
you have to adjust
accordingly |
 |
| The
dilatoin can also
be applied on the
graylevel images also
in a single pass.
During the passing
through the image,
the structuring element
is applied on each
pixel of the image,
such that the origin
of the structuring
element is applied
on that particular
pixel. In this case
the corresponding
pixel of the output
image contains the
maximum of the pixels
surrounding it. In
this case, only those
pixels are compared
with each other, where
the structuring element
contains. |
 |
| Explanation |
| Let
us take the example
of the following image: |
 |
 |
 |
| and
the following Structuring
Element: |
|
 |
| The
following image shows
the effect of it on
the above image: |
 |
 |
 |
|
In the above images,
the boxes shows the
pixels, and the white
colored boxes shows
that the binary pixel
contains 1, while
the black box shows
that the corresponding
pixel contains 0.
It can be seen that
the hole is removed
from the image after
applying the dilation.
Dilations can be made
directional by using
less symmetrical structuring
elements. e.g. a structuring
element that is 10
pixels wide and 1
pixel high will dilate
in a horizontal direction
only. Similarly, a
3×3 square structuring
element with the origin
in the middle of the
top row rather than
the center, will dilate
the bottom of a region
more strongly than
the top. |
 |
| Let
us take the example
of the following image
sample ( note that
each pixel is represented
by a box, whereas
the pixel intensity
is shown in the box
as a number) : |
 |
 |
 |
| and
the following be the
structuring element: |
|
 |
| now,
the dilated image
pixel setup is as: |
 |
 |
 |
|
In order to understand
the working, take
the example of the
pixel in the 3rd row,
and in the 4th column.
Its intensity is 56.
Now, the pixel in
the images are compared
in the image where
the structuring element
has one. The intensity
values of those pixels
are 198 , 32 , 56
, 16 , 78. The maximum
of these is 198 intensity
value, thus it is
the intensity value
of the pixel in the
3rd row, and in the
4th column of the
output image. |
 |
| Guidelines
for Use |
 |
| One
of the simplest applications
of dilation is for
bridging gaps in the
binary mode. For example,
take the following
fig: |
 |
 |
 |
| The
following image shows
that the two pixel
gaps on maximum are
bridged: |
 |
 |
 |
| In
the graylevel mode
the dilation operation
bright regions surrounded
by dark regions grow
in size, and dark
regions surrounded
by bright regions
shrink in size. Small
dark spots in images
will disappear as
they are `filled in'
to the surrounding
intensity value. Small
bright spots will
become larger spots.
The effect is most
marked at places in
the image where the
intensity changes
rapidly and regions
of fairly uniform
intensity will be
largely unchanged
except at their edges.
For example, take
the following graylevel
image: |
 |
 |
 |
| The
following picture
shows the effect of
two dilation passes
on the image: |
 |
 |
 |
| Sample
Project |
 |
| The
algorithm is coded
in C# using unsafe
so the quality and
speed of the program
may not be affected.
The class BitmapData
is used to read and
process the pixels
in the image. This
is the speicality
of C# to provide such
a speed even on image
processing applications.
There is a set of
modules that are designed
to implement the algorithm.
The interface designed
for the sample project
as: |
 |
 |
 |
|
You can perform the
dilation operation
on binary as well
as on graylevel images
using the same project,
specifying the type
of the image in the
dialog box. You also
use specify desired
masks in the "Specify
Mask" section. |
 |
Download
Project Files
 |
 |
| Image
Processing Articles
Index |