NAME

     mmse_filter - Adaptive Minimum Mean Squared Error Filter

SYNOPSIS

      #include <math.h>
      #include "CVIPimage.h"

     Image * mmse_filter(Image  *  inputImage,  float  noise_var,
     unsigned int kernel_size)

      <inputImage> - pointer to an Image
      <noise_var> - noise variance of input image
      <kernel_size> - kernel size (an odd number)

PATH

     $CVIPHOME/SPATIALFILTER/mmse_filter.c

DESCRIPTION

     The mmse_filter makes use of the local variance to determine
     if  a mean filter is to be applied to the local region of an
     image.  It works best for short tail additive type noise.

     The adaptive MMSE filter is based on the following equation:

                      (sigma_n)^2  /                  \
     MMSE = d(r,c) -  ------------ | d(r,c) - ml(r,c) |
                      (sigma_l)^2  \                  /

     where ml is the local mean, sigma_n is the  noise  variance,
     and sigma_l is the local variance.

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 adaptive mean squared
      error filter operation with the kernel size equal to 3
      and the noise variance equal to 100 */
      cvipImage = mmse_filter(cvipImage,100,3);
      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);
      }

RETURN VALUES

     Pointer to the processed image

BUGS

     none

SEE ALSO

     libspatialfilter

AUTHOR

     Copyright (C) 1996 SIUE - by Scott Umbaugh and Wenxing Li.