Centroid Method

NI Vision for Visual Basic

Centroid Method

Syntax

CWIMAQVision.Centroid SourceImage, xCentroid, yCentroid [, MaskImage]

Return Type

Long

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

Purpose

Obsolete—Use Centroid2 instead. Computes the centroid of an image.

Remarks

Use this method with image types U8, I16, and SGL. MaskImage must be a U8 image.

Parameters

SourceImage As CWIMAQImage

The image whose centroid the method calculates.

xCentroid As Single

On return, the x-coordinate of the centroid.

yCentroid As Single

On return, the y-coordinate of the centroid.

MaskImage As Variant

[Optional] A CWIMAQImage object that specifies the region in the image to use for computing the centroid. The method uses only those source image pixels whose corresponding mask pixels are non-zero to compute the centroid. Do not set this parameter if you want the method to use the whole image in the centroid calculation.

See Also

Centroid2