ImageGear for C and C++ on Windows v20.0 - Updated
IG_IP_smooth
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image Processing Functions > IG_IP_smooth

This function makes images look softer and slightly out of focus.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_IP_smooth(
   HIGEAR hIGear,
   const LPAT_RECT lpRect,
   const INT nSmoothFactor
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image.
lpRect const LPAT_RECT Pointer to an AT_RECT struct specifying a portion of the image to be affected. NULL means entire image.
nSmoothFactor const INT Factor indicating the degree of smoothness wanted. Valid range is 1 to 4. Larger values cause greater softening.

Return Value:

Returns 0 if successful. Otherwise, returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Sample:

Image Processing, Medical, Timing

Example:

 
Copy Code
HIGEAR hIGear;            // HIGEAR handle of the image
AT_ERRCOUNT nErrcount;    // Count of errs on stack upon ret from func

// Load image file "picture.bmp" from working directory
nErrcount = IG_load_file("picture.bmp", &hIGear);
if(nErrcount == 0)
{
    nErrcount = IG_IP_smooth(hIGear, NULL, 2);
    // ...
    // Destroy the image
    IG_image_delete(hIGear);
}

Remarks:

This function can be used to reduce the graininess of an image.

The pixel neighborhood considered by this function is 3x3, 5x5, 7x7, or 9x9 for nSmoothFactor = 1, 2, 3, or 4 respectively. Therefore, smaller values result in faster processing, while larger values result in more smoothing.

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 NRA 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.

See Also

IG_IP_gaussian_blur

IG_FX_blur

IG_IP_sharpen

IG_IP_convolve_matrix

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