NAME
uniform_noise - Add uniform noise to an image
SYNOPSIS
#include "CVIPnoise.h"
Image *uniform_noise(Image *imageP,float *var,float *mean);
<imageP> - pointer to Image structure
<var> - variance of noise distribution
<mean> - mean or average value of distribution
PATH
$CVIPHOME/NOISE/noise.c
DESCRIPTION
Uniform type noise is simply generated according to:
1/a-b for a<=Gi<=b
hi =
0 elsewhere
where Gi is the grey-level value of the ith pixel, 'a' is
the minimum and 'b' is the maximum gray level value of the
noise.
RETURN VALUES
The uniform_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 mean=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 mean
equal to 0.5.We can use the function uniform_noise_setup so
that the user can specify the inputs */
cvipImage = uniform_noise(cvipImage,&var,&mean);
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), speckle_noise(3)
AUTHOR
Copyright (C) 1992, 1996 SIUE - by Scott E. Umbaugh and
David Lyons.