<< imfinfo SIP - Scilab Image Processing Toolbox imphase >>

SIP - Scilab Image Processing Toolbox >> SIP - Scilab Image Processing Toolbox > imnoise

imnoise

Add noise (Gaussian, etc.) to an image

Calling Sequence

imn = imnoise(im, type [,parameters])

Parameters

im
Input 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)
'poisson'
Not yet implemented
parameters
A sequence of parameters to control the noise distribution, depending on the chosen type. If omitted, default values are used (see below).
imn
Noisy image, which has the same size and type as input image im.

Description

imnoise(im, type [, parameters]) adds a type of noise to the intensity image im. Optionally, you can control the noise parameters starting at the 3rd. Argument to imnoise. Here are examples of noise types and their parameters:

imn = imnoise(im, 'salt & pepper', d) adds drop-out noise, where d is the noise density (probability of swapping a pixel). (default: d=0.05).

imn = imnoise(im, 'gaussian', m, v) adds Gaussian additive noise of mean m and variance v. (default: m=0 and v=0.01)

im = imnoise(im, 'localvar', V) additive zero-mean Gaussian noise where the variance at im(i,j) is V(i,j).

imn = imnoise(im,'localvar', intensity, V) additive zero-mean Gaussian noise, and the local variance of the noise, var, is a function of the image intensity values in im. The variance is matrix( interp1(intensity(:),V(:),im(:)), size(im) )

imn = imnoise(im,'speckle',v) adds multiplicative noise, using imn = im + noise*im, 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)

Examples

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');

Bugs and Shortcomings

'poisson' noise is not yet implemented.

Authors

"Noise Generation", The Hypermedia Image Processing Reference (HIPR), R. Fisher, S. Perkins, A. Walker and E. Wolfart, University of Edinburgh:

http://homepages.inf.ed.ac.uk/rbf/HIPR2

Authors

Availability

The latest version of SIP can be found at

http://sip.sf.net

See Also


<< imfinfo SIP - Scilab Image Processing Toolbox imphase >>