Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
L_FTDisplayBitmap
#include "l_bitmap.h"
L_LTIMGCOR_API L_INT L_FTDisplayBitmap(pBitmap, pFTArray, uFlags)
pBITMAPHANDLE pBitmap; |
/* pointer to the bitmap handle */ |
pFTARRAY pFTArray; |
/* pointer to structure */ |
L_UINT uFlags; |
/* flags */ |
This function is used to display the results of a Fast Fourier Transform or a Discrete Fourier analysis as a bitmap.
Parameter |
Description |
|
pBitmap |
Pointer to the bitmap handle that references the bitmap. |
|
pFTArray |
Pointer to a FTARRAY structure. The acxData member of the FTARRAY structure is a two-dimensional array holding the frequency components. Its dimensions must equal the bitmap dimensions. |
|
uFlags |
Flags that indicate the data to be shown and the plotting scale. You can use a bit-wise OR (|) to specify one flag from each group. |
|
|
The following flags represent the data to be shown: |
|
|
Value |
Meaning |
|
DSP_FT_MAG |
[0x0001] Plot harmonics magnitude data. |
|
DSP_FT_PHS |
[0x0002] Plot harmonics phase data. |
|
The following flags represent the plotting scale. These are ignored when DSP_FT_PHS is set: |
|
|
Value |
Meaning |
|
DSP_FT_NORM |
[0x0010] Plot harmonics magnitudes using the normal linear scale. |
|
DSP_FT_LOG |
[0x0020] Plot harmonics magnitudes using logarithmic scale. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.
This function converts the acxData member of the FTARRAY structure computed by L_FFTBitmap or L_DFTBitmap functions into a bitmap. The resulting bitmap may be displayed such that it shows either the frequency harmonics amplitude data or phase data. The (0,0) frequency located in bitmap center, positive X harmonics in the right half and positive Y harmonics located in the lower half of the bitmap.
This function does not work on regions . If a bitmap has a region the function ignores it and processes the entire bitmap.
Bitmap should be allocated prior to calling this function. The size of the bitmap must be the same size as the bitmap that was used to generate acxData.
To update a status bar or detect a user interrupt during execution of this function, refer to L_SetStatusCallback.
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.
Required DLLs and Libraries
LTIMGCOR For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
Platforms
Windows 2000 / XP/Vista.
See Also
Example
This example loads a bitmap, applies the Discrete Fourier Transform function to it, and displays the data
#if defined (LEADTOOLS_V16_OR_LATER) L_INT FTDisplayBitmapExample(L_VOID) { L_INT nRet; RECT rcRange; BITMAPHANDLE LeadBitmap, DisplayBitmap; /* Bitmap handle to hold the loaded image. */ pFTARRAY pFTArray; /* Load the bitmap, keeping the bits per pixel of the file */ nRet = L_LoadBitmap(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\IMAGE1.CMP"), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); if(nRet !=SUCCESS) return nRet; nRet = L_CopyBitmap(&DisplayBitmap, &LeadBitmap, sizeof(BITMAPHANDLE)); if(nRet !=SUCCESS) return nRet; /*Allocates buffer*/ nRet = L_AllocFTArray(&LeadBitmap, &pFTArray, sizeof(FTARRAY), 0); if(nRet !=SUCCESS) return nRet; rcRange.left = 0; rcRange.right = LeadBitmap.Width / 4; rcRange.top = 0; rcRange.bottom = LeadBitmap.Height / 2; /* apply DFT*/ nRet = L_DFTBitmap(&LeadBitmap, pFTArray, &rcRange, DFT_DFT | DFT_GRAY | DFT_RANGE| DFT_INSIDE_X| DFT_OUTSIDE_Y); if(nRet !=SUCCESS) return nRet; /*plot frequency magnitude*/ nRet = L_FTDisplayBitmap(&DisplayBitmap, pFTArray, DSP_FT_MAG | DSP_FT_LOG); if(nRet !=SUCCESS) return nRet; /*Frees buffer*/ nRet = L_FreeFTArray(pFTArray, 0); if(nRet !=SUCCESS) return nRet; //free Bitmaps nRet = L_SaveBitmap(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\Result.BMP"), &DisplayBitmap, FILE_BMP, 24, 0, NULL); if(nRet !=SUCCESS) return nRet; //free bitmap if(DisplayBitmap.Flags.Allocated) L_FreeBitmap(&DisplayBitmap); if(LeadBitmap.Flags.Allocated) L_FreeBitmap(&LeadBitmap); return SUCCESS; } #else L_INT FTDisplayBitmapExample(L_VOID) { L_INT nRet; RECT rcRange; BITMAPHANDLE LeadBitmap, DisplayBitmap; /* Bitmap handle to hold the loaded image. */ pFTARRAY pFTArray; /* Load the bitmap, keeping the bits per pixel of the file */ nRet = L_LoadBitmap(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\IMAGE1.CMP"), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); if(nRet !=SUCCESS) return nRet; nRet = L_CopyBitmap(&DisplayBitmap, &LeadBitmap, sizeof(BITMAPHANDLE)); if(nRet !=SUCCESS) return nRet; /*Allocates buffer*/ nRet = L_AllocFTArray(&LeadBitmap, &pFTArray, sizeof(FTARRAY)); if(nRet !=SUCCESS) return nRet; rcRange.left = 0; rcRange.right = LeadBitmap.Width / 4; rcRange.top = 0; rcRange.bottom = LeadBitmap.Height / 2; /* apply DFT*/ nRet = L_DFTBitmap(&LeadBitmap, pFTArray, &rcRange, DFT_DFT | DFT_GRAY | DFT_RANGE| DFT_INSIDE_X| DFT_OUTSIDE_Y); if(nRet !=SUCCESS) return nRet; /*plot frequency magnitude*/ nRet = L_FTDisplayBitmap(&DisplayBitmap, pFTArray, DSP_FT_MAG | DSP_FT_LOG); if(nRet !=SUCCESS) return nRet; /*Frees buffer*/ nRet = L_FreeFTArray(pFTArray); if(nRet !=SUCCESS) return nRet; //free Bitmaps nRet = L_SaveBitmap(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\Result.BMP"), &DisplayBitmap, FILE_BMP, 24, 0, NULL); if(nRet !=SUCCESS) return nRet; //free bitmap if(DisplayBitmap.Flags.Allocated) L_FreeBitmap(&DisplayBitmap); if(LeadBitmap.Flags.Allocated) L_FreeBitmap(&LeadBitmap); return SUCCESS; } #endif // LEADTOOLS_V16_OR_LATER