MaskToRegions Method

NI Vision for Visual Basic

MaskToRegions Method

Syntax

CWIMAQVision.MaskToRegions SourceImage, Regions, MaxPointsExceeded [, ExternalEdgesOnly = True] [, MaxPoints = 2500]

Return Type

Long

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

Purpose

Transforms a mask image into a regions collection.

Remarks

SourceImage must be a U8 image.

Parameters

SourceImage As CWIMAQImage

The mask image that the method transforms into Regions.

Regions As CWIMAQRegions

On return, the resulting regions collection.

MaxPointsExceeded As Boolean

On return, indicates whether the regions are a true representation of the mask. If this parameter is True, the number of points is within the MaxPoints point limit. If this parameter is False, the number of points exceeds the MaxPointslimit, and the regions may not represent the mask completely.

ExternalEdgesOnly As Variant

[Optional] Set this parameter to True if you want the method to transform external edges only. Set this parameter to False if you want the method to transform external and internal edges.

This parameter has a default value of True.

MaxPoints As Variant

[Optional] The maximum number of points you want in the resulting regions object. If the actual of points exceeds this limit, the Regions object is limited to this number and MaxPointsExceeded is True.

This parameter has a default value of 2500.

Example

Dim regions As New CWIMAQRegions
Dim maxPointsExceeded As Boolean

' Convert the mask image in Viewer1 into a regions collection
CWIMAQVision1.MaskToRegions CWIMAQViewer1.Image, regions, _
                            maxPointsExceeded