FindContourHierarchy (Exp)

Search for object contours in a binary image and determine their hierarchical relationship.
Can use available TwinCAT Job Tasks for executing parallel code regions.
Can return partial results when canceled by Watchdog.

Syntax

Definition:

HRESULT FindContourHierarchy(
    HRESULT                         hrPrev,
    ITcVnImage*                     ipSrcImage,
    ITcVnContainer*&                ipContours,
    ITcVnContainer*&                ipHierarchy,
    ETcVnContourRetrievalMode       eRetrievalMode,
    ETcVnContourApproximationMethod eApproximationMethod,
    TcVnPoint&                      aOffset
)

Parameters

Name

Type

Description

hrPrev

HRESULT

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

ipSrcImage

ITcVnImage*

Source image (1 channel, binary)

ipContours

ITcVnContainer*&

Returns a container which is filled with the found contours (ContainerType_Vector_Vector_TcVnPoint2_DINT; The elements of this container are single contours. Non-zero interface pointers are reused.)

ipHierarchy

ITcVnContainer*&

Returns a container which is filled with information on the found contours' hierarchy (ContainerType_Vector_TcVnVector4_DINT; The elements of this container are four-dimensional vectors containing the 0-based indices of the next [0] and the previous contour [1] at the same level, the first child [2], and the parent [3]. Non-zero interface pointers are reused.)

eRetrievalMode

ETcVnContourRetrievalMode

Specifies which contours are retrieved and how their relationship is encoded

eApproximationMethod

ETcVnContourApproximationMethod

Contour encoding

aOffset

TcVnPoint&

Offset by which every contour point is shifted

FindContourHierarchy (Exp) 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