## NAME

         gamma_noise - Add gamma noise to an image

## SYNOPSIS

         #include "CVIPnoise.h"

         Image *gamma_noise(Image *imageP,float *var,int *alpha);

          <imageP> - pointer to Image structure
          <var> - variance of noise distribution
          <alpha> - alpha parameter distribution (see equation)

## PATH

         $CVIPHOME/NOISE/noise.c

## DESCRIPTION

         Gamma type noise is the result of low-pass filtering  of  an
         image containing negative exponential noise as the result of
         acquiring an image which is illuminated by a coherent laser.
         It's histogram is defined as follows:

                     Gi^(alpha-1)
              hi = -----------------exp(-(Gi/a))
                   (alpha-1)!a^alpha

         where Gi is the grey-level value of the ith pixel, a*a*alpha
         is  the variance, and alpha determines the shape of the his-
         togram: aplha=1 gives a negative exponential histogram,  and
         alpha=infinity gives a Gaussian histogram.

## RETURN VALUES

         The  gamma_noise()  function  returns  the  modified   Image
         pointer on success, and returns a NULL pointer on failure

## BUGS

         none

## EXAMPLE

          #include <CVIPtoolkit.h>
          #include <CVIPimage.h>
          #include <CVIPconvert.h>
          #include <CVIPview.h>
          #include "CVIPnoise.h"
          #define VIEWER "picture"
          #define VIDEO_APP "SunVideo &"

          void main()
          {
          Image *cvipImage;
          IMAGE_FORMAT format;
          char *inputfile,*outputfile;
          float var=100.0;
          int alpha=2;

          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 adds gamma noise to the input
          image with the variance equal to 100.0 and the
          factor alpha  equal to 2.We can use the function
          gamma_noise_setup so  that the user can specify
          the inputs  */
          cvipImage = gamma_noise(cvipImage,&var,&alpha);
          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

         gaussian_noise(3),   neg_exp_noise(3),    rayleigh_noise(3),
         speckle_noise(3), uniform_noise(3)

## AUTHOR

         Copyright (C) 1992, 1996 SIUE -  by  Scott  E.  Umbaugh  and
         David Lyons.