Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions | Variables
icl::math::fft Namespace Reference

Functions

template<typename T1 , typename T2 >
ICLMath_IMP std::complex< T2 > * fft (unsigned int n, const T1 *data)
 1dfft computation (fallback) More...
 
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix
< std::complex< T2 > > & 
fft2D_cpp (const DynMatrix< T1 > &src, DynMatrix< std::complex< T2 > > &dst, DynMatrix< std::complex< T2 > > &buf)
 2dfft computation (fallback) More...
 
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix
< std::complex< T2 > > & 
fft2D (const DynMatrix< T1 > &src, DynMatrix< std::complex< T2 > > &dst, DynMatrix< std::complex< T2 > > &buf)
 2dfft computation More...
 
template<typename T1 , typename T2 >
ICLMath_IMP std::complex< T2 > * dft (unsigned int n, T1 *matrix)
 1d dft computation More...
 
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix
< std::complex< T2 > > & 
dft2D (DynMatrix< T1 > &src, DynMatrix< std::complex< T2 > > &dst, DynMatrix< std::complex< T2 > > &buf)
 2d dft computation More...
 
template<typename T1 , typename T2 >
ICLMath_IMP std::complex< T2 > * ifft_cpp (unsigned int n, const T1 *matrix)
 1d ifft computation More...
 
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix
< std::complex< T2 > > & 
ifft2D_cpp (const DynMatrix< T1 > &src, DynMatrix< std::complex< T2 > > &dst, DynMatrix< std::complex< T2 > > &buf)
 2d ifft computation (fallback) More...
 
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix
< std::complex< T2 > > & 
ifft2D (const DynMatrix< T1 > &src, DynMatrix< std::complex< T2 > > &dst, DynMatrix< std::complex< T2 > > &buf)
 2d ifft computation More...
 
template<typename T1 , typename T2 >
ICLMath_IMP std::complex< T2 > * idft (unsigned int n, T1 *matrix)
 1d idft computation More...
 
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix
< std::complex< T2 > > & 
idft2D (DynMatrix< T1 > &src, DynMatrix< std::complex< T2 > > &dst, DynMatrix< std::complex< T2 > > &buf)
 2d idft computation More...
 
template<typename T >
ICLMath_IMP DynMatrix< T > & fftshift (DynMatrix< T > &src, DynMatrix< T > &dst) throw (InvalidMatrixDimensionException)
 shifts upper left corner to center. More...
 
template<typename T >
ICLMath_IMP DynMatrix< T > & ifftshift (DynMatrix< T > &src, DynMatrix< T > &dst) throw (InvalidMatrixDimensionException)
 invers function to fftshift. More...
 
template<typename T >
ICLMath_IMP DynMatrix< T > & powerspectrum (const DynMatrix< std::complex< T > > &src, DynMatrix< T > &dst)
 computes the powerspectrum More...
 
template<typename T >
ICLMath_IMP DynMatrix< T > & logpowerspectrum (const DynMatrix< std::complex< T > > &src, DynMatrix< T > &dst)
 computes the logpowerspectrum More...
 
template<typename T >
ICLMath_IMP DynMatrix< T > & makeborder (const DynMatrix< T > &src, DynMatrix< T > &dst, T borderFill)
 creates border with given value More...
 
template<typename T >
ICLMath_IMP DynMatrix< T > & mirrorOnCenter (const DynMatrix< T > &src, DynMatrix< T > &dst)
 mirrors the sourcematrix More...
 
template<typename T >
ICLMath_IMP DynMatrix< T > & continueMatrixToPowerOf2 (const DynMatrix< T > &src, DynMatrix< T > &dst)
 appends copies of sourcematrix beside and under it More...
 
ICLMath_API int nextPowerOf2 (int n)
 Returns the next value greater then n to power of 2. More...
 
ICLMath_API int priorPowerOf2 (int n)
 Returns the prior value lower then n to power of 2. More...
 
template<typename T >
ICLMath_IMP void split_complex (const DynMatrix< std::complex< T > > &src, DynMatrix< T > &real, DynMatrix< T > &img)
 split complexmatrix into realmatrix and imaginarymatrix More...
 
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix< T2 > & imagpart (const DynMatrix< std::complex< T1 > > &src, DynMatrix< T2 > &dst)
 returns imaginary part complex matrix More...
 
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix< T2 > & realpart (const DynMatrix< std::complex< T1 > > &src, DynMatrix< T2 > &dst)
 returns real part of complex matrix More...
 
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix< T2 > & magnitude (const DynMatrix< std::complex< T1 > > &src, DynMatrix< T2 > &dst)
 returns the magnitude of complex matrix More...
 
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix< T2 > & phase (const DynMatrix< std::complex< T1 > > &src, DynMatrix< T2 > &dst)
 return phase of complexmatrix More...
 
template<typename T >
ICLMath_IMP void split_magnitude_phase (const DynMatrix< std::complex< T > > &src, DynMatrix< T > &mag, DynMatrix< T > &phase)
 splits complexmatrix into magnitude and phase More...
 
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix
< std::complex< T2 > > & 
joinComplex (const DynMatrix< T1 > &real, const DynMatrix< T1 > &im, DynMatrix< std::complex< T2 > > &dst)
 joins to matrices to one complex More...
 

Variables

static const double FFT_2_PI = 2.0*3.1415926535897932384626433832795288419716939937510
 2*PI More...
 
static const double FFT_PI = 3.1415926535897932384626433832795288419716939937510
 PI. More...
 
static const double FFT_PI_HALF = 1.5707963267948966192313216916397644209858469968755
 PI/2. More...
 

Function Documentation

template<typename T >
ICLMath_IMP DynMatrix<T>& icl::math::fft::continueMatrixToPowerOf2 ( const DynMatrix< T > &  src,
DynMatrix< T > &  dst 
)

appends copies of sourcematrix beside and under it

Resizes the sourcematrix to the next power of 2 and copies the sourcematrix as far as possible into the destinationmatrix, starting at 0,0.

Parameters
srcthe sourcematrix
dstthe destinationmatrix
Returns
the destinationmatrix
template<typename T1 , typename T2 >
ICLMath_IMP std::complex<T2>* icl::math::fft::dft ( unsigned int  n,
T1 *  matrix 
)

1d dft computation

Computes the 1D Diskrete-Fourier-Transformation for given data. Possible inputdatatypes are: icl8u, icl16u, icl32u, icl16s, icl32s, icl32f, icl64f, std::complex<icl32f>, std::complex<icl64f>. Possible outputdatatype are std::complex<icl32f> and std::complex<icl64f>

Parameters
nsize of the dataarray
matrixthe dataarray
Returns
array of fftvalues for data
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix<std::complex<T2> >& icl::math::fft::dft2D ( DynMatrix< T1 > &  src,
DynMatrix< std::complex< T2 > > &  dst,
DynMatrix< std::complex< T2 > > &  buf 
)

2d dft computation

Computes the 2D Diskrete-Fourier-Transformation for given data. Possible inputdatatypes are: icl8u, icl16u, icl32u, icl16s, icl32s, icl32f, icl64f, std::complex<icl32f>, std::complex<icl64f>. Possible outputdatatype are std::complex<icl32f> and std::complex<icl64f>

Parameters
srcdatamatrix of size MxN
dstdestinationmatrix of size MxN
bufbuffermarix of size NxM
Returns
matrix of fftvalues for datamatrix
template<typename T1 , typename T2 >
ICLMath_IMP std::complex<T2>* icl::math::fft::fft ( unsigned int  n,
const T1 *  data 
)

1dfft computation (fallback)

Computes the 1D Fast-Fourier-Transformation for given data. If the size of the dataarray is a power of 2, the fft is performed, else the dft is performed on the datapart, on which fft does not work. Possible inputdatatypes are: icl8u, icl16u, icl32u, icl16s, icl32s, icl32f, icl64f, std::complex<icl32f>, std::complex<icl64f>. Possible outputdatatype are std::complex<icl32f> and std::complex<icl64f>

Parameters
nsize of the dataarray
datathe dataarray
Returns
array of fftvalues for data
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix<std::complex<T2> >& icl::math::fft::fft2D ( const DynMatrix< T1 > &  src,
DynMatrix< std::complex< T2 > > &  dst,
DynMatrix< std::complex< T2 > > &  buf 
)

2dfft computation

Computes the 2D Fast-Fourier-Transformation for given data. Uses MKL or IPP if available, else fft2D_cpp (fallback). Possible inputdatatypes are: icl8u, icl16u, icl32u, icl16s, icl32s, icl32f, icl64f, std::complex<icl32f>, std::complex<icl64f>. Possible outputdatatype are std::complex<icl32f> and std::complex<icl64f>

Parameters
srcdatamatrix of size MxN
dstdestinationmatrix of size MxN
bufbuffermatrix of size NxM !!!
Returns
matrix of fftvalues for datamatrix
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix<std::complex<T2> >& icl::math::fft::fft2D_cpp ( const DynMatrix< T1 > &  src,
DynMatrix< std::complex< T2 > > &  dst,
DynMatrix< std::complex< T2 > > &  buf 
)

2dfft computation (fallback)

Computes the 2D Fast-Fourier-Transformation for given data. Works even if datasize is not a power of 2. Possible inputdatatypes are: icl8u, icl16u, icl32u, icl16s, icl32s, icl32f, icl64f, std::complex<icl32f>, std::complex<icl64f>. Possible outputdatatype are std::complex<icl32f> and std::complex<icl64f>

Parameters
srcdatamatrix of size MxN
dstdestinationmatrix of size MxN
bufbuffermatrix of size NxM !!!
Returns
matrix of fftvalues for datamatrix
template<typename T >
ICLMath_IMP DynMatrix<T>& icl::math::fft::fftshift ( DynMatrix< T > &  src,
DynMatrix< T > &  dst 
)
throw (InvalidMatrixDimensionException
)

shifts upper left corner to center.

Shifts the upper left corner of the matrix into the center of it.

Parameters
srcdatamatrix to be shifted
dstdestinationmatrix
Returns
destinationmatrix
template<typename T1 , typename T2 >
ICLMath_IMP std::complex<T2>* icl::math::fft::idft ( unsigned int  n,
T1 *  matrix 
)

1d idft computation

Computes the 1D Inverse-Diskrete-Fourier-Transformation for given data.

Parameters
nsize of the dataarray
matrixthe dataarray
Returns
array of fftvalues for data
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix<std::complex<T2> >& icl::math::fft::idft2D ( DynMatrix< T1 > &  src,
DynMatrix< std::complex< T2 > > &  dst,
DynMatrix< std::complex< T2 > > &  buf 
)

2d idft computation

Computes the 2D Inverse-Diskrete-Fourier-Transformation for given data.

Parameters
srcdatamatrix of size MxN
dstdestinationmatrix of size MxN
bufbuffermarix of size NxM
Returns
matrix of ifftvalues for datamatrix
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix<std::complex<T2> >& icl::math::fft::ifft2D ( const DynMatrix< T1 > &  src,
DynMatrix< std::complex< T2 > > &  dst,
DynMatrix< std::complex< T2 > > &  buf 
)

2d ifft computation

Computes the 2D Inverse-Fast-Fourier-Transformation. Uses MKL or IPP if available, else ifft2D_cpp. Possible inputdatatypes are: icl8u, icl16u, icl32u, icl16s, icl32s, icl32f, icl64f, std::complex<icl32f>, std::complex<icl64f>.

Parameters
srcdatamatrix of size MxN
dstdestinationmatrix of size MxN
bufbuffermarix of size NxM
Returns
matrix of ifftvalues for datamatrix
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix<std::complex<T2> >& icl::math::fft::ifft2D_cpp ( const DynMatrix< T1 > &  src,
DynMatrix< std::complex< T2 > > &  dst,
DynMatrix< std::complex< T2 > > &  buf 
)

2d ifft computation (fallback)

Computes the 2D Inverse-Fast-Fourier-Transformation. Possible inputdatatypes are: icl8u, icl16u, icl32u, icl16s, icl32s, icl32f, icl64f, std::complex<icl32f>, std::complex<icl64f>.

Parameters
srcdatamatrix of size MxN
dstdestinationmatrix of size MxN
bufbuffermarix of size NxM
Returns
matrix of ifftvalues for datamatrix
template<typename T1 , typename T2 >
ICLMath_IMP std::complex<T2>* icl::math::fft::ifft_cpp ( unsigned int  n,
const T1 *  matrix 
)

1d ifft computation

Computes the 1D Inverse-Fast-Fourier-Transformation. Possible inputdatatypes are: icl8u, icl16u, icl32u, icl16s, icl32s, icl32f, icl64f, std::complex<icl32f>, std::complex<icl64f>.

Parameters
nsize of the dataarray
matrixthe dataarray
Returns
array of ifftvalues for data
template<typename T >
ICLMath_IMP DynMatrix<T>& icl::math::fft::ifftshift ( DynMatrix< T > &  src,
DynMatrix< T > &  dst 
)
throw (InvalidMatrixDimensionException
)

invers function to fftshift.

Shifts the center of the matrix into the upper left corner .

Parameters
srcdatamatrix to be shifted
dstdestinationmatrix
Returns
destinationmatrix
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix<T2>& icl::math::fft::imagpart ( const DynMatrix< std::complex< T1 > > &  src,
DynMatrix< T2 > &  dst 
)

returns imaginary part complex matrix

Computes and returns the imaginary part of a matrix with complex values.

Parameters
srcthe sourcematrix
dstthe destinationmatrix
Returns
the destinationmatrix
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix<std::complex<T2> >& icl::math::fft::joinComplex ( const DynMatrix< T1 > &  real,
const DynMatrix< T1 > &  im,
DynMatrix< std::complex< T2 > > &  dst 
)

joins to matrices to one complex

Parameters
realmatrix for realpart
immatrix for imaginary part
dstdestinationmatrix
template<typename T >
ICLMath_IMP DynMatrix<T>& icl::math::fft::logpowerspectrum ( const DynMatrix< std::complex< T > > &  src,
DynMatrix< T > &  dst 
)

computes the logpowerspectrum

Computes and returns the log of the powerspectrum of a matrix with complex values.

Parameters
srcthe sourcematrix
dstthe destinationmatrix
Returns
the destinationmatrix
template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix<T2>& icl::math::fft::magnitude ( const DynMatrix< std::complex< T1 > > &  src,
DynMatrix< T2 > &  dst 
)

returns the magnitude of complex matrix

Computes and returns the magnitude of a matrix with complex values.

Parameters
srcthe sourcematrix
dstthe destinationmatrix
Returns
the destinationmatrix
template<typename T >
ICLMath_IMP DynMatrix<T>& icl::math::fft::makeborder ( const DynMatrix< T > &  src,
DynMatrix< T > &  dst,
borderFill 
)

creates border with given value

Resizes the sourcematrix to the next power of 2, centers the original matrix and fills the border with the given value.

Parameters
srcthe sourcematrix
dstthe destinationmatrix
borderFillNumber for filling the border
Returns
the destinationmatrix
template<typename T >
ICLMath_IMP DynMatrix<T>& icl::math::fft::mirrorOnCenter ( const DynMatrix< T > &  src,
DynMatrix< T > &  dst 
)

mirrors the sourcematrix

Resizes the sourcematrix to the next power of 2, centers the original matrix and mirrors it at its borders.

Parameters
srcthe sourcematrix
dstthe destinationmatrix
Returns
the destinationmatrix
ICLMath_API int icl::math::fft::nextPowerOf2 ( int  n)

Returns the next value greater then n to power of 2.

template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix<T2>& icl::math::fft::phase ( const DynMatrix< std::complex< T1 > > &  src,
DynMatrix< T2 > &  dst 
)

return phase of complexmatrix

Computes and returns the phase of a matrix with complex values.

Parameters
srcthe sourcematrix
dstthe destinationmatrix
Returns
the destinationmatrix
template<typename T >
ICLMath_IMP DynMatrix<T>& icl::math::fft::powerspectrum ( const DynMatrix< std::complex< T > > &  src,
DynMatrix< T > &  dst 
)

computes the powerspectrum

Computes and returns the powerspectrum of a matrix with complex values.

Parameters
srcthe sourcematrix
dstthe destinationmatrix
Returns
the destinationmatrix
ICLMath_API int icl::math::fft::priorPowerOf2 ( int  n)

Returns the prior value lower then n to power of 2.

template<typename T1 , typename T2 >
ICLMath_IMP DynMatrix<T2>& icl::math::fft::realpart ( const DynMatrix< std::complex< T1 > > &  src,
DynMatrix< T2 > &  dst 
)

returns real part of complex matrix

Computes and returns the real part of a matrix with complex values.

Parameters
srcthe sourcematrix
dstthe destinationmatrix
Returns
the destinationmatrix
template<typename T >
ICLMath_IMP void icl::math::fft::split_complex ( const DynMatrix< std::complex< T > > &  src,
DynMatrix< T > &  real,
DynMatrix< T > &  img 
)

split complexmatrix into realmatrix and imaginarymatrix

Splits a matrix with complex values into two matrices with real and imaginary parts as values.

Parameters
srcthe sourcematrix with complex values
realthe destinationmatrix for the realparts
imgthe destinationmatrix for the imaginaryparts
template<typename T >
ICLMath_IMP void icl::math::fft::split_magnitude_phase ( const DynMatrix< std::complex< T > > &  src,
DynMatrix< T > &  mag,
DynMatrix< T > &  phase 
)

splits complexmatrix into magnitude and phase

Splits a matrix with complex values into two matrices with magnitude and phase as values.

Parameters
srcthe sourcematrix with complex values
magthe destinationmatrix for the magnitudevalues
phasethe destinationmatrix for the phasevalues

Variable Documentation

const double icl::math::fft::FFT_2_PI = 2.0*3.1415926535897932384626433832795288419716939937510
static

2*PI

const double icl::math::fft::FFT_PI = 3.1415926535897932384626433832795288419716939937510
static

PI.

const double icl::math::fft::FFT_PI_HALF = 1.5707963267948966192313216916397644209858469968755
static

PI/2.