F_VN_MatchContours1vsN

F_VN_MatchContours1vsN 1:

Compare a reference contour with multiple other contours using the Hu moment invariants. Returns a sorted list of best matches.

Syntax

Definition:

FUNCTION F_VN_MatchContours1vsN : HRESULT
VAR_INPUT
    ipRefContour            : ITcVnContainer;
    ipContours              : ITcVnContainer;
    ipMatchIndexes          : Reference To ITcVnContainer;
    ipDissimilarities       : Reference To ITcVnContainer;
    fDissimilarityThreshold : LREAL;
    eComparisonMethod       : ETcVnContoursMatchComparisonMethod;
    hrPrev                  : HRESULT;
END_VAR

F_VN_MatchContours1vsN 2: Inputs

Name

Type

Description

ipRefContour

ITcVnContainer

Reference contour (ContainerType_Vector_TcVnPoint2_DINT or ContainerType_Vector_TcVnPoint2_REAL; The elements of this container are the points of the contour)

ipContours

ITcVnContainer

Collection of multiple contours (CTcVnContainer_Vector_Vector_TcVnPoint2_DINT)

ipMatchIndexes

Reference To ITcVnContainer

Returns the indexes of the best matches (CTcVnContainer_Vector_ULINT; sorted, first element is best match, i.e. has lowest dissimilarity)

ipDissimilarities

Reference To ITcVnContainer

Returns the computed dissimilarities of the best matches (CTcVnContainer_Vector_LREAL; Optional, set to 0 if not required; sorted corresponding to ipMatchIndexes)

fDissimilarityThreshold

LREAL

Neglect irrelevant matches, i.e. dissimilarity > fDissimilarityThreshold

eComparisonMethod

ETcVnContoursMatchComparisonMethod

Method used for comparing the Hu moment invariants of the contours

hrPrev

HRESULT

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

F_VN_MatchContours1vsN 3: Return value

HRESULT

Required License

TC3 Vision Matching

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