直接上源码: close all clear all clc % 读取图像 I = imread('lena.bmp'); I = rgb2gray(I); J =imnoise(I, 'salt & pepper'