Specifications
Image Filtering
6-15
6
MedianFilter
Apply a median filter to
the image.
void iplMedianFilter(IplImage*
srcImage
, IplImage*
dstImage
, int
nCols
, int
nRows
, int
anchorX
,
int
anchorY
);
srcImage
Thesourceimage.
dstImage
The resultant image.
nCols
Number of columns in the neighborhood to use.
nRows
Number of rows in the neighborhood to use.
anchorX, anchorY
The [x, y] coordinates of the anchor cell in the
neighborhood. In this coordinate system, the top
left corner would be [0, 0] and the bottom right
corner would be [
nCols
-1,
nRows
-1]. For a 3 by
3 neighborhood, the coordinates of the geometric
center would be [1, 1]. This specification allows
the neighborhood to be skewed with respect to its
geometric center.
Discussion
The function iplMedianFilter() sets each pixel in the output image as
the median value of all the input image pixel values in the neighborhood of
size
nRows
by
nCols
with the anchor cell at that pixel. This has the effect
of removing the noise in the image.