estimateAffine2D1
import { estimateAffine2D1 } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Computes an optimal affine transformation between two 2D point sets.
It computes
\begin{bmatrix}
x\\
y\\
\end{bmatrix}
=
\begin{bmatrix}
a_{11} & a_{12}\\
a_{21} & a_{22}\\
\end{bmatrix}
\begin{bmatrix}
X\\
Y\\
\end{bmatrix}
+
\begin{bmatrix}
b_1\\
b_2\\
\end{bmatrix}
Note: The RANSAC method can handle practically any ratio of outliers but needs a threshold to distinguish inliers from outliers. The method LMeDS does not need any threshold but it works correctly only when there are more than 50% of inliers.
See: estimateAffinePartial2D, getAffineTransform
estimateAffine2D1(pts1: Mat, pts2: Mat, inliers: Mat, params: UsacParams): Mat;pts1pts1 argument (Mat).
pts2pts2 argument (Mat).
inliersOutput destination, filled by the native operation. Output vector indicating which points are inliers (1-inlier, 0-outlier).
paramsparams argument (UsacParams).
Output 2D affine transformation matrix 2 \times 3 or empty matrix if transformation
could not be estimated. The returned matrix has the following form:
\begin{bmatrix}
a_{11} & a_{12} & b_1\\
a_{21} & a_{22} & b_2\\
\end{bmatrix}
The function estimates an optimal 2D affine transformation between two 2D point sets using the selected robust algorithm.
The computed transformation is then refined further (using only inliers) with the Levenberg-Marquardt method to reduce the re-projection error even more. Release returned native handles with using or delete(), including handles nested in results.
These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.