#include "BIFILTER.H"
HANDLE CALLBACK FreqHomomorphic( HANDLE hSrcDIB,
WORD nCutoff,
WORD nWidth,
float fHigh,
float fLow,
BOOL bFFTMethod,
BOOL bShowDialog)
Description
At first it takes a logarithm of the pixel values. Then this function uses Fast Fourier Transform (FFT) algorithm to obtain the Fourier spectrum. In the frequency domain, a special filter function attenuates some frequency components. After that, the inverse FFT algorithm is applied to go back to the spatial domain. Then it applies an exponential function to obtain the result DIB. It works with 4, 8 or 24 bits/pixel. In case of 4 or 8 bits/pixel, the source DIB must contain grayscale images and the palette values in the source DIB must be monotone increasing. It makes no sense to use this function in case of 1 bits/pixel. If the source DIB size is not power of two, zero padding is used.
Examples
The original 180 x 210 size image and the FFT-Homomorphic filtered image with Cutoff = 10, Width = 20, Height = 2, Low = 0.8 parameter values.
Parameters
HANDLE |
hSrcDIB |
Source DIB |
WORD |
nCutoff |
Cutoff frequency. Large cutoff frequency is recommended. (Almost all pass.) See the description and examples above for further information and a possible value. |
WORD |
nWidth |
Transient width in the frequency domain 10 is recommended. |
float |
fHigh |
High-frequency attenuation. It must be more than one 4.0 is recommended. See the description and examples above for further information and a possible value. |
float |
FLow |
Low-frequency attenuation. It must be less than one 0.8 - 0.9 is recommended. See the description and examples above for further information and a possible value. |
BOOL |
bFFTMethod |
There are two ways realized to process the power spectra of an image. One uses trigonometrical sinus and cosinus functions and the other one uses square root functions. There can be different between the two ways only at the processing time. Available values: TRUE (1) - The power spectra will be processed by sinus and cosinus functions. FALSE (0) - The power spectra will be processed by square root functions. |
BOOL |
bShowDialog |
This parameter specifies that is the preview dialog to be displayed or not. |
Return values
Handle of the newly created DIB on success or NULL on failure.
Programming notes
Cutoff frequency.
If ‘nCutoff’ parameter is greater than the radius of the image, then all of frequencies are passed. For example, if the size of the source image is 128 x 128, then all of the pass frequencies are sqrt(2) * 128 / 2 = 90.
Requirements
Header : Declared in BIFilter.h; include BIFilter.h.
Library : Use BIFilter.lib.
DLLs : BIFilter.dll.