AutoMThreshold Method

NI Vision for Visual Basic

AutoMThreshold Method

Syntax

CWIMAQVision.AutoMThreshold SourceImage, NumClasses, LookupTable, ThresholdData

Return Type

Long

Returns 0 if no error; returns a negative number to indicate an error.

Purpose

Obsolete—Use AutoThreshold2 instead. Automatic Multi-Threshold is a variant of the classification by clustering method.

The method is based on a reiterated measurement of a histogram. Starting from a random sort, the method determines the gray scale values. After finding the best result, it segments the histogram into N groups. These groups are based on the fact that each point in a group is closer to the barycenter of its own group than the barycenter of another group.

The function outputs the threshold data in two forms: A lookup table (LUT) directly usable by CWIMAQVision.UserLookup or a report directly usable by CWIMAQVision.MultiThreshold.

Remarks

Use this method with U8 images.

Parameters

SourceImage As CWIMAQImage

The image to process.

NumClasses As Long

The number of preferred phases. This algorithm uses a clustering method and accepts any value between 2 and 256.

LookupTable As Variant

Returns a lookup table array that you can use with CWIMAQVision.UserLookup. This array contains 256 elements encoded between 0 and NumClasses.

ThresholdData As CWIMAQThresholdData

Returns a Report object containing NumClasses elements that is compatible with CWIMAQVision.MultiThreshold.

See Also

AutoThreshold