|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
如何利用MATLAB自带的傅里叶变换进行图像处理
S' j4 p5 H. V, W" u( f2 B/ o: h7 E0 {
, r! z: P; G1 ]; x9 [. y
代码如下:
: i G; u0 @ X q1 w5 T3 a" e0 m5 l* ]) |/ O
- i& e$ e/ d. d( h% Y) ~( t/ \
- clear;
- clc;
-
- img=imread('test.jpg');
- img=rgb2gray(img);
-
- f=fft2(img); %傅里叶变换
- f=fftshift(f); %使图像对称
- r=real(f); %求图像频域实部
- i=imag(f); %求图像频域虚部
- margin=log(abs(f)); %图像幅度谱,加log便于显示
- phase=log(angle(f)*180/pi); %图像相位谱
- l=log(f);
-
- subplot(2,2,1),imshow(img),title('源图像');
- subplot(2,2,2),imshow(l,[]),title('频谱');
- subplot(2,2,3),imshow(margin,[]),title('幅度谱');
- subplot(2,2,4),imshow(phase,[]),title('相位谱');7 M% R6 K" Z/ J4 z% `
2 d7 P! U% m; x" U- O( k1 q
3 H& a0 m+ K5 M0 V Y6 u/ U- A# O2 c7 `
) P' S8 f0 I% W" G+ h9 Z
- {! |0 r0 }% c9 F6 U+ c+ | |
|