clear all;
clear clc;
I=imread('捕获2.png');
I1=rgb2gray(I);
figure
subplot(2,2,1)
imshow(I1);
[w,h,z]=size(I1);
[x,y]=meshgrid(1:h,1:w)
subplot(2,2,2)
mesh(x,y,I1)
colormap jet ;
I2=imnoise(I1,'gaussian',0,0.001);%%%%%%%%%%%%%%%%%%%加入高斯噪声函数,mean=0,standard dev=0.001
subplot(2,2,3)
imshow(I2);
subplot(2,2,4)
mesh(x,y,I2)
colormap jet ;
T=zeros(w,h)
I3=imnoise(I1,'salt & pepper',0.0005);%%%%%%%%%%%%%%%%%%%加入椒盐噪声函数,standard dev=0.0005
sigma=1;
Ig=fspecial('gaussian',[5,5],sigma) ;
img_gauss=imfilter(I2,Ig,'replicate');%%%%%%%%%%%%%%%%%%%%%%matlab自带库高斯滤波函数,滤除噪声
figure
subplot(2,2,1)
imshow(I2)
subplot(2,2,2)
imshow(I3)
subplot(2,2,3)
imshow(img_gauss)
K = med
clear clc;
I=imread('捕获2.png');
I1=rgb2gray(I);
figure
subplot(2,2,1)
imshow(I1);
[w,h,z]=size(I1);
[x,y]=meshgrid(1:h,1:w)
subplot(2,2,2)
mesh(x,y,I1)
colormap jet ;
I2=imnoise(I1,'gaussian',0,0.001);%%%%%%%%%%%%%%%%%%%加入高斯噪声函数,mean=0,standard dev=0.001
subplot(2,2,3)
imshow(I2);
subplot(2,2,4)
mesh(x,y,I2)
colormap jet ;
T=zeros(w,h)
I3=imnoise(I1,'salt & pepper',0.0005);%%%%%%%%%%%%%%%%%%%加入椒盐噪声函数,standard dev=0.0005
sigma=1;
Ig=fspecial('gaussian',[5,5],sigma) ;
img_gauss=imfilter(I2,Ig,'replicate');%%%%%%%%%%%%%%%%%%%%%%matlab自带库高斯滤波函数,滤除噪声
figure
subplot(2,2,1)
imshow(I2)
subplot(2,2,2)
imshow(I3)
subplot(2,2,3)
imshow(img_gauss)
K = med