|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
如何利用MATLAB自带的傅里叶变换进行图像处理
# S" f( W# y5 s" c* i* j0 S# K' G- l& ^& g
, y g/ B3 K% {5 w9 J/ C& H代码如下:3 B( @1 c" C ] R8 i7 C3 Z2 j
( {8 ~9 j! d* ~; T
1 H: y9 D- b6 v3 Y) 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('相位谱');5 }6 Z( F% G1 B* n" C F
6 g. I8 y5 v8 a( K2 }( t0 k
- i, W# N+ U1 U O5 ]; o
^6 o7 D+ U' z9 ^4 W9 A
* }! \8 |# e5 d9 |
" J$ h g% g, C4 ` |
|