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

This function produces a histogram of the pixel values occurring in image hIGear, or in the rectangular portion specified if lpRect is not NULL.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_IP_histo_tabulate (
        HIGEAR hIGear, 
        LPDWORD lpHisto, 
        UINT nNumberOfBins, 
        LPAT_RECT lpRect, 
        UINT nYIncr, 
        const AT_MODE nColorChannel 
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image.
lpHisto LPDWORD Far pointer to an array of bins (each a DWORD) in which to tabulate.
nNumberOfBins UINT Number of bins.
lpRect LPAT_RECT Far pointer to an AT_RECT struct specifying rectangular portion of the image to tabulate for, or NULL for whole image. 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.
nYIncr UINT Set = 1 to sample every pixel. Values larger than 1 will skip rasters of the image bitmap.
nColorChannel const AT_MODE For 24 bit images selects which channel: IG_COLOR_COMP_R, _G, or _B (IG_COLOR_COMP_RGB not allowed).

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

Sample:

Image Processing

Example:

 
Copy Code
HIGEAR hIGear;    /* HIGEAR handle of image */
DWORD dwHistoBins[256];   /* Array of bins for counting */
IG_IP_histo_clear ( &dwHistoBins, 256 ); /* Clear the bins */
/* Tabulate. If a 24-bit image, only the red will be tabulated: */
IG_IP_histo_tabulate (hIGear, &dwHistoBins, 256, NULL, 1, IG_COLOR_COMP_R);

Remarks:

If nYIncr = 1, each pixel in the image is examined. The bin corresponding to that pixel value increments. The number of bins must be large enough to hold the entire histogram. If an 8 or 24-bit image, the number of bins must be 256. If a 4-bit or 1-bit image, the number of bins must be 16 or 2 respectively. Note that for a 24-bit image, only a single color channel can be a histogram at one time. Use argument nColorChannel to select the channel.

If nYIncr is greater than 1, then rasters of the image are skipped. This can be used to speed up the tabulation when the image is large.

You should call IG_IP_histo_clear() before calling this function, unless you intentionally mean to accumulate the count onto the existing contents of the bins.

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