ImageGear for C and C++ on Linux v18.8 - Updated
IG_IP_enhance_local
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image Processing Functions > IG_IP_enhance_local

This function enhances an image using the local standard deviation and mean.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_IP_enhance_local(
        HIGEAR hIGear, 
        const LPAT_RECT lpRect, 
        const AT_DIMENSION nWinWidth, 
        const AT_DIMENSION nWinHeight, 
        const AT_DOUBLE dScaleFactor, 
        const AT_DOUBLE dMinStdDev
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image to be processed.
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. Before ImageGear performs this operation it will check to see if an internal flag has been set to TRUE to make a mask active for this HIGEAR image. If a mask is active, and a valid pointer to a mask can be found, ImageGear will override the settings passed to this structure in favor of the non-rectangular ROI defined by the mask.
nWinWidth const AT_DIMENSION Width of the local window.
nWinHeight const AT_DIMENSION Height of the local window.
dScaleFactor const AT_DOUBLE Scaling factor.
dMinStdDev const AT_DOUBLE Minimum allowed standard deviation.

Return Value:

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

Supported Raster Image Formats:

Grayscale – 8 bpp.

Example:

 
Copy Code
HIGEAR hIGear;   /* HIGEAR handle of image */
AT_RECT lpRect;         /* rectangle to process */
AT_DIMENSION nWinWidth; /* Window width */
AT_DIMENSION    nWinHeight;     /* Window height */
AT_DOUBLE dScaleFactor; /* Tuning factor */
AT_DOUBLE dMinStdDev; /* Minimum allowed standard deviation */
...
IG_IP_enhance_local(hIGear, lpRect, nWinWidth, nWinHeight, dScaleFactor, dMinStdDev);
...

Remarks:

This function transforms the input image f(x, y) to a new image g(x, y) based on the following formula,

 
Copy Code
g(x, y) = A(x, y) * [f(x, y) - m(x, y)] + m(x, y)

where,

A(x, y) = k * M / sigma(x, y), with k being a scaling factor within the range [0, 1], m(x, y) and sigma(x, y) being the local mean and local standard deviation, and M being the global mean of the input image.

To avoid the problem of spikes caused by too small local standard deviation, a check against the minimum allowed standard deviation is performed. If the local standard deviation is too small, the minimum allowed will instead be used in the calculation.

This function, like other ImageGear Image Processing and Clipboard API calls, takes an AT_RECT structure as an argument, so that you can process a rectangular sub-region of an image. However, before ImageGear performs the operation specified by this function, it will check to see if an internal flag has been set to TRUE, indicating that a mask HIGEAR should be used with the image. If the flag is set to TRUE, and a valid pointer to a mask image has been assigned, ImageGear will override the settings passed to the AT_RECT structure and use the non-rectangular ROI defined by the mask HIGEAR. To create a non-rectangular region of interest, call IG_IP_NR_ROI_to_HIGEAR_mask().

Please see the descriptions of IG_IP_NR_ROI_mask_associate() and IG_IP_NR_ROI_to_HIGEAR_mask() functions for more details.