数字图像-频域处理
2014-04-21 08:14
204 查看
冈萨雷斯第三版,频域处理代码示例:
% 低通滤波
clc, clear,
I = imread('blown_ic.tif');
[r,c] = size(I);
subplot(331),imshow(I);title('Origin');
Id = padarray(I,[r,c],'post');
subplot(332),imshow(Id);title('pad array');
for i = 1:2*r
for j = 1:2*c
hp(i,j) = (-1)^(i-1+j-1);
end
end
Ip = hp.*double(Id);
subplot(333),imshow(Ip,[]);title('shift array');
F = fft2(Ip);% padding of H
subplot(334),imshow(log(1+abs(F)),[]);title('spectrum of F');
H = lpfilter('gaussian',2*r,2*c,50,1);%
subplot(335),imshow(H,[]);title('H');
G = H.*F;
subplot(336),imshow(G);title('G=H.*F ');
gp = hp.*real(ifft2(G));% filtering
subplot(337),imshow(gp,[]);title('gp ');
g = gp(1:r,1:c);% cropped images
subplot(338),imshow(g,[]);title('g ');
% 低通滤波
clc, clear,
I = imread('blown_ic.tif');
[r,c] = size(I);
subplot(331),imshow(I);title('Origin');
Id = padarray(I,[r,c],'post');
subplot(332),imshow(Id);title('pad array');
for i = 1:2*r
for j = 1:2*c
hp(i,j) = (-1)^(i-1+j-1);
end
end
Ip = hp.*double(Id);
subplot(333),imshow(Ip,[]);title('shift array');
F = fft2(Ip);% padding of H
subplot(334),imshow(log(1+abs(F)),[]);title('spectrum of F');
H = lpfilter('gaussian',2*r,2*c,50,1);%
subplot(335),imshow(H,[]);title('H');
G = H.*F;
subplot(336),imshow(G);title('G=H.*F ');
gp = hp.*real(ifft2(G));% filtering
subplot(337),imshow(gp,[]);title('gp ');
g = gp(1:r,1:c);% cropped images
subplot(338),imshow(g,[]);title('g ');
相关文章推荐
- C#的as, is和类型强制转换
- 如何在快速启动栏创建快捷方式
- python while statement
- 管理体制的重要性
- 管理,标准的重要性
- 使用PHPnow在本地搭建服务器并建站
- 【ZJOI2007】仓库建设
- 前置声明的危险
- man page里的manual section的定义
- man page里的manual section的定义
- 开源 免费 java CMS - FreeCMS1.8 留言管理
- 第6,7周自学内容
- Eclipse调试安卓工程下的.java代码
- python入门科普IDE工具和编译环境
- makefile
- 中医治疗女子不孕--知足老师医案
- 北京最好的体检中心 - 美兆体检
- 关于类的sizeof()
- 03_Linux FTP
- Team--时代团队 Daily Scrum 4.16