Extract low-frequency coefficients of Fourier transformation
1 次查看(过去 30 天)
显示 更早的评论
I'm new to Matlab and to FFT. I have applied the Fourier transformation on an image like so:
I = imread('img.jpg');
img = fftshift(I);
F = fft2(img);
magnitude = mat2gray(100*log(1+abs(fftshift(F)))); % Magnitude spectrum
phase = mat2gray( (angle(F)) ); % Phase spectrum
Using the energy compaction property of the Discrete Fourier Transform how can I extract a 21x21 matrix of the low-frequency value coefficients of the Fourier transformation?
Thanks in advance!
0 个评论
采纳的回答
Wayne King
2013-10-10
编辑:Wayne King
2013-10-10
If you shift the 2-D DFT, then the low frequency components will be in the center of the image: center along the row and column dimensions of the matrix
X = ones(128,128);
Xdft = fftshift(fft2(X));
surf(abs(Xdft));
view(-16,10)
Note that the DC shift is evident in the middle of the image.
The value of Xdft(65,65) is 2^14 as expected. So to extra the low-frequency components, just extract a submatrix around the center of your original matrix.
If you have a simple 2-D complex exponential
x = 0:159;
y = 0:159;
[X,Y] = meshgrid(x,y);
Z = exp(1i*pi/4*(X+Y));
Z = real(Z);
imagesc(Z);
Then note that with a matrix of 160x160, we would expect pi/4 to be shifted from the center (80,80) to (101,101) and (61,61)
Zdft = fftshift(fft2(Z));
imagesc(abs(Zdft))
Zdft(101,101)
Zdft(61,61)
Note they are complex conjugates of each other as expected.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!