NAME
alpha_filter - used when an image contains both short and
long tailed types of noise such as Gaussian and salt and
pepper noises. Filter varies between a median and a mean
filter.
SYNOPSIS
#include "CVIPtoolkit.h"
#include "CVIPdef.h"
#include <CVIPspfltr.h>
#include <float.h>
Image *alpha_filter(Image *imageP, int mask_size, int p)
<imageP> - pointer to Image structure.
<mask_size> - the size of the filtering window (e.g.,
3->3x3).
<p> - number of maximum and minimum pixels to be
excluded from the mean calculation.
PATH
$CVIPHOME/SPATIALFILTER/spatial_filter.c
OPTIONS
None.
DESCRIPTION
Filter is based on order statistics. The parameter p deter-
mines how many of the endpoints are eliminated from the
ordered data. Returns the mean of the filter window after
the endpoints have been removed. Size of filter should be an
odd integer limited from < 3 - 31 >, and size of trim is
limited from <1-4>.
TIPS
Works best on images that contain both short and long tailed
type noise. Keep filtering mask small to minimize blurring.
DIAGNOSTICS
Returns the modified Image structure pointer on success, and
returns NULL pointer if the input image data type is not
CVIP_BYTE, and can't be cast to CVIP_FLOAT.
EXAMPLE
#include <CVIPtoolkit.h>
#include <CVIPimage.h>
#include <CVIPdef.h>
#include <CVIPspfltr.h>
#include <CVIPconvert.h>
#include <CVIPview.h>
#define VIEWER "picture"
#define VIDEO_APP "SunVideo &"
void main()
{
Image *cvipImage;
IMAGE_FORMAT format;
char *inputfile,*outputfile;
(void) setDisplay_Image(VIEWER, "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);
free(inputfile);
/* the following call performs a alpha filter operation
with the mask size equal to 3 with the number of pixels
skipped for mean calculation equal to 2*/
cvipImage = alpha_filter(cvipImage,3,2);
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(outputfile);
}
BUGS
None.
AUTHOR
Copyright (C) 1992, 1996 SIUE - by Scott E. Umbaugh and John
A Creighton.