Essentials of Mechatronics ISBN:
0-471-72341-X- ©John Billingsley 2006 - published
John Wiley & Sons, Inc
12/3/5.htm Examples of filtering gray-scale images
Smoothing with a 3x3 filter
With a minor variation, the routine which produced the 'ragged diamond'
is now made to set up a speckled pattern of shades of grey in the
window.
This first routine once again uses the 'add up the values in a 3x3
patch' routine to take averages and smooth the image.
Run Graysmooth.bas or Graysmooth.htm.
Image sharpening with a 3x3 filter.
The same pattern is formed of a diamond on a shaded background.
The filter coefficients are:
1 -2 1
-2 4 -2
1 -2 1
The filter is a discrete approximation to 'del-squared' - the result is
a sort
of second differential of the original.
Run sharp33.bas or sharp33.htm.
Smoothing with a low-pass filter
The next program uses a completely different smoothing method.
If we apply a 'low-pass filter' to the sequence of brightness values,
we will smooth the horizontal variation but the image will be blurred
by smearing it to the right.
If we apply another low pass filter, but take the cells in the reverse
order, the smearing will be to the left.
After doing both operations, the horizontal variation will be smoothed
but there will be no average shift to left or right.
Now if we do the same sort of thing, smoothing in the vertical
direction this time, we end up with a smoothed image.
Run smfilt.bas or smfilt.htm.