imaqHistogram

NI Vision for LabWindows/CVI Function

imaqHistogram

Usage

HistogramReport* imaqHistogram(const Image* image, int numClasses, float min, float max, const Image* mask);

Purpose

Calculates the histogram, or pixel distribution, of an image.

Image Types Supported

IMAQ_IMAGE_U8, IMAQ_IMAGE_I16, IMAQ_IMAGE_SGL

Parameters

Name

Type

Description

image const Image* The image whose histogram the function calculates.
numClasses int The number of classes into which the function separates the pixels.
min float The minimum pixel value to consider for the histogram. The function does not count pixels with values less than min.
max float The maximum pixel value to consider for the histogram. The function does not count pixels with values greater than max.
mask const Image* An optional mask image. This image must be an IMAQ_IMAGE_U8 image. When calculating the histogram, the function considers only those pixels in image whose corresponding pixels in mask are non-zero. Set this parameter to NULL if you want the function to perform a histogram on the whole image.

Return Value

Type

Description

HistogramReport* On success, this function returns a report describing the pixel value classification. On failure, this function returns NULL. To get extended error information, call imaqGetLastError(). When you are finished with the report, dispose of it by calling imaqDispose().

Parameter Discussion

min—Setting both min and max to 0 causes the function to set min to 0 for 8-bit images and to the actual minimum value of the image for all other image types.

max—Setting both min and max to 0 causes the function to set max to 255 for 8-bit images and to the actual maximum value of the image for all other image types.