Current location - Recipe Complete Network - Complete vegetarian recipes - Matlab image plus noise
Matlab image plus noise
The statement of adding noise to the picture in Matlab is:

( 1)J = imnoise(I,type);

(2)J = imnoise(I, type, parameter);

Where I is the gray matrix of the original image, and J is the gray matrix of the noisy image;

Generally, (1) is enough, (2) indicates that parameters are allowed to be modified, and (1) uses the default parameters;

There are five types, namely "Gaussian white noise", "local variable" (zero mean Gaussian white noise related to image gray value), "Poisson" (Poisson noise) and "salt &; Pepper' (salt and pepper noise) and' speckle' (speckle noise); Specifically, (2) parameter values can be set according to individual needs; For the rest of the information, if you still don't understand, please refer to the Matlab help file.

Use' salt &; Pepper' (salt and pepper noise), and set its parameter to 0.6. Examples are as follows:

l = im read(' image _ ori . jpg ');

J = imnoise(L,' salt & pepper', 0.6);

imshow(J); //A window pops up immediately to display the image with noise added.

imwrite(J,' image_noise.jpg ',' jpg ',' Quality ', 100); //Store the noise image with the quality of 100%, and the default quality value is 75.

The above program is to add salt and pepper noise to the original image, but pay attention to put the image and the M file of the above program in the same subdirectory.