LEADTOOLS Raster Imaging C DLL Help > Function References > L_FrqFilterBitmap |
#include "l_bitmap.h"
L_LTIMGCOR_API L_INT L_FrqFilterBitmap(pFTArray, prcRange, uFlags)
pFTARRAY pFTArray; |
/* pointer to structure */ |
LPRECT prcRange; |
/* pointer to range rectangle */ |
L_UINT uFlags; |
/* flags */ |
Filters the frequency harmonics data produced by a Fourier Transform function using a range rectangle.
Parameter |
Description |
|
pFTArray |
Pointer to an FTARRAY structure. The acxData member of the FTARRAY structure is a two-dimensional array holding the frequency components. |
|
prcRange |
Specifies the filter dimension that will be applied, it represents the frequency range to be kept or removed. The left value refers to the minimum X harmonic, the right refers to the maximum X harmonic, the top refers to the minimum Y harmonic and the bottom refers to the maximum Y harmonic. The maximum X harmonic equals Width 1 and the maximum Y harmonic equals Height 1. |
|
|
||
|
||
uFlags |
Flags that indicate the operation to be performed on the specified X and Y harmonics ranges. You can use a bit wise OR (|) to specify one flag from each group. |
|
|
The following flags represent operations on the X harmonics range: |
|
|
Value |
Meaning |
|
FRQ_INSIDE_X |
[0x0001] Keep the X harmonics inside X range and remove outside ones. |
|
FRQ_OUTSIDE_X |
[0x0002] Remove the X harmonics inside X range and keep outside ones. |
|
The following flags represent operations on the Y harmonics range: |
|
|
Value |
Meaning |
|
FRQ_INSIDE_Y |
[0x0010] Keep the Y harmonics inside Y range and remove outside ones. |
|
FRQ_OUTSIDE_Y |
[0x0020] Remove the Y harmonics inside Y range and keep outside ones. |
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 is used only when working with Fourier Transform functions.
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.
Before using this function, call the L_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 L_FreeFTArray function.
To update a status bar or detect a user interrupt during execution of this function, refer to L_SetStatusCallback.
Required DLLs and Libraries
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
Win32, x64, Linux.
See Also
Example
this example filters the acxData of a pFTARRAY structure produced by the Fast Fourier Transform function
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName #if defined (LEADTOOLS_V16_OR_LATER) L_INT FrqFilterBitmapExample(L_VOID) { L_INT nRet; BITMAPHANDLE LeadBitmap; RECT rcRange; pFTARRAY pFTArray; nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); if(nRet !=SUCCESS) return nRet; rcRange.left = 0; rcRange.right = LeadBitmap.Width / 4; rcRange.top = 0; rcRange.bottom = LeadBitmap.Height / 2; /*Allocate FT buffer*/ nRet = L_AllocFTArray(&LeadBitmap, &pFTArray, sizeof(FTARRAY), 0); if(nRet !=SUCCESS) return nRet; /*lpFTData is known*/ /* filters the frequencies*/ nRet = L_FrqFilterBitmap(pFTArray, &rcRange, FRQ_INSIDE_X | FRQ_INSIDE_Y); if(nRet !=SUCCESS) return nRet; nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &LeadBitmap, FILE_BMP, 24, 0, NULL); if(nRet !=SUCCESS) return nRet; //free bitmap if(LeadBitmap.Flags.Allocated) L_FreeBitmap(&LeadBitmap); return SUCCESS; } #else L_INT FrqFilterBitmapExample(L_VOID) { L_INT nRet; BITMAPHANDLE LeadBitmap; RECT rcRange; pFTARRAY pFTArray; nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")), &LeadBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL); if(nRet !=SUCCESS) return nRet; rcRange.left = 0; rcRange.right = LeadBitmap.Width / 4; rcRange.top = 0; rcRange.bottom = LeadBitmap.Height / 2; /*Allocate FT buffer*/ nRet = L_AllocFTArray(&LeadBitmap, &pFTArray, sizeof(FTARRAY)); if(nRet !=SUCCESS) return nRet; /*lpFTData is known*/ /* filters the frequencies*/ nRet = L_FrqFilterBitmap(pFTArray, &rcRange, FRQ_INSIDE_X | FRQ_INSIDE_Y); if(nRet !=SUCCESS) return nRet; nRet = L_SaveBitmap(MAKE_IMAGE_PATH(TEXT("Result.BMP")), &LeadBitmap, FILE_BMP, 24, 0, NULL); if(nRet !=SUCCESS) return nRet; //free bitmap if(LeadBitmap.Flags.Allocated) L_FreeBitmap(&LeadBitmap); return SUCCESS; } #endif // LEADTOOLS_V16_OR_LATER