Package boofcv.alg.transform.fft
Class GeneralPurposeFFT_F64_2D
java.lang.Object
boofcv.alg.transform.fft.GeneralPurposeFFT_F64_2D
Computes 2D Discrete Fourier Transform (DFT) of complex and real, double
precision data. The size of the data can be an arbitrary number. The code originally comes from
General Purpose FFT Package written by Takuya Ooura
(http://www.kurims.kyoto-u.ac.jp/~ooura/fft.html). See below for the full history.
This code has a bit of a history. Originally from General Purpose FFT. Which was then ported into
JFFTPack written by Baoshe Zhang (http://jfftpack.sourceforge.net/), and then into JTransforms by Piotr Wendykier.
The major modification from JTransforms is that the SMP code has been stripped out. It might be added back in
once an SMP strategy has been finalized in BoofCV.
Code License: The original license of General Purpose FFT Package is shown below. This file will fall
under the same license:
Copyright Takuya OOURA, 1996-2001 You may use, copy, modify and distribute this code for any purpose (include commercial use) and without fee. Please refer to this package when you modify this code.
-
Constructor Summary
ConstructorDescriptionGeneralPurposeFFT_F64_2D
(int rows, int columns) Creates new instance of DoubleFFT_2D. -
Method Summary
Modifier and TypeMethodDescriptionvoid
complexForward
(double[] a) Computes 2D forward DFT of complex data leaving the result ina
.void
complexInverse
(double[] a, boolean scale) Computes 2D inverse DFT of complex data leaving the result ina
.void
realForward
(double[] a) Computes 2D forward DFT of real data leaving the result ina
.void
realForwardFull
(double[] a) Computes 2D forward DFT of real data leaving the result ina
.void
realInverse
(double[] a, boolean scale) Computes 2D inverse DFT of real data leaving the result ina
.void
realInverseFull
(double[] a, boolean scale) Computes 2D inverse DFT of real data leaving the result ina
.
-
Constructor Details
-
GeneralPurposeFFT_F64_2D
public GeneralPurposeFFT_F64_2D(int rows, int columns) Creates new instance of DoubleFFT_2D.- Parameters:
rows
- number of rowscolumns
- number of columns
-
-
Method Details
-
complexForward
public void complexForward(double[] a) Computes 2D forward DFT of complex data leaving the result ina
. The data is stored in 1D array in row-major order. Complex number is stored as two double values in sequence: the real and imaginary part, i.e. the input array must be of size rows*2*columns. The physical layout of the input data has to be as follows:
a[k1*2*columns+2*k2] = Re[k1][k2], a[k1*2*columns+2*k2+1] = Im[k1][k2], 0<=k1<rows, 0<=k2<columns,
- Parameters:
a
- data to transform
-
complexInverse
public void complexInverse(double[] a, boolean scale) Computes 2D inverse DFT of complex data leaving the result ina
. The data is stored in 1D array in row-major order. Complex number is stored as two double values in sequence: the real and imaginary part, i.e. the input array must be of size rows*2*columns. The physical layout of the input data has to be as follows:
a[k1*2*columns+2*k2] = Re[k1][k2], a[k1*2*columns+2*k2+1] = Im[k1][k2], 0<=k1<rows, 0<=k2<columns,
- Parameters:
a
- data to transformscale
- if true then scaling is performed
-
realForward
public void realForward(double[] a) Computes 2D forward DFT of real data leaving the result ina
. This method only works when the sizes of both dimensions are power-of-two numbers. The physical layout of the output data is as follows:a[k1*columns+2*k2] = Re[k1][k2] = Re[rows-k1][columns-k2], a[k1*columns+2*k2+1] = Im[k1][k2] = -Im[rows-k1][columns-k2], 0<k1<rows, 0<k2<columns/2, a[2*k2] = Re[0][k2] = Re[0][columns-k2], a[2*k2+1] = Im[0][k2] = -Im[0][columns-k2], 0<k2<columns/2, a[k1*columns] = Re[k1][0] = Re[rows-k1][0], a[k1*columns+1] = Im[k1][0] = -Im[rows-k1][0], a[(rows-k1)*columns+1] = Re[k1][columns/2] = Re[rows-k1][columns/2], a[(rows-k1)*columns] = -Im[k1][columns/2] = Im[rows-k1][columns/2], 0<k1<rows/2, a[0] = Re[0][0], a[1] = Re[0][columns/2], a[(rows/2)*columns] = Re[rows/2][0], a[(rows/2)*columns+1] = Re[rows/2][columns/2]
This method computes only half of the elements of the real transform. The other half satisfies the symmetry condition. If you want the full real forward transform, userealForwardFull
. To get back the original data, userealInverse
on the output of this method.- Parameters:
a
- data to transform
-
realForwardFull
public void realForwardFull(double[] a) Computes 2D forward DFT of real data leaving the result ina
. This method computes full real forward transform, i.e. you will get the same result as fromcomplexForward
called with all imaginary part equal 0. Because the result is stored ina
, the input array must be of size rows*2*columns, with only the first rows*columns elements filled with real data. To get back the original data, usecomplexInverse
on the output of this method.- Parameters:
a
- data to transform
-
realInverse
public void realInverse(double[] a, boolean scale) Computes 2D inverse DFT of real data leaving the result ina
. This method only works when the sizes of both dimensions are power-of-two numbers. The physical layout of the input data has to be as follows:a[k1*columns+2*k2] = Re[k1][k2] = Re[rows-k1][columns-k2], a[k1*columns+2*k2+1] = Im[k1][k2] = -Im[rows-k1][columns-k2], 0<k1<rows, 0<k2<columns/2, a[2*k2] = Re[0][k2] = Re[0][columns-k2], a[2*k2+1] = Im[0][k2] = -Im[0][columns-k2], 0<k2<columns/2, a[k1*columns] = Re[k1][0] = Re[rows-k1][0], a[k1*columns+1] = Im[k1][0] = -Im[rows-k1][0], a[(rows-k1)*columns+1] = Re[k1][columns/2] = Re[rows-k1][columns/2], a[(rows-k1)*columns] = -Im[k1][columns/2] = Im[rows-k1][columns/2], 0<k1<rows/2, a[0] = Re[0][0], a[1] = Re[0][columns/2], a[(rows/2)*columns] = Re[rows/2][0], a[(rows/2)*columns+1] = Re[rows/2][columns/2]
This method computes only half of the elements of the real transform. The other half satisfies the symmetry condition. If you want the full real inverse transform, userealInverseFull
.- Parameters:
a
- data to transformscale
- if true then scaling is performed
-
realInverseFull
public void realInverseFull(double[] a, boolean scale) Computes 2D inverse DFT of real data leaving the result ina
. This method computes full real inverse transform, i.e. you will get the same result as fromcomplexInverse
called with all imaginary part equal 0. Because the result is stored ina
, the input array must be of size rows*2*columns, with only the first rows*columns elements filled with real data.- Parameters:
a
- data to transformscale
- if true then scaling is performed
-