ConnectedComponents

Computes the connected components of an image.

Syntax

Definition:

HRESULT ConnectedComponents(
    HRESULT                           hrPrev,
    ITcVnImage*                       ipSrcImage,
    ITcVnImage*&                      ipLabelImage,
    LONG&                             nLabels,
    ETcVnPixelConnectivity            eConnectivity = PC_8,
    ETcVnElementType                  eLabelType = TCVN_ET_DINT,
    ETcVnConnectedComponentsAlgorithm eAlgorithm = CCA_GRANA
)

Parameters

Name

Type

Default

Description

hrPrev

HRESULT

 

HRESULT indicating the result of previous operations (If SUCCEEDED(hrPrev) equals false, no operation is executed.)

ipSrcImage

ITcVnImage*

 

Source image (USINT, 1 channel, binary)

ipLabelImage

ITcVnImage*&

 

Returns the labels for each source image pixel (1 channel, type depends on eLabelType. An appropriate destination image will be created if required.)

nLabels

LONG&

 

Returns the number of labels

eConnectivity

ETcVnPixelConnectivity

PC_8

Selects if 4- or 8-way pixel connectivity should be used

eLabelType

ETcVnElementType

TCVN_ET_DINT

Selects the type of ipLabelImage (only UINT or DINT supported)

eAlgorithm

ETcVnConnectedComponentsAlgorithm

CCA_GRANA

Selects the applied algorithm

ConnectedComponents 1: Return value

HRESULT

Required License

TC3 Vision Base

System Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT V3.1.4024.54 or later

PC or CX (x64) with PL50, e.g. Intel 4-core Atom CPU

Tc3_Vision