GetConnectedComponent

Get the mask image (and optionally the outer contour) of a connected component from a label image based on the label ID.
Can use available TwinCAT Job Tasks for executing parallel code regions.

Syntax

Definition:

HRESULT GetConnectedComponent(
    HRESULT          hrPrev,
    ITcVnImage*      ipLabelImage,
    LONG             nLabelID,
    ITcVnImage*&     ipMaskImage,
    ITcVnContainer** pipContourPoints = nullptr
)

Parameters

Name

Type

Default

Description

hrPrev

HRESULT

 

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

ipLabelImage

ITcVnImage*

 

Image containing labels for each pixel (1 channel DINT or UINT).

nLabelID

LONG

 

Value of the requested label

ipMaskImage

ITcVnImage*&

 

Returns a mask image marking the pixels that belong to the component (1 channel USINT. Mask is optional, set to 0 if not required.)

pipContourPoints

ITcVnContainer**

nullptr

Returns the outer contour of the component(ContainerType_Vector_TcVnPoint2_DINT. Contour is optional, set to 0 if not required.)

GetConnectedComponent 1: Return value

HRESULT

Required License

TC3 Vision Base

System Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT V3.1.4024.59 or later

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

Tc3_Vision