## NAME

         adaptive_contrast_filter - adaptive contrast filter

## SYNOPSIS

         Image * adaptive_contrast_filter(Image *  inputImage,  float
         k1,  float  k2,  unsigned  int  kernel_size, float min_gain,
         float max_gain)

          <inputImage> - pointer to an Image
          <k1> - local gain factor multiplier  (typically  between  0
         and 1)
          <k2> - local mean multiplier (between 0 and 1)
          <kernel_size> - size of local window (an odd number)
          <min_gain> - the minimum local gain factor
          <max_gain> - the maximum local gain factor

## PATH

          $CVIPHOME/SPATIALFILTER/adaptive_contrast.c

## DESCRIPTION

         The  adaptive  contrast  enhancement  filter  is   used   to
         adjustthe  contrast  differently in different regions of the
         image.The adaptive contrast filter is based on the following
         equation:

         adaptive_contrast_filter =

                      M{I(r,c)}
                  k1*----------- * (I(r,c) - m_l(r,c)) + k2*m_l(r,c)
                     sigma_l(r,c)

         where M{I(r,c)} is the mean for  the  entire  image  I(r,c),
         sigma_l  is  the  local standard deviation, m_l is the local
         mean and k1, k2 are constants between 0 and 1.

## TYPES AND CONSTANTS

         None

## RETURN VALUES

         Pointer to the processed image

## HISTORY

         History information recorded: None

## 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 filter operation in a
          kernel size of 5 with the local gain factor multiplier
          and local mean multiplier equal to 0.5 with the minimum
          and maximum local gain factor equal to 0.5 and 5 */
          cvipImage = adaptive_contrast_filter(cvipImage,0.5,0.5,
          5,0.5,5);
          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);
          }

## SEE ALSO

         libspatialfilter

## AUTHOR

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