⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 repictured.asv

📁 对图象重建
💻 ASV
字号:
clear all;
close all;

I=imread('Fig5.07(a).jpg');
figure;
imshow(I,[]);
title('原始图像');

I=imnoise(I,'salt & pepper',0.15);
figure;
imshow(I,[]);
title('加椒盐噪声');

%7×7中值滤波
Q=medfilt2(I,[7,7]);
figure;
imshow(Q,[]);
title('7×7中值滤波');

%自适应中值滤波
[M,N]=size(I);
for i=3:7
    if i<=7
        for x=i/2+0.5:M-i/2+0.5
            for y=i/2+0.5:M-i/2+0.5
                z_max=max(I((M*(y-2)+x-(i/2-0.5)):(M*(y-2)+x-(i/2-0.5)+i*M-M)));
                z_min=min(I((M*(y-2)+x-(i/2-0.5)):(M*(y-2)+x-(i/2-0.5)+i*M-M));
                z_med=median(I(M*(y-2)+x-(i/2-0.5):M*(y-2)+x-(i/2-0.5)+i*M-M));
                A1=z_med-z_min;
                A2=z_med-z_max;
                if (A1>0&A2<0)
                    B1=I(x,y)-z_min;
                    B2=I(x,y)-z_max;
                    if (B1>0&B2<0)
                        I(x,y)=I(x,y);
                    else
                        I(x,y)=z_med;
                    end
                else
                    i=i+2;
                end
            end
        end
    else
        I(x,y)=I(x,y);
    end
end

figure;
imshow(I,[]);
title('自适应中值滤波');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -