imaqLabel2

NI Vision for LabWindows/CVI Function

imaqLabel2

Usage

int imaqLabel2(Image* dest, Image* source, int connectivity8, int* particleCount);

Purpose

Labels the particles in a binary image by applying a unique value to all pixels within a particle. This value is encoded in 8 or 16 bits, depending on the image type. The function can label 255 particles in an 8-bit image and 65,535 particles in a 16-bit image.

Image Types Supported

IMAQ_IMAGE_U8, IMAQ_IMAGE_I16, IMAQ_IMAGE_SGL

Parameters

Name

Type

Description

dest Image* The destination image.
source Image* The source image. The labeling process modifies the border of the source image. The border must be at least one pixel wide if you use connectivity-4 or two pixels wide if you use connectivity-8.
connectivity8 int 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, see Chapter 9, Binary Morphology, in the NI Vision Concepts Manual
particleCount int* On return, the number of particles that the function found. 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().

Parameter Discussion

source—This function modifies the source image. If you need the original image, create a copy of the image using imaqDuplicate() before using this function.