FreqDIBLowpass  Method

Description         This function attenuates the high-frequency components. It uses Fast Fourier Transform (FFT) algorithm to obtain the Fourier spectrum. In the frequency domain, a filter function attenuates the high-frequency components. After that, the inverse FFT algorithm is applied 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

macska                                          macskalowpassed

Syntax                 lRet = [BIFilter.]FreqDIBLowpass Dib Cutoff Type bFFTMethod bShowDialog

Remarks             lRet                         LONGLONG Handle of the newly created DIB on success or 0 on failure.

                            Dib                          LONGLONG Source DIB.

                            Cutoff                    Long                Cutoff frequency.

                            Type                       Long                The filter function in the frequency domain.

1: FILTER_IDEAL
2: FILTER_BUTTERWORTH

                            bFFTMethod         BOOL             Fast Fourier Transform method

                            bShowDialog         BOOL             Show dialog box

 

Cutoff frequency
This function passes all frequency components if the ‘Cutoff’ parameter is greater than the radius of the image. For example, if the size of the source image is 128 x 128, then all of the pass frequencies is sqrt(2) * 128 / 2 = 90. Of course this is true only if nType = FILTER_IDEAL.

Ideal lowpass filter (‘nType = FILTER_IDEAL)
The name ideal filter indicates that all frequencies inside a circle of radius ‘nCutoff’ are passed with no attenuation, whereas all frequencies outside this circle are completely attenuated.

Butterworth lowpass filter (‘nType’ = FILTER_BUTTERWORTH)
H(u, v) = 1 / ( 1 + ( D(u, v) / D0 ) ^ 2) )
H(u, v):      Filter function, ‘u’ and ‘v’ is the frequency variable.
D(u, v):      Distance from the origin of the frequency plane:  sqrt( u*u + v*v )
D0:            Cutoff frequency (nCutoff)

bFFTMethod
If bFFTMethod = TRUE, then the Fourier transformed of the image will be processed by Sin and Cos functions, if bFFTMethod = FALSE, then it will be processed by square root functions.

bShowDialog
This parameter specifies that is the dialog box to be showed or not.

See Also