lvwiener(3)

LIBRARY ROUTINE
lvwiener - Perform image restoration by Wiener (least-squares) filtering.

LIBRARY CALL
#include "vinclude.h"
int
lvwiener(f1,f2,f3,bflg,thresh,rest)
struct xvimage *f1,*f2,*f3;
int   bflg;
float thresh, rest;

INPUT

    1. f1 -- first xvimage structure; FFT of image to be restored
    2. f2 -- second xvimage structure; FFT of reference image (optional)
    3. f3 -- third xvimage structure; FFT of PSF function
    4. bflg -- a flag set if reference image is available
    5. thresh -- minimum PSF threshold (optional)
    6. rest -- Weiner parameter

    The input xvimage structures must be of the same data type and size.

OUTPUT

    1. f1 -- holds the result of the Weiner filtering
             operation. The output data type is the same
             as the input data type.
    2. f3 -- holds the restoration filter.

    f1 is used for both the input xvimage structure and the output result xvimage structure. This is done to save space.

    lvwiener returns a zero upon failure and a one upon success.

MODIFICATIONS

Marcelo Teran, Ramiro Jordan

Scott Wilson - 27-Jan-91 - Removed FFT data type processing

DESCRIPTION
lvwiener performs restoration of images in the spatial domain by Wiener filtering in the frequency domain. The idea is to deconvolve the blurring function from the blurred image. A few problems exist in performing this operation, as described in great detail in any good image processing book. The Wiener filter performs better than the inverse filter when noise is present in the data.

The major difficulty lies in how small the denominator is allowed to be before you call it garbage. The value chosen is supplied as the -t thresh value. Ideally, this will be just above the noise floor in the image, but experimentation is the best guide here.

The restoration parameter controls how smoothly the modified PSF blends into the flat cutoff regions generated by the thresholding operation. For more information, see Rosenfeld & Kak, page 287.

The reffile is an image which, if supplied, is subtracted from the input image before the weiner filter is applied. This is handy for removing some constant background from the image before the restoration is done.

The PSFfile is the transform of the Point-Spread Function, or blurring function that is to be deconvolved from the input image.

The effPSFfile is the same as the PSFfile after the thresholding operation has been applied. Taking the inverse Fourier transform of this file gives the effective PSF as used in the restoration. The idea is that is should be reasonably close to the real PSF.

SEE ALSO
vwiener(1), intro(3), vipl(3), verror(3), vutils(3)

RESTRICTIONS
all input images must be the same data storage type (VFF_TYP_COMPLEX) and size.

AUTHOR
Scott Wilson

COPYRIGHT
Copyright 1992, University of New Mexico. All rights reserved.