imaqCentroid

NI Vision for LabWindows/CVI Function

imaqCentroid

Usage

int imaqCentroid(const Image* image, PointFloat* centroid, const Image* mask);

Purpose

Computes the centroid of an image.

Image Types Supported

IMAQ_IMAGE_U8, IMAQ_IMAGE_I16, IMAQ_IMAGE_SGL

Parameters

Name

Type

Description

image const Image* The image whose centroid the function calculates.
centroid PointFloat* On return, the x- and y-coordinates of the centroid. This parameter is required and cannot be NULL.
mask const Image* An optional mask image. If NULL, the whole source image is used in the calculation. Otherwise, the function uses in the calculation only those pixels in the source whose corresponding pixels in the mask image are non-zero.

Return Value

Type

Description

int On success, this function returns a non-zero value. On failure, this function returns 0. To get extended error information, call imaqGetLastError().