ConvexHull Method

NI Vision for Visual Basic

ConvexHull Method

Syntax

CWIMAQVision.ConvexHull SourceImage, DestImage [, Connectivity8 = True]

Return Type

Long

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

Purpose

Computes the convex envelope for each particle in the source image.

Remarks

This method modifies the source image. If you need the original source image, create a copy of the image using the CWIMAQVision.Copy method before using this method.

Use this method with U8, I16, and floating point images.

Parameters

SourceImage As CWIMAQImage

The image containing the particles whose convex envelopes the method calculates.

DestImage As CWIMAQImage

The resulting image.

Connectivity8 As Variant

[Optional] Set this parameter to True to use connectivity-8 to determine whether particles are touching. Set this parameter to False to use connectivity-4 to determine whether particles are touching. For more information about connectivity, refer to the NI Vision Concepts Manual.

This parameter has a default value of True.

Example

Dim i As New CWIMAQImage
Dim j As New CWIMAQImage
Dim numParticles

' Threshold the image in Viewer1 and store the results in i
CWIMAQVision1.Threshold CWIMAQViewer1.Image, i, 128, 255, , 255

' Find the convex envelope of the particles in i.
' Store the result in j.
CWIMAQVision1.ConvexHull i, j