可以仅在Matlab中使用fft1d来帮助我找到图像的fft2d

时间:2019-05-19 22:56:01

标签: matlab fft

clear all;close all;clc;


Image = imread("aerial.tiff");

f = double(Image) ;


%2D DFT 
F1 = fft2(f);

M=size(f,1);
N=size(f,2);

for i = 1:N

 F2(i,:) = fft(f(i,:)); 

end

1 个答案:

答案 0 :(得分:1)

在MATLAB documentation中,fft2定义为:

  • fft在列上,然后是fft在行上。

此外,如果您打开fft2代码,则会发现:

f = fft(fft(x,[],2),[],1);

此代码可以为您提供帮助:

clear;close all;clc;

Image = phantom(256);

f = double(Image);

%2D DFT 
F1 = fft2(f);

M=size(f,1);
N=size(f,2);

% 2D FFT by twice 1D FFT
F2 = fft(fft(f,[],2),[],1);

% Difference between the results
diff = F2 - F1;
[min(min(diff)) max(max(diff))]

subplot(1,2,1)
imshow(30.*log(abs(fftshift(F1)) + 1),[])
title('FFT using fft2')

subplot(1,2,2)
imshow(30.*log(abs(fftshift(F2)) + 1),[])
title('FFT using fft twice')