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

This function automatically adjusts the contrast of the image so that each range of possible intensities has about the same number of pixels in it.


Copy Code
AT_ERRCOUNT ACCUAPI IG_IP_contrast_equalize(
        HIGEAR hIGear, 
        LPAT_RECT lpRect, 
        AT_MODE nMethodMode 


Name Type Description
hIGear HIGEAR HIGEAR handle of image.
lpRect LPAT_RECT Far pointer to an AT_RECT struct defining the rectangle within the image that this function is to operate on. If NULL, the entire image will be operated on. 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.
nMethodMode AT_MODE IG_CONTRAST_PIXEL or IG_CONTRAST_PALETTE, telling whether to alter the pixels themselves (the image bitmap) or the palette.

Return Value:

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


Copy Code
HIGEAR hIGear;      /* HIGEAR handle of image */
IG_IP_contrast_equalize ( hIGear, NULL, IG_CONTRAST_PIXEL );


Just like IG_IP_contrast_stretch(), this will expand the intensity range of the image to fill the entire 0 to 255 range. However, unlike that function this one is non-linear.

This function is often used in x-ray images and in others where the contrast can be very small in the original. IG_IP_contrast_equalize() will bring out subtle changes in the contrast.

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.
Is this page helpful?
Yes No
Thanks for your feedback.