## NAME

         gaussian_noise - Add gaussian noise to an image

## SYNOPSIS

         #include "CVIPnoise.h"

         Image *gaussian_noise(Image *imageP,float *var,float *mean);

          <imageP> - pointer to Image structure
          <var> - variance of noise distribution
          <mean> - mean or average value of noise distribution

## PATH

         $CVIPHOME/NOISE/noise.c

## DESCRIPTION

         Gaussian noise is the most common type of noise appearing in
         an  image.   It  is  called such because it has the Gaussian
         shaped histogram as shown by the following equation:

                          1
              hi = -----------------exp((Gi-m)/(2*sigma^2))
                   sigma*sqrt(2*pi)

         where Gi is the grey-level value of the ith pixel, sigma  is
         the variance, m is the mean.

## RETURN VALUES

         The gaussian_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;
          float alpha=0.5;

          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 gaussian noise to the
          input image with the variance equal to 100.0 and
          the mean equal to  0.5.We can use the function
          gaussian_noise_setup so that the user can
          specify the inputs  */
          cvipImage = gaussian_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

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

## AUTHOR

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