www.gusucode.com > images 案例代码 matlab源码程序 > images/AddNoiseToAnImageExample.m

    %% Add noise to an image.
% Add noise to an image.
%%

% Copyright 2015 The MathWorks, Inc.

I = imread('eight.tif');
J = imnoise(I,'salt & pepper',0.02);
figure, imshow(I)
figure, imshow(J)