## NAME

         speckle_noise - Add speckle noise to an image

## SYNOPSIS

         #include "CVIPnoise.h"

         Image   *speckle_noise(Image   *imageP,float    *psalt,float
         *ppepper);

          <imageP> - pointer to Image structure
          <psalt> - probability of salt noise (high gray level = 255)
          <ppepper> - probability of pepper noise (low gray  level  =
         0)

## PATH

         $CVIPHOME/NOISE/noise.c

## DESCRIPTION

         Speckle noise, also called "salt  and  pepper"  type  noise,
         typically occurs in images that are acquired by cameras con-
         taining malfunctioning pixels.  Salt  and  Pepper  noise  is
         named  after  the  white  and  black  appearance  it adds to
         images.

         The float pblack represents the probability of a pixel being
         "black",   or  0  in  grey-level,  while  the  float  pwhite
         represents the probability of a pixel being "white", or 255.
         Note: the sum of pblack and pwhite cannot exceed 1.0.

## RETURN VALUES

         The speckle_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 psalt=0.1;
          float ppepper=0.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 speckle noise to the input
          image with the probability of high grey levels equal
          to 0.1 and the probability of low grey levels equal to
          0.2.We can use the function speckle_noise_setup so
          that the user can  specify the inputs  */
          cvipImage = speckle_noise(cvipImage,&psalt,&ppepper);
          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),     gaussian_noise(3),     neg_exp_noise(3),
         rayleigh_noise(3), uniform_noise(3)

## AUTHOR

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