ImageGear for C and C++ on Windows v20.0 - Updated
IG_FIP_convolve
API Reference Guide > FreqIP Component API Reference > FreqIP Component Functions Reference > FFT Functions > IG_FIP_convolve

This function convolves an image with the given kernel matrix.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_FIP_convolve(
        HIGEAR hIGear, 
        LPAT_RECT lpRect, 
        LPAT_INT lpMatrix,
        AT_DIMENSION nMatrixWidth, 
        AT_DIMENSION nMatrixHeight, 
        AT_DOUBLE dNormalizer, 
        AT_BOOL bAddToOrigin
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image to be processed.
lpRect 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.
lpMatrix LPAT_INT Array of kernel elements with which to convolve.
nMatrixWidth AT_DIMENSION Width of kernel matrix.
nMatrixHeight AT_DIMENSION Height of kernel matrix.
dNormalizer AT_DOUBLE Normalizer of kernel.
bAddToOrigin AT_BOOL Whether to add the result of the convolution to the original pixel values, or replace the original pixel values.

Return Value:

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

Supported Raster Image Formats:

Grayscale - 8, 16, 32 bpp.

Sample:

FreqIP

Example:

 
Copy Code
HIGEAR hIGear;                           /* Handle of the image */
AT_RECT lpRect;                          /* rectangle to process */
AT_UINT mxConv[] = { 0, 1, 0,
        1, 5, 1,
        0, 1, 0 };               /* Convolution kernel */
AT_DOUBLE dNormalizer = 0.2;            /* Normalizer of the kernel */
AT_BOOL bAddToOrigin;                   /* TRUE = add to original pix vals */
...
IG_FIP_convolve(hIGear, lpRect, 3, 3, mxConv, dNormalizer, FALSE);
...

Remarks:

The convolution is implemented using FFT, based on the Convolution Theorem, which provides improved performance for larger kernel matrix.

The result of the convolution is multiplied by dNormalizer to scale the data. For kernels that sum to zero, the normalizer is usually set to 1.0.

Is this page helpful?
Yes No
Thanks for your feedback.