lowpass, highpass, bandpass, bandstop, lowpassu

[ XITE Reference Manual | XITE home ]

Contents


Name

lowpass, highpass, bandpass, bandstop, lowpassu - "Ideal" filters truncated with window function in the spatial domain

Syntax

 #include <xite/ideal.h>

 int lowpass (IBAND band, double cut_frequency,
    int filter_size, window_type win_type);

 int highpass (IBAND band, double cut_frequency,
    int *filter_size, window_type win_type);

 int bandpass (IBAND band, double low_cut_frequency,
    double high_cut_frequency, int filter_size,
    window_type win_type);

 int bandstop (IBAND band, double low_cut_frequency,
    double high_cut_frequency, int *filter_size,
    window_type win_type);

 int lowpassu (IBAND band, double cut_frequency,
    int filter_size, window_type win_type, double *sum);

Description

lowpass generates a lowpass filter in the spatial domain. The filter is made from an ideal lowpass-filter which is truncated with a window function in the spatial domain.

filter_size specifies filter diameter. cut_frequency is relative to the Nyquist frequency, i.e. a cut_frequency of 1.0 means half the sampling frequency. win_type specifies window function. Legal values for win_type are the constants
BARTLETT
Circularly symmetric Bartlett window
HAMMING
Circularly symmetric Hamming window
HANNING
Circularly symmetric Hanning (von Hann) window
RECTANGLE
Circularly symmetric rectangular (box, boxcar) window function
TRIANGLE
Circularly symmetric triangular window function

The circular symmetry is achieved using Huang's method.

lowpass is normalized so that the sum of the filter coefficients equals 1.0. lowpassu is not normalized. For lowpassu, sum is returned as the sum of the filter coefficients.

For odd filter_size, the symmetry-center of the filter is located in pixel (1,1) in band. For even filter_size, the symmetry-center of the filter is located at the upper-left corner of pixel (1,1), i.e. the symmetry-center does not fall into the center of a pixel.

For even filter_size and even horizontal band-size, the resulting filter_size may become smaller than you'ld expect, because of the location of the symmetry-center of the filter, as explained above.

highpass, bandpass and bandstop behave correspondingly. highpass is implemented as delta(n1, n2) - lowpass, with sum of coefficients equal to 0.0. bandpass is implemented as the difference between two lowpass-filters. bandstop is implemented as delta(n1, n2) - bandpass.

For highpass and bandstop, filter_size should be odd. If it is even, a warning is issued and filter_size will be made odd. For these functions, filter_size is a reference.

Restrictions

band must be one of the pixeltypes real, double, complex or double complex.

filter_size must not exceed horizontal or vertical size of band.

For highpass and bandstop, filter_size must be odd. If it is even, it will be increased by one (or decreased by one if this exceeds the size of band).

Return value

 0 : Ok
 1 : Bad pixeltype
 2 : Unknown window type
 3 : Filtersize larger than bandsize

See also

bartlett(3), window(3), lowpassf(3), lowpass(1)

Reference

Jae S. Lim
"Two-dimensional Signal And Image Processing" Prentice-Hall, 1990

Author

Trond Muri Sørensen. Major revision by Svein Bøe.

Doc

Svein Bøe