Image Processing Reference
In-Depth Information
Fig. 5.4 Resulting images of two noise filters. Notice that the mean filter does not remove all the
noise and that it blurs the image. The median filter removes all the noise and only blurs the image
slightly
GetPixelValues (x ,
y );
SortPixelValues ();
value = FindMedian ();
SetPixel ( output ,
x,
y,
value );
}
}
where M is the height of the image, N is the width of the image and Radius is the
radius of the filter.
What should be noticed both in the figure and in the code is that the output image
will be smaller than the input image. The reason is that the filter is defined with a
center and a radius, but if the center is a pixel in for example the first row, then no
neighbors are defined above. This is known as the border problem , see Fig. 5.5 .Ifit
is unacceptable that the output image is reduced in size (for example because it is to
be added to the input image) then inspiration can be found in one of the following
suggestions 2 :
Increase the output image After the output image has been generated, the pixel
values in the last row (if radius
1) is duplicated and appended to the image. The
same for the first row, first column and last column.
Increase the input image Before the image is filtered the pixel values in the last
row (if radius
=
1) of the input image is duplicated and appended to the input
image. The same for the first row, first column and last column.
Apply special filters at the rim of the image Special filters with special sizes are
defined and applied accordingly, see Fig. 5.5 .
=
2 Note that this issue is common for all neighborhood processing methods.
Search WWH ::




Custom Search