Table of Contents

Method EstimateAffine2D

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

EstimateAffine2D(InputArray, InputArray, OutputArray, RobustEstimationAlgorithms, double, ulong, double, ulong)

Computes an optimal affine transformation between two 2D point sets.

public static Mat? EstimateAffine2D(InputArray from, InputArray to, OutputArray inliers = default, RobustEstimationAlgorithms method = RobustEstimationAlgorithms.RANSAC, double ransacReprojThreshold = 3, ulong maxIters = 2000, double confidence = 0.99, ulong refineIters = 10)

Parameters

from InputArray

First input 2D point set containing (X,Y).

to InputArray

Second input 2D point set containing (x,y).

inliers OutputArray

Output vector indicating which points are inliers (1-inlier, 0-outlier).

method RobustEstimationAlgorithms

Robust method used to compute transformation.

ransacReprojThreshold double

Maximum reprojection error in the RANSAC algorithm to consider a point as an inlier.Applies only to RANSAC.

maxIters ulong

The maximum number of robust method iterations.

confidence double

Confidence level, between 0 and 1, for the estimated transformation. Anything between 0.95 and 0.99 is usually good enough.Values too close to 1 can slow down the estimation significantly.Values lower than 0.8-0.9 can result in an incorrectly estimated transformation.

refineIters ulong

Maximum number of iterations of refining algorithm (Levenberg-Marquardt). Passing 0 will disable refining, so the output matrix will be output of robust method.

Returns

Mat

Output 2D affine transformation matrix \f$2 \times 3\f$ or empty matrix if transformation could not be estimated.