Computes the Fast Fourier transform of an image or the Inverse Fast Fourier transform as specified in the uFlags.
virtual L_INT LBitmap::FFT (pFTArray, uFlags)
Pointer to FTARRAY structure. The acxData member of the FTARRAY structure is a two-dimensional array that will hold the frequency components of the image. Its size must be the same as the image. The function will fill the array elements using data from pBitmap when FFT_FFT flag is passed. The function will use the array values and reconstruct pBitmap when FFT_IFFT flag is passed.
Flags that indicate the transformation type, operation channel, frequency data type used to reconstruct the image, and the clipping type. You can use a bit-wise OR ( | ) to specify one flag from each group.
|FFT_FFT||[0x0001] Convert the image into frequency domain and store the results in the acxData.|
|FFT_IFFT||[0x0002] Construct an image from the frequency components in acxData. The image will be stored in pBitmap. This option will change the values of acxData.|
|FFT_BLUE||[0x0010] Work on the blue channel.|
|FFT_GREEN||[0x0020] Work on the green channel.|
|FFT_RED||[0x0030] Work on the red channel.|
|FFT_GRAY||[0x0040] Work on the Master Channel. If this flag is combined with FFT_IFFT, the reconstructed image will be gray.|
|FFT_IFFT_MAG||[0x0100] Construct the image from the frequency magnitude only.|
|FFT_IFFT_PHS||[0x0200] Construct the image from the frequency phase only.|
|FFT_IFFT_BOTH||[0x0300] Construct the image from both magnitude and phase.|
|FFT_IFFT_CLIP||[0x1000] Clip the constructed image values to be between 0 and 255.|
|FFT_IFFT_SCL||[0x2000] Scale the constructed image Valid values are between 0 and 255.|
|SUCCESS||The function was successful.|
|< 1||An error occurred. Refer to Return Codes.|
This function converts the image from the time domain to the frequency domain and vice versa using a Fast Fourier Transform algorithm. Fast Fourier Transform algorithms are a simplification of Discrete Fourier Transforms and require that the image dimensions be a power of two (i.e. 2, 4, 8, 16, 32, etc.). The number of computations needed are reduced from 2N2 to 2N LgN. Use the LBitmap::DFT to use a Discrete Fourier Transform algorithm on a bitmap. If you try to use this function with a bitmap with dimensions that are not a power of two, the function will return an ERROR_INV_PARAMETER error.
When using this function with an image where at least one of its dimensions is not a power of two, you must specify an extra flag when calling the LBitmap::AllocFTArray function to pad the dimension(s) to the nearest power of two. If you try to use this function with a bitmap with dimensions that are not a power of two without specifying a "padding" flag, the function will return an ERROR_INV_PARAMETER error.
Before using this function, call the LBitmap::AllocFTArray function to allocate a FTARRAY structure large enough to hold the Fourier Transform coefficients for pBitmap. When the array is no longer needed, free the allocated array by calling the LBitmap::FreeFTArray function.
This function does not work on regions. If a bitmap has a region the function ignores it and processes the entire bitmap.
To update a status bar or detect a user interrupt during execution of this function, refer to LBase::EnableStatusCallback.
This function does not support 12 and 16-bit grayscale and 48 and 64-bit color images. If the image is 12 and 16-bit grayscale and 48 and 64-bit color, the function will not return an error.
This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.
FFT Function - Before
FFT Function - After
View additional platform support for this FFT function.
L_INT LBitmap__FFTExample(LBitmap *pLeadBitmap)
/* This example loads a bitmap and applies a FFT transformation. */
/* Resize the bitmap to make sure the bitmap dimensions are power of two*/
nRet =pLeadBitmap->Size (256, 512, SIZE_BICUBIC);
/* Allocate FFT buffer*/
nRet =pLeadBitmap->AllocFTArray (&pFTArray, sizeof(FTARRAY));
/* Apply FFT*/
nRet =pLeadBitmap->FFT( pFTArray, FFT_FFT | FFT_GRAY);
Free FFT buffer */
nRet =LBitmap::FreeFTArray (pFTArray);
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries