Image Processing Toolbox | ![]() ![]() |
Compute two-dimensional fast Fourier transform
Syntax
B = fft2(A)
B = fft2(A,
m,n)
Description
B = fft2(A)
performs a two-dimensional fast Fourier transform (FFT), returning the result in B
. B
is the same size as A
; if A
is a vector, B
has the same orientation as A
.
B = fft2(A,m,n)
truncates or zero pads A
, if necessary, to create an m
-by-n
matrix before performing the FFT. The result B
is also m
-by-n
.
Class Support
The input matrix A
can be of class double
or of any integer class. The output matrix B
is of class double
.
Remarks
Example
load imdemos saturn2 imshow(saturn2) B = fftshift(fft2(saturn2)); imshow(log(abs(B)),[],'notruesize'), colormap(jet(64)), colorbar
Algorithm
fft(fft(A).').'
This computes the one-dimensional fft
of each column A
, then of each row of the result. The time required to compute fft2(A)
depends on the number of prime factors of m
and n
. fft2
is fastest when m
and n
are powers of 2.
See Also
fft
, ifft
in the MATLAB Function Reference
![]() | erode | fftn | ![]() |