?? center_weighted_median_filter.m
字號(hào):
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');
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -