空域滤波增强
First : imnoise()
clc;close all;I = imread('图片2.jpg');subplot(121),imshow(I);title('原始图像');J = imnoise(I,'salt & pepper');subplot(122),imshow(J);title('加入椒盐噪声后的图像')
RESULT
空域滤波过程
Spocess
clc;close all;I = imread('图片2.jpg');subplot(231),imshow(I);title('原始图像');I = rgb2gray(I);J = imnoise(I,'salt & pepper',0.03);% 加均值为0,方差为0.03的椒盐噪声subplot(232),imshow(J);title('加入椒盐噪声后的图像')K = filter2(fspecial('average',3),J)/255; % 进行“相关”计算% 注:fspecial()函数可产生 ‘average’, ‘gaussian’, ‘motion’, ‘sobel’, ‘laplacian’, ‘log’ , ‘unsharp’ 等多种特殊滤波器subplot(233),imshow(K,[]);title('椒盐噪声被均值滤波后的图像');J2 = imnoise(I,'gaussian',0.03); %% 加均值为0,方差为0.03的高斯噪声subplot(234),imshow(J2);title('加入高斯噪声后的图像');K2 = medfilt2(J2); % 图像滤波处理(中值滤波函数)subplot(235),imshow(K2,[]);title('高斯噪声被中值滤波后的图像');K3 = filter2(fspecial('average',5),J)/255; %