I = rgb2gray(imread('D:\matblab_21b\projects\picture\test.tif')); IA = imnoise(I, 'salt & pepper'); %% 加入椒盐噪声 subplot(222), imshow(IA); title('加入椒盐噪声后的图像'); [f1, f2] = freqspace(size(IA), 'meshgrid'); D = 100 / size(IA, 1); r = f1.^2 + f2.^2; Hd = ones(size(IA)); for i = 1:size(IA, 1) for j = 1:size(IA, 2) t = r(i, j) / (D * D); Hd(i, j) = exp(-t); end end Y = fft2(double(IA)); Y = fftshift(Y); Ya = Y .* Hd; Ya = ifftshift(Ya); Ia = real(ifft2(Ya)); subplot(221), imshow(uint8(I)); title('原图像'); subplot(223), imshow(uint8(Ia)); title('高斯低通滤波处理'); subplot(224), imshow(medfilt2(IA)); title('中值滤波处理');

MATLAB 椒盐噪声图像处理:高斯低通滤波与中值滤波对比

原文地址: https://www.cveoy.top/t/topic/nAqx 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录