当前位置:网站首页>Matlab学习10-图像处理之傅里叶变换
Matlab学习10-图像处理之傅里叶变换
2022-08-03 11:30:00 【CHengYuP】
前言
图像变换
- 一维离散变换
- 二维离散变换
- 傅里叶变换
- 离散余弦变换
Matlab学习10-图像处理之傅里叶变换
傅里叶变换
优点:能从空间域和频率域两个不同的角度来看待问信号或图像。
缺点:傅里叶变换的收敛速度慢。
一、离散傅里叶变换
效果
代码
% 离散傅里叶变换示例。显示二维图、对称傅里叶幅度谱图像和傅里叶幅度图对数图像。
fxy=imread("img/F5_11a.bmp");
fxy=rgb2gray(fxy);
subplot(2,2,1),imshow(fxy),xlabel('原始图像');
Fuv=fft2(fxy);
FftShiftAbs=fftshift(abs(Fuv));
subplot(2,2,2),imshow(FftShiftAbs,[]),xlabel('对称傅里叶变换图像');
LogFftShiftAbs=log(FftShiftAbs);
subplot(2,2,3),imshow(LogFftShiftAbs,[]),xlabel('对称傅里叶幅度谱对称图像'),colormap(gray),colorbar;
二、二维离散傅里叶变换
效果
代码
% 二维离散傅里叶变换原理示例,显示二维图、傅里叶变换后的图,对称傅里叶幅度谱图像和他们的三维示意图。
A=1;
X=1;
Y=1;
uu=-1*pi:0.1:1*pi;
vv=-2*pi:0.1:2*pi;
[u,v]=meshgrid(uu,vv);
Fuv=A*X*Y*(sin(pi*u*X).*exp(-j*pi*u*X)./(pi*u*X)).*(sin(pi*v*Y).*exp(-j*pi*v*Y)./(pi*v*Y));
subplot(2,2,1),mesh(u,v,real(Fuv)),xlabel('\itu'),ylabel('\itv'),zlabel('{\itG}({\itu},{\itv})'),title('(a) 傅里叶变换');
subplot(2,2,2),mesh(u,v,abs(Fuv)),xlabel('\itu'),ylabel('\itv'),zlabel('{\itG}({\itu},{\itv})'),title('(b) 傅里叶幅度谱');
subplot(2,2,3),plot(uu,Fuv),xlabel('\itu'),ylabel('{\itG}({\itu})'),title('(c) 傅里叶变换在u轴上的投影'),grid on;
subplot(2,2,4),plot(vv,Fuv),xlabel('\itv'),ylabel('{\itG}({\itv})'),title('(d) 傅里叶变换在v轴上的投影'),grid on;
三、傅里叶级数将周期函数转换为不同正弦波的叠加
效果
代码
% 使用傅里叶级数将周期函数转换为不同正弦波的叠加。
A=2;
x=-5:0.1:5;
%前一次谐波叠代
hold on;
fx1=A/2+2*A/pi*(sin(1*pi*x/2)/1);
fxdd1=fx1;
subplot(2,3,1),plot(x,fxdd1,'k'),xlabel('(a)前一次谐波迭代');
%前两次谐波叠代
hold on;
fx2=A/2+2*A/pi*(sin(1*pi*x/2)/1+sin(3*pi*x/2)/3);
fxdd2=fx1+fx2;
subplot(2,3,2),plot(x,fxdd2,'k'),xlabel('(b)前两次谐波迭代');
%前三次谐波叠代
hold on;
fx3=A/2+2*A/pi*(sin(1*pi*x/2)/1+sin(3*pi*x/2)/3+sin(5*pi*x/2)/5);
fxdd3=fx1+fx2+fx3;
subplot(2,3,3),plot(x,fxdd3,'k'),xlabel('(c)前三次谐波迭代');
%前四次谐波叠代
hold on;
fx4=A/2+2*A/pi*(sin(1*pi*x/2)/1+sin(3*pi*x/2)/3+sin(5*pi*x/2)/5+sin(7*pi*x/2)/7);
fxdd4=fx1+fx2+fx3+fx4;
subplot(2,3,4),plot(x,fxdd4,'k'),xlabel('(d)前四次谐波迭代');
%前五次谐波叠代
hold on;
fx5=A/2+2*A/pi*(sin(1*pi*x/2)/1+sin(3*pi*x/2)/3+sin(5*pi*x/2)/5+sin(7*pi*x/2)/7+sin(9*pi*x/2)/9);
fxdd5=fx1+fx2+fx3+fx4+fx5;
subplot(2,3,5),plot(x,fxdd5,'k'),xlabel('(e)前五次谐波迭代');
%前四十次谐波叠代
hold on;
syms n;
k=symsum(2*A/pi*sin((2*n+1)*pi*x/2)/(2*n+1),0,39);
fxdd80=A/2+subs(k);
subplot(2,3,6),plot(x,fxdd80,'k'),xlabel('(f)前40次谐波迭代'),box off;
边栏推荐
- 微信小程序获取用户手机号码
- Dry goods!A highly structured and sparse linear transformation called Deformable Butterfly (DeBut)
- Traceback (most recent call last): File
- 87.(cesium之家)cesium热力图(贴地形)
- ThreadLocal源码解析及使用场景
- SmobilerService 推送实现
- [Explanation of JDBC and inner classes]
- JS快速高效开发技巧指南(持续更新)
- 【MySQL功法】第2话 · 数据库与数据表的基本操作
- 【MySQL功法】第5话 · SQL单表查询
猜你喜欢
数据库一席谈:打造开源的数据生态,支撑产业数字化浪潮
"Global Digital Economy Conference" landed in N World, Rongyun provides communication cloud service support
How to use outside the PHP command in the container
【Star项目】小帽飞机大战(九)
html网页如何获取后台数据库的数据(html + ajax + php + mysql)
【一起学Rust】Rust的Hello Rust详细解析
【多线程的相关内容】
零拷贝、MMAP、堆外内存,傻傻搞不明白...
How to retrieve IDC research reports?
国内数字藏品与国外NFT主要有以下六大方面的区别
随机推荐
Cross-chain bridge protocol Nomad suffers hacker attack, losing more than $150 million
小身材有大作用——光模块基础知识(一)
【无标题】函数,对象,方法的区别
微信小程序获取用户手机号码
完全背包问题的思路解析
The effects of the background and the Activiti
LeetCode 899 Ordered queue [lexicographical order] HERODING's LeetCode road
基于SSM和Web实现的农作物生长监控系统
字符串本地化和消息字典(二)
基于PHP7.2+MySQL5.7的回收租凭系统
多态详细讲解(简单实现买票系统模拟,覆盖/重定义,多态原理,虚表)
VRRP协议的作用及VRRP+OSPF配置方法
「全球数字经济大会」登陆 N 世界,融云提供通信云服务支持
矩阵的计算[通俗易懂]
数据库一席谈:打造开源的数据生态,支撑产业数字化浪潮
【多线程的相关内容】
How to use outside the PHP command in the container
FR9811S6 SOT-23-6 23V,2A同步降压DC/DC转换器
RICON:NER SOTA 又来!
Polymorphism in detail (simple implementation to buy tickets system simulation, covering/weight definition, principle of polymorphism, virtual table)