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

📄 center_weighted_median_filter.m

📁 用MATLABT算法实现, 图象经过center weighted median filter后,对比 原图象和处理过图象的差别.
💻 M
字号:
the image. The matlab code has been presenting:
function g = median_filter1(f,m)
[height, width]= size(f); 
g = zeros(height, width); 
for y = 1:height
    for x = 1:width
        x1 = x - 2; 
        x2 = x + 2; 
        y1 = y - 2;
        y2 = y + 2;
        if x1 < 1
            x1 = 1;
        end
        
        if x2 > width
            x2 = width;
        end
 
        if y1 < 1
            y1 = 1;
        end
        
        if y2 > height
            y2 = height;
        end
        window = f(y1:y2, x1:x2); 
        window = window(:);  
        window1=[window;repmat(f(y,x),m,1)];
        g(y, x) = median(window); 
    end
end
g = uint8(g); imshow(g); 
 
clear all
m1=1;
m2=4;
m3=24;
a=imread('lena-salt-pepper-noise.bmp');
g1=median_filter(a);
g2=median_filter1(a,m1);
g3=median_filter1(a,m2);
g4=median_filter1(a,m3);
subplot(2,2,1);imshow(g1);title('median');
subplot(2,2,2);imshow(g2);title('CWM with 1');
subplot(2,2,3);imshow(g3);title('CWM with 4');
subplot(2,2,4);imshow(g4);title('CWM with 24');

⌨️ 快捷键说明

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