imaqCountParticles

NI Vision for LabWindows/CVI Function

imaqCountParticles

Usage

int imaqCountParticles(Image* image, int connectivity8, int* numParticles);

Purpose

Counts the number of particles in a binary image, and makes basic calculations about the particles to increase the efficiency of the imaqMeasureParticle() function.

Image Types Supported

IMAQ_IMAGE_U8, IMAQ_IMAGE_I16, IMAQ_IMAGE_SGL

Parameters

Name

Type

Description

image Image* The image on which to count particles.
connectivity8 int Set this parameter to TRUE to use connectivity-8 to determine whether pixels are part of the same particle. Set this parameter to FALSE to use connectivity-4 to determine whether pixels are part of the same particle. For more information about connectivity, refer to Chapter 9, Binary Morphology, in the NI Vision Concepts Manual.
numParticles int* On return, the number of particles in the image. Set this parameter to NULL if you do not need this information.

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().