AutoThreshold Method

NI Vision for Visual Basic

AutoThreshold Method

Syntax

CWIMAQVision.AutoThreshold SourceImage, DestImage, NumberOfClasses [, Method] [, MultiThresholdData]

Return Type

Long

On success, this method returns 0. On failure, this method returns a negative number.

Purpose

Obsolete—Use AutoThreshold2 instead. Automatically thresholds an image into multiple classes.

Remarks

Use this method with U8 images.

This method combines the AutoBThreshold and AutoMThreshold methods.

Parameters

SourceImage As CWIMAQImage

The image to process.

DestImage As CWIMAQImage

The resulting U8 image.

NumberOfClasses As Long

The number of classes into which to threshold the image. Valid values range from 2 to 256.

Method As Variant

[Optional] A CWIMAQAutoThresholdMethods value that specifies the threshold method to use if NumberOfClasses is 2. The method ignores this parameter if NumberOfClasses is not 2.

MultiThresholdData As Variant

[Optional] On return, a CWIMAQMultiThresholdData object containing NumClasses elements that is compatible with CWIMAQVision.MultiThreshold2.

Example

Dim i As New CWIMAQImage
Dim thresholdData As New CWIMAQMultiThresholdData
 
'AutoThreshold the image in Viewer1 into 3 classes and store the 
'result in i
CWIMAQVision1.AutoThreshold CWIMAQViewer1.Image, i, 3, _
                            cwimaqATMethodCluster, _
                            thresholdData
    
'Use thresholdData result to MultiThreshold the Viewer inplace
CWIMAQVision1.MultiThreshold2 CWIMAQViewer1.Image, _
                              CWIMAQViewer1.Image, _
                              thresholdData

See Also

CWIMAQAutoThresholdMethods

CWIMAQMultiThresholdData

MultiThreshold2