基于Matlab的图像去除噪声的研究
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/14 16:45:40
基于Matlab的图像去除噪声的研究
改图加入的是cos函数噪声,怎么去除?
改图加入的是cos函数噪声,怎么去除?
对这种周期性的噪声,可以用低通滤波器对付
%%%%%%%%%%%%%%%%%%%%% 图像滤波 %%%%%%%f=imread('test2.gif');F=fft2(double(f));
F=fftshift(F);%构造理想低通滤波器,并用它滤波
[height width]=size(F);H(1: height,1: width)=0;x0= height /2; y0= width /2;for x=1:height for y=1:width if(sqrt((x- x0)*(x- x0)+(y-y0)*(y- y0))<32) H(x,y)=1; end FF(x,y)=F(x,y)*H(x,y); endend% 傅里叶反变换g=ifft2(FF);% 显示并比较结果figure(1), imshow(f);figure(2), imshow(log(abs(F)+1),[ ]);figure(3), imshow(log(abs(FF)+1),[ ]);figure(4),imshow(abs(real(g)),[ ]);
效果:
滤波器模板:
没有来得及优化,所以缺点是运行比较慢,耐心等候!
%%%%%%%%%%%%%%%%%%%%% 图像滤波 %%%%%%%f=imread('test2.gif');F=fft2(double(f));
F=fftshift(F);%构造理想低通滤波器,并用它滤波
[height width]=size(F);H(1: height,1: width)=0;x0= height /2; y0= width /2;for x=1:height for y=1:width if(sqrt((x- x0)*(x- x0)+(y-y0)*(y- y0))<32) H(x,y)=1; end FF(x,y)=F(x,y)*H(x,y); endend% 傅里叶反变换g=ifft2(FF);% 显示并比较结果figure(1), imshow(f);figure(2), imshow(log(abs(F)+1),[ ]);figure(3), imshow(log(abs(FF)+1),[ ]);figure(4),imshow(abs(real(g)),[ ]);
效果:
滤波器模板:
没有来得及优化,所以缺点是运行比较慢,耐心等候!