|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
如何利用MATLAB自带的傅里叶变换进行图像处理
1 C3 [- _# F4 P" u. s: e: w. V; A' L6 e; A# B; G0 Z
: `; c3 S" z0 B( E) t' |代码如下:$ b' O% z/ y' j( }) V* f/ t' R" i
7 x r$ i3 b5 C5 E
* g# \7 v9 K0 X2 a- 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 A4 p$ t ?* h! V" w4 u' r
; p" _3 `# s b1 ~4 S! o- R" j; \0 v4 R& v
0 B' Q! c5 H5 O: M$ w3 A6 d- f, H3 M7 F! Z/ f- a
; x$ ^# U9 a' N, h
|
|