GetAffineTransformation2D

Estimate the affine transformation between two planar point sets.

Syntax

Definition:

HRESULT GetAffineTransformation2D(
    HRESULT                  hrPrev,
    ITcVnContainer*          ipSrcPoints,
    ITcVnContainer*          ipDestPoints,
    TcVnMatrix2x3_LREAL&     aAffineTransform,
    ETcVnEstimationAlgorithm eAlgorithm = EA_RANSAC,
    double                   fReprojThreshold = 3,
    ITcVnContainer**         pipInlierMask = nullptr,
    ULONG                    nMaxIterations = 2000,
    double                   fConfidence = 0.995,
    ULONG                    nRefineIters = 10
)

Parameters

Name

Type

Default

Description

hrPrev

HRESULT

 

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

ipSrcPoints

ITcVnContainer*

 

Container with at least 3 source points (ContainerType_Vector_TcVnPoint2_REAL)

ipDestPoints

ITcVnContainer*

 

Container with destination points (same number as ipSrcPoints, ContainerType_Vector_TcVnPoint2_REAL)

aAffineTransform

TcVnMatrix2x3_LREAL&

 

Returns the affine transformation matrix, which transforms the source points to the destination points

eAlgorithm

ETcVnEstimationAlgorithm

EA_RANSAC

Estimation algorithm (only RANSAC and LMEDS are supported)

fReprojThreshold

double

3

Maximum allowed reprojection error to treat a point pair as an inlier

pipInlierMask

ITcVnContainer**

nullptr

Returns a mask marking the inliers (optional, set to 0 if not required; ContainerType_Vector_USINT)

nMaxIterations

ULONG

2000

Maximum number of iterations

fConfidence

double

0.995

Confidence (0..1)

nRefineIters

ULONG

10

Maximum number of iterations of Levenberg-Marquardt algorithm to refine further the affine transform (using only inliers). Set to 0 to disable refining.

GetAffineTransformation2D 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