Image Processing Toolkit User Guide > Reference A–I > FILT_FREQ Function (PV-WAVE Extreme Advantage)
  

FILT_FREQ Function (PV-WAVE Extreme Advantage)
Generates a 2D Butterworth or ideal lowpass, bandpass, bandstop, or highpass spatial frequency domain filter.
Usage
filter = FILT_FREQ(cutoff [, ucutoff ][, order])
Input Parameters
cutoff—A scalar float value for the cutoff frequency of the filter.
ucutoff—(optional) A scalar float value for the upper cutoff frequency of the filter
 
note
The ucutoff parameter is only valid for the bandpass and bandstop filters.
order—(optional) A scalar float value for the filter order.
 
note
The order parameter is only valid for the Butterworth filter.
Returned Value
result—A filter object containing an “unshifted” spectral filter. A spectral filter object is an associative array with the following keys:
*'kernel'—A 2D floating-point array of the filter values.
*'cutoff'—The filter cutoff frequency or frequencies. For lowpass and highpass filters, a scalar value. For bandpass and bandstop filters, a two-element array containing the lower cutoff frequency and the upper cutoff frequency.
*'pass'—A string indicating one of the following kinds of filter:
*low—A lowpass filter.
*high—A highpass filter.
*band—A bandpass filter.
*stop—A bandstop filter.
*notch—A notch filter.
*'dc_offset'—A floating point scalar value containing the DC offset of the filter.
*'maximum'—A floating point scalar value which is the maximum value of the filter.
*'type'—One of the following strings indicating the type of filter.
*ideal—An ideal filter.
*butterworth—A Butterworth filter.
*'domain'—One of the following strings indicating the filter domain.
*spectral—The filter is in the spectral (spatial frequency) domain.
*spatial—The filter is in the spatial domain.
 
note
FILT_FREQ produces only spectral domain filters. For information about spatial domain filters, see the IPCREATE_FILTER Function (PV-WAVE Extreme Advantage).
'xloc'—A scalar value specifying the x-location of the filter center. Valid for Notch filters only.
'yloc'—A scalar value specifying the y-location of the filter center. Valid for Notch filters only.
'center'—If set to 1, the filter center (DC value) is shifted to the array ('kernel') center; otherwise, the filter is unshifted.
'order'—A scalar value specifying the filter order. Valid for Butterworth filters only.
Keywords
Band—If set, generates a bandpass filter.
Butterworth—If set, generates Butterworth filter instead of an ideal filter.
Center—If set, shifts the output so that the center of the filter, the DC component, is the same as the center of the array.
CO_Frac—A scalar float that is the fraction of the maximum value of the filter at the cutoff frequency.
DC_Offset—A scalar float that is the DC offset of the filter. (Default: 0.0)
High—If set, generates a highpass filter.
Low—If set, generates a lowpass filter. (Default: set)
Maximum—A scalar float that is the maximum value of the filter. (Default: DC_Offset + 1.0)
Stop—If set, generates a bandstop filter.
Xdim—The x-dimension of the filter. (Default: ydim, if Ydim is specified; 256 otherwise)
Ydim—The y-dimension of the filter. (Default: xdim, if Xdim is specified; 256 otherwise)
Discussion
FILT_FREQ produces circularly symmetric spatial frequency domain filters which can be applied to frequency domain images. Ideal filters are simplistic, but the filtered spatial domain image displays ringing after an ideal filter is applied. The Butterworth filter provides a smooth transition from the passband to the cutoff band, reducing the ringing effect.
The following equations are used for a Butterworth filter:
Lowpass:
where n is the filter order and D0 is the cutoff frequency.
Highpass:
where n is the filter order and D0 is the cutoff frequency. Bandstop:
where n is the filter order, and DL and DU are the lower and upper cutoff frequencies, respectively. Bandpass:
where n is the filter order, and DL and DU are the lower and upper cutoff frequencies, respectively.
Example
; Read a noisy image.
image = IMAGE_READ(!IP_Data + 'noise_test.tif')
; Take the fast Fourier transform (FFT) of the image.
image_fft = FFT(image('pixels'), -1)
; Create a lowpass Butterworth filter.
lpf = FILT_FREQ(30, 1.0, /Butterworth, /Low, $
Xdim = image('width'), Ydim = image('height'))
; Apply the filter to the FFT of the image.
image_filt = IPMATH(lpf('kernel'), '*', image_fft)
; Take the inverse FFT of the filtered image.
image_ifft = ABS(FFT(image_filt, 1))
; Display the filtered image.
TVSCL, image_ifft
See Also
FILT_NOTCH,   IPMATH,   IPWIN
In the PV‑WAVE Reference:  FFT

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.