| hfilter | stsdas.analysis.restore | hfilter |
hfilter -- Adaptive low-pass filter based on H-transform.
hfilter input output
The H-transform is a form of image coding based on (but not an extension of) the Haar transform. Contrary to other types of image transform (Fourier, Hadamard, Walsh, etc.), the H (and Haar) transform keeps a tight one-to-one relationship between "pixels" in the transform space (called "coefficients") and true pixels in the image space. This property makes it a very convenient device for designing adaptive filters, that is, filters that adapt themselves to the local properties of the signal.
This task implements, in the IRAF environment, the filtering procedures described by Fritze 1977 [1] and Richter et al. 1978 [2] (see also Capaccioli et al. 1988 [3] and Richter et al. 1991 [4]). Two types of adaptive local low-pass filtering are implemented:
More detailed filter characteristics (passbands, etc.) can be seen in [2].
The H-transform in its strictest sense is defined only for square arrays with side dimension an integer power of two. In this implementation, the image to be filtered is divided into a number of square arrays (blocks), of size given by task parameter blksize; it must be an integer power of two. If either image axis is not an integer multiple of blksize, the input image is read with boundary extension to generate the missing lines or columns that fill up the border blocks. The output image will always have a size which is an integer multiple of blksize in both axes, that is, it will contain the extra lines or columns generated by boundary extension. This drawback will be corrected in future versions; for the time being, a simple section copy with task imcopy suffices to restore the image to its original size.
Parameter blksize also controls the filter cutoff frequency, which is related to the maximum H-transform order. Larger blocks correspond to lower spatial cutoff frequencies.
The block-by-block processing of the input image can be done either by reading the full input pixel array, processing it and outputing it to the output image file; or reading each block from disk, processing it and writing it before reading the next block. The i/o mode is switched by task parameter storage. The second mode (disk) must be used only when an "Out of memory" condition develops, since it can be much slower than memory mode.
Both filter types can be switched on and off independently by task parameters thfilter and spfilter.
The threshold filter works by comparing the H-transform coefficients local to a certain pixel with a threshold derived from a "blank" (sky background) region in the same image (or in another image with similar characteristics). The filter behavior is controlled by two task parameters: thresh and gain. Coefficients larger (in absolute value) than parameter thresh times the variance of the corresponding coefficients from the blank region are kept as significant. Smaller coefficients are assumed to contain no meaningful information, and are discarded. Discarding means lowering their absolute values, in the limit zeroing them. This behavior is defined by parameter gain, which, when set to 1., generates maximum filtering, zeroing the non-significant coefficients. When set to zero, non-significant coefficients are not affected, thus restoring the image to its input status. Intermediate values produce intermediate degrees of filtering.
The "blank", or background, image, is defined by parameter skysec. It can be a section from any image, including the input image. If skysec="input", then the background image is the same as the input image. This may be useful when processing a list of images within a single call to the task.
Variance computation in the background image is done in a loop repeated three times, rejecting coefficients which deviate from zero more than 2.5 times the variance in the previous loop. This enables the use of image sections mildly contaminated by stars and other objects.
The spectral filter is a straight implementation of the procedure described in [1] and [2]. The spectral factor defined by parameter spfactor is related to the "steepness" of the local Fourier power spectrum. See the references for more details.
Typical CPU time is 8-10 sec. in a Sparc 2, 512 X 512 image, block size = 16, memory intermediate storage.
adaptive