NAME
median_filter - a fast median filter using the histogram
method.
SYNOPSIS
#include <CVIPtoolkit.h>
#include <CVIPdef.h>
#include <CVIPimage.h>
#include <CVIPconvert.h>
#include <CVIPspfltr.h>
#include <stdio.h>
#include <math.h>
cc...<libspatialfilter.a>
Image *median_filter(Image *inputImage, int size)
<inputImage> - pointer to an Image
<size> - mask size (3,5,7,9,...)
PATH
$CVIPHOME/SPATIALFILTER/median_hist.c
DESCRIPTION
The function median_filter uses a histogram method to per-
form a fast median filter on an input image, using a square
mask of user-determined dimension. The filter operates on
the histogram of the masked area, rather than on the image
directly.
RETURN VALUES
The function returns an image that has been median filtered.
HISTORY
History information recorded: filter window size
EXAMPLE
#include <CVIPtoolkit.h>
#include <CVIPdef.h>
#include <CVIPimage.h>
#include <CVIPconvert.h>
#include <CVIPspfltr.h>
#include <stdio.h>
#include <math.h>
void main()
{
Image *cvipImage;
IMAGE_FORMAT format;
char *inputfile, *outputfile;
setDisplay_Image("picture", "Default");
print_CVIP("\n\t\tEnter the Input File Name: ");
inputfile =(char *) getString_CVIP();
format = getFormat_CVIP(inputfile);
cvipImage = read_Image(inputfile, 1);
view_Image(cvipImage, inputfile);
cvipImage = (Image *)median_filter(cvipImage, 3);
/* example size 3 */
fflush(stdin);
print_CVIP("\n\t\tEnter the Output File Name: ");
outputfile = getString_CVIP();
view_Image(cvipImage, outputfile);
write_Image(cvipImage, outputfile,CVIP_NO,CVIP_NO,format,
1);
free(inputfile);
free(outputfile);
}
BUGS
None at this time
SEE ALSO
AUTHOR
Copyright (C) 1995 SIUE - by Frank Smith and Scott Umbaugh.