## NAME

         contra_filter - a non-linear mean filter which is better  at
         removing  gaussian  type  noise and preserving edge features
         than the mean filter.

## SYNOPSIS

          #include <CVIPtoolkit.h>
          #include <CVIPdef.h>
          #include <CVIPspfltr.h>
          #include <float.h>

         Image *contra_filter(Image *imageP, int mask_size, int p)
              <imageP> - pointer to Image structure.
              <mask_size> - size of the filtering  window  (e.g.,  3-
         >3x3).
              <p> - filter order.

## PATH

         $CVIPHOME/SPATIALFILTER/spatial_filter.c

## OPTIONS

         None.

## DESCRIPTION

         Returns the sum of the pixels in the filter window raised to
         the  power  "p+3",  divided  by the sum of the pixels in the
         filter window raised to  the  power  "p".   Size  of  filter
         should  be an odd integer limited from < 3 - 31 >, and order
         of filter is limited from <-5 to +5>.

## TIPS

         Works well on images containing positive  outlier  noise  if
         the  parameter P is negative, and on images containing nega-
         tive outlier noise if the parameter P is positive.  P should
         remain small (3-3) for better performance.  Keep filter mask
         size small to reduce blurring.

## DIAGNOSTICS

         Returns the modified Image  structure  pointer  on  success;
         returns  a  NULL pointer if the inpute Image datatype 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;

          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 contra filter operation
          with the mask size equal to 3 and order of filter equal
          to 2*/
          cvipImage = contra_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.