基于Matlab的图像去除噪声的研究
来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:综合作业 时间:2024/07/22 09:34:02
基于Matlab的图像去除噪声的研究
![](http://img.wesiedu.com/upload/2/6c/26c8178e62e097a1b8f8585160b64fff.jpg)
改图加入的是cos函数噪声,怎么去除?
![](http://img.wesiedu.com/upload/2/6c/26c8178e62e097a1b8f8585160b64fff.jpg)
改图加入的是cos函数噪声,怎么去除?
![基于Matlab的图像去除噪声的研究](/uploads/image/z/16157113-25-3.jpg?t=%E5%9F%BA%E4%BA%8EMatlab%E7%9A%84%E5%9B%BE%E5%83%8F%E5%8E%BB%E9%99%A4%E5%99%AA%E5%A3%B0%E7%9A%84%E7%A0%94%E7%A9%B6)
对这种周期性的噪声,可以用低通滤波器对付
%%%%%%%%%%%%%%%%%%%%% 图像滤波 %%%%%%%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)),[ ]);
效果:![](http://img.wesiedu.com/upload/4/a2/4a2fd03a8174224379895293af047285.jpg)
滤波器模板:![](http://img.wesiedu.com/upload/2/bd/2bd7fd1c76075a86078584453ddd5e70.jpg)
没有来得及优化,所以缺点是运行比较慢,耐心等候!
%%%%%%%%%%%%%%%%%%%%% 图像滤波 %%%%%%%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)),[ ]);
效果:
![](http://img.wesiedu.com/upload/4/a2/4a2fd03a8174224379895293af047285.jpg)
滤波器模板:
![](http://img.wesiedu.com/upload/2/bd/2bd7fd1c76075a86078584453ddd5e70.jpg)
没有来得及优化,所以缺点是运行比较慢,耐心等候!