?? filer_by_matlab.txt
字號:
i=imread('cameraman.tif');
subplot(2,2,1);
imshow(i);
title('原圖');
axis square;
j=imnoise(i,'gaussian',0,0.1);
subplot(2,2,2);
imshow(j);
title('加噪圖像');
axis square;
%用sym4小波函數對j進行2層分解
[c,l]=wavedec2(j,2,'sym4');
%實現低通濾波消噪
a1=uint8(wrcoef2('a',c,l,'sym4',2));
%用coif2小波函數對j進行2層分解
[gc,gl]=wavedec2(a1,2,'coif2');
n=[1,2];%設置尺度向量
p=[10.28,24.08];%設置閾值向量
%對三個高頻系數進行閾值處理
nc=wthcoef2('h',gc,gl,n,p,'s');
nc=wthcoef2('v',gc,gl,n,p,'s');
nc=wthcoef2('d',gc,gl,n,p,'s');
mc=wthcoef2('h',gc,gl,n,p,'s');
mc=wthcoef2('v',gc,gl,n,p,'s');
mc=wthcoef2('d',gc,gl,n,p,'s');
%對更新后的小波分解結構進行閾值處理
x2=waverec2(mc,gl,'coif2');
%進行中值濾波
for ii=1:252;
for jj=1:252;
temp=0;
for m=0:3
for n=0:3
temp=temp+double(x2(ii+m,jj+n));
end
end
temp=temp/16;
x4(ii,jj)=temp;
end
end
for ii=253:256
for jj=253:256
x4(ii,jj)=double(i(ii,jj));
end
end
%顯示去噪圖像
subplot(2,2,3);
imshow(uint8(x4));
title('消噪圖像');
axis square;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -