WatershedTransform Method

NI Vision for Visual Basic

WatershedTransform Method

Syntax

CWIMAQVision.WatershedTransform SourceImage, DestImage, NumZones [, Connectivity8]

Return Type

Long

Purpose

Computes the watershed transform of an image. The watershed transfrom outputs an image in which the same number (label) is assigned to all the pixels that belong to the same catchment basin of the topographic surface of the input image, and 0 is assigned to all the pixels in the watershed line.

Remarks

Use this method with U8 and I16 images.

DestImage must be a U8 or I16 image. If you use a U8 DestImage, the method can store up to 255 unique labels not including the watershed line value of 0. If you use a I16 DestImage, the method can store up to 32,767 unique labels not including the watershed line value of 0.

Parameters

SourceImage As CWIMAQImage

The source image.

DestImage As CWIMAQImage

The resulting image.

NumZones As Variant

On return, specifies the number of zones detected in the image. A zone is a region of the image in which all pixels belong to the same catchment basin.

Connectivity8 As Variant

[Optional] Set this parameter to True to use connectivity-8 to determine whether adjacent pixels belong to the same catchment basin or watershed line. Set this parameter to False to use connectivity-4 to determine whether adjacent pixels belong to the same catchment basin or watershed line. For more information about connectivity, see the NI Vision Concepts Manual.