ImageGear for C and C++ on Windows v19.9 - Updated
IG_FIP_restore_inverse
API Reference Guide > FreqIP Component API Reference > FreqIP Component Functions Reference > Filter Functions > IG_FIP_restore_inverse

This function performs image restoration using inverse filtering in the frequency domain.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_FIP_restore_inverse(
        HIGEAR hIGear, 
        const LPAT_RECT lpRect,
        LPAT_DOUBLE lpPSFVector, 
        const AT_INT nPSFSize, 
        const AT_DOUBLE dThreshold
);

Arguments:

Name Type Description
hIGear HIGEAR Handle of the input image, also pass out the restored image.
lpRect const LPAT_RECT Far pointer to an AT_RECT structure specifying the rectangular portion of the image on which to operate. If NULL, this operation will be performed on the entire image.
lpPSFVector LPAT_DOUBLE Pointer to the vector which represents the Point Spread Function (PSF) in spatial domain, also called Degradation Function.
nPSFSize const AT_INT Size of PSF passed in lpPSFVector.
dThreshold const AT_DOUBLE The threshold parameter for Inverse Filtering.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

Grayscale - 8 bpp.

Sample:

FreqIP

Example:

 
Copy Code
HIGEAR hIGear;           /* Handle of the input image */
AT_DOUBLE psfVector[11];
...
IG_FIP_restore_inverse(hIGear, NULL, psfVector, 11, 0.005);
...

Remarks:

The idea is to deconvolve PSF from the blurred data to extract the original image.

The deconvolution involves dividing the Fourier transform of the blurred image by the Fourier transform of PSF. If the transform of PSF has very small values, then the division result from those small values could easily dominate the entire result. The approach used to get around this issue is to limit the smallest value of the transform of PSF, thus we require a threshold value, dThreshold, to be passed in as a parameter. Ideally, this value will be just above the noise level in the image. This function places zeros in the output for those data points where the magnitude of PSF transform is below the threshold. In this respect, IG_FIP_restore_inverse is actually an implementation of a pseudo-inverse filter.