IMNOISE

NAME
SYNOPSIS
PARAMETERS
DESCRIPTION
EXAMPLE
REFERENCES
AUTHORS
AVAILABILITY
SEE ALSO

NAME

imnoise - generate noise (salt & pepper, etc)

SYNOPSIS

J = imnoise(I, type [,parameters])

PARAMETERS

I
Input image (grayscale).
J
Noisy image (grayscale).
type
String having one of these values:
'salt & pepper': drop-out/On-off noise
'speckle': multiplicative noise
'gaussian': Gaussian white/additive noise
'localvar': Pixel-specific variance (Zero-mean Gaussian)
parameters
A sequence of parameters to control the noise distribution, depending on the chosen type. If omitted, default values are used (see below).

DESCRIPTION

imnoise(Img, type) adds a type of noise to the intensity image Img. Optionally, you can control the noise parameters starting at the 3rd. argument to imnoise. Here are example of noise types and their params:
J = imnoise(I,'salt & pepper',d) adds drop-out noise, where d is the noise density (probability of swapping a pixel). (default: d=0.05).
J = imnoise(I,'salt & pepper', d, val) does the same, but "val" is the value of salt (defaults to maximum of image). If "val" == 0, then pixels are replaced by uniformly random gray values.
J = imnoise(I,'gaussian',m,v) adds Gaussian additive noise of mean m and variance v. (default: m=0 and v=0.01)
J = imnoise(I,'localvar',V) additive zero-mean Gaussian noise where the variance at Img(i,j) is V(i,j).
J = imnoise(I,'speckle',v) adds multiplicative noise, using J = I+ noise*I, where noise is uniformly distributed with mean 0 and variance v. (default: v=0.04)
The mean and variance parameters are specified as if image intensities went from 0 to 1. By default, we consider that "1" corresponds to the maximum intensity value of the image. If you want to change this for 'gaussian' and 'speckle', pass an extra parameter at the end of the argument list. For instance, your image may have maximum intensity 180 even though the grayscale range is 0-1:
J = imnoise(I,'gaussian', m, v, val)
J = imnoise(I,'speckle', v, val)

EXAMPLE

xset('auto clear', 'on');
A = gray_imread(SIPDIR + 'images/gra.jpg');
imshow(A);

N = imnoise(A,'salt & pepper');
imshow(N,[]);

N = imnoise(A,'salt & pepper',0.3);
imshow(N,[]);


// Replace pixel by independent random value:
N = imnoise(A,'salt & pepper',0.3,0);
imshow(N,[]);

// Replace pixel by *dependent* random value:
N = imnoise(A,'speckle');
imshow(N,[]);

xset('auto clear', 'off');

REFERENCES

"Noise Generation", The Hypermedia Image Processing Reference (HIPR), R. Fisher, S. Perkins, A. Walker and E. Wolfart, University of Edinburgh
http://www.dai.ed.ac.uk/HIPR2/noise.htm

AUTHORS

Ricardo Fabbri <rfabbri@if.sc.usp.br>

AVAILABILITY

The latest version of the Scilab Image Processing toolbox can be found at
http://siptoolbox.sourceforge.net

SEE ALSO

mogrify '-noise' flag, mkfilter, gsm2d