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

📄 filer_by_matlab.txt

📁 维纳滤波器实现中值滤波
💻 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 + -