imaqAutoThreshold2

NI Vision for LabWindows/CVI Function

imaqAutoThreshold2

Usage

ThresholdData* imaqAutoThreshold2(Image* dest, const Image* source, int numClasses, ThresholdMethod method, const Image* mask);

Purpose

Automatically thresholds an image into multiple classes.

Image Types Supported

IMAQ_IMAGE_U8, IMAQ_IMAGE_I16, IMAQ_IMAGE_SGL

Parameters

Name

Type

Description

dest Image* The destination image.
source const Image* The image to threshold.
numClasses int The number of classes into which to threshold the image. Valid values range from 2 to 256.
method ThresholdMethod The method for binary thresholding. If numClasses is 2 (a binary threshold), method specifies how to calculate the classes. If numClasses is not 2, the function ignores this parameter.
mask const Image* An optional mask image. This image must be an IMAQ_IMAGE_U8 image. When calculating the auto threshold, 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 an auto threshold on the whole image.

Return Value

Type

Description

ThresholdData* On success, this function returns an array of structures providing information about the threshold ranges that the function applied. The array contains a number of ThresholdData structures equal to numClasses. On failure, this function returns NULL. To get extended error information, call imaqGetLastError(). When you are finished with the array, dispose of it by calling imaqDispose().