FindReferenceKeyPointsInImage

Searches a reference image, represented by its keypoints and corresponding descriptors, in a given source image.
Can use available TwinCAT Job Tasks for executing parallel code regions.

Syntax

Definition:

HRESULT FindReferenceKeyPointsInImage(
    HRESULT                  hrPrev,
    ITcVnContainer*          ipSrcKeyPoints,
    ITcVnImage*              ipSrcDescriptors,
    ITcVnContainer*          ipRefKeyPoints,
    ITcVnImage*              ipRefDescriptors,
    ULONG                    nRefImageWidth,
    ULONG                    nRefImageHeight,
    ITcVnContainer*&         ipEdgePoints,
    float                    fMaxDist,
    float                    fMaxKnnRatio,
    ETcVnNormalizationType   eNormType,
    TcVnMatrix3x3_LREAL&     aPerspectiveTransform,
    ULONG&                   nNumberOfGoodMatches,
    ULONG&                   nNumberOfInliers,
    ETcVnEstimationAlgorithm eAlgorithm = EA_RANSAC,
    double                   fReprojThreshold = 3,
    ULONG                    nMaxIterations = 2000,
    double                   fConfidence = 0.995,
    ITcVnContainer**         pipGoodMatches = nullptr,
    ITcVnContainer**         pipInlierMask = nullptr
)

Parameters

Name

Type

Default

Description

hrPrev

HRESULT

 

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

ipSrcKeyPoints

ITcVnContainer*

 

KeyPoints of the source image, e.g. (ContainerType_Vector_TcVnKeyPoint)

ipSrcDescriptors

ITcVnImage*

 

Descriptors of the source image KeyPoints

ipRefKeyPoints

ITcVnContainer*

 

KeyPoints of the reference image (ContainerType_Vector_TcVnKeyPoint)

ipRefDescriptors

ITcVnImage*

 

Descriptors of the reference image KeyPoints

nRefImageWidth

ULONG

 

Width of the reference image in pixels

nRefImageHeight

ULONG

 

Height of the reference image in pixels

ipEdgePoints

ITcVnContainer*&

 

Returns a container with the 4 edge points of the reference image transformed into the coordinates of the source image (ContainerType_Vector_TcVnPoint2_REAL)

fMaxDist

float

 

Maximum allowed descriptor distance (-1 disables this filter criterion)

fMaxKnnRatio

float

 

Maximum allowed distance ratio between first and second best match ([0..1], -1 disables this filter criterion)

eNormType

ETcVnNormalizationType

 

Normalization type used for descriptor matching (HAMMING recommended for AKAZE, ORB, and BRISK. HAMMING2 is recommended for ORB if the ORB nBriefPoints parameter is 3 or 4. )

aPerspectiveTransform

TcVnMatrix3x3_LREAL&

 

Returns the perspective transformation matrix, which transforms the reference points to the source points

nNumberOfGoodMatches

ULONG&

 

Return the number of good matches

nNumberOfInliers

ULONG&

 

Return the number of inlier matches

eAlgorithm

ETcVnEstimationAlgorithm

EA_RANSAC

Estimation algorithm used for computing the perspective transformation between the two point sets

fReprojThreshold

double

3

Maximum allowed reprojection error to treat a point pair as an inlier (only used if eAlgorithm is RANSAC, RHO)

nMaxIterations

ULONG

2000

Maximum number of RANSAC iterations

fConfidence

double

0.995

Confidence (0..1)

pipGoodMatches

ITcVnContainer**

nullptr

Returns a container with good matches (optional, set to 0 if not required; ContainerType_Vector_TcVnDMatch)

pipInlierMask

ITcVnContainer**

nullptr

Returns a mask marking the inliers (optional, set to 0 if not required; ContainerType_Vector_SINT; only for RANSAC, LMEDS)

FindReferenceKeyPointsInImage 1: 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