Re: Noise generation - salt and pepper




Can you please tell me , How i could generate salt and pepper noise.

Here is some matlab code that will do the job. Let

N = 256; % side of the noise image in pixels
thresh = 0.33; % fraction of black pixels
img_f = rand(N); % an image of samples of a uniform (0,1) random
distribution
img_bw = img_f > thresh;

img_bw is the result. It is binary image i.e. 0s and 1s, with a
fraction thresh of 0 (black) values.

For more on this, look at the book "Digital Image Processing using
Matlab." It has a section on image noise generation.

Bob


.


Quantcast