F_VN_MatchContours1vsNExp

F_VN_MatchContours1vsNExp 1:

Compare a reference contour with multiple other contours using the Hu moment invariants (and optionally further aspects). Returns a sorted list of best matches. (expert function)

Syntax

Definition:

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

F_VN_MatchContours1vsNExp 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

fAreaFactor

LREAL

If > 0, the relative area difference between contours is scaled by this factor and added to the computed dissimilarity

fAbsPositionFactor

LREAL

If > 0, the absolute position difference between contours (i.e. the coordinates of the geometric contour centers) is scaled by this factor and added to the computed dissimilarity

hrPrev

HRESULT

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

F_VN_MatchContours1vsNExp 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