MimLabel()函数

Synopsis

Label objects in an image buffer.

Format

void MimLabel(SrcImageBufId, DestImageBufId, ProcMode)

MIL_ID SrcImageBufId; Source image buffer identifier
MIL_ID DestImageBufId; Destination image buffer identifier
long ProcMode; Processing mode

Description

This function labels all objects (or blobs) in the specified source image, starting from the top-left corner, with unique consecutive values beginning with the value 1. Each pixel in the same blob is given the same numerical value.

If you want to distinguish between touching blobs, you should separate the blobs. For example, you can use an erosion operation before performing the labeling operation.

The SrcImageBufId parameter specifies identifier of the data source of the operation. This parameter must be given an image buffer identifier. If the source buffer is not binary, all non-zero pixels are considered as part of an object or blob.

The DestImageBufId parameter specifies the identifier of the destination of the results. This parameter must be given an image buffer identifier.

The ProcMode parameter specifies the type of connectivity (lattice) to use for processing. This parameter can be set to:

M_8_CONNECTED Each pixel has 8 neighbors. If two blobs touch on the vertical, horizontal, or diagonal, they are considered one blob.
M_4_CONNECTED Each pixel has 4 neighbors. If two blobs touch on the vertical and horizontal axis, they are considered one blob.

If the source image is a binarized image (MimBinarize), you can add M_BINARY to the connectivity mode to accelerate processing, particularly if the labeling is done by the Host. For example, M_4_CONNECTED+M_BINARY. The default processing mode is M_8_CONNECTED+M_GRAYSCALE.

The destination buffer should be large enough to hold the maximum number of objects (blobs) . For example, an 8-bit buffer can be used for a maximum of 254 blobs and a 16-bit buffer can be used for a maximum of 65534 blobs.

Status

In-place processing is supported, but the source and destination image buffers cannot partially overlap ( a situation that can only occur when using child buffers).

See also

MimBinarize