Skip to content

getPerspectiveTransform

geometryfunctionOpenCV 5.0.0
import { getPerspectiveTransform } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

Calculates a perspective transform from four pairs of the corresponding points.

The function calculates the 3 \times 3 matrix of a perspective transform so that:

\begin{bmatrix} t_i x'_i \\ t_i y'_i \\ t_i \end{bmatrix} = \texttt{map_matrix} \cdot \begin{bmatrix} x_i \\ y_i \\ 1 \end{bmatrix}

where

dst(i)=(x'_i,y'_i), src(i)=(x_i, y_i), i=0,1,2,3

See: findHomography, warpPerspective, perspectiveTransform

getPerspectiveTransform(src: Mat, dst: Mat, solveMethod: number): Mat;
2 available overloads
getPerspectiveTransform(src: Mat, dst: Mat): Mat;
getPerspectiveTransform(src: Mat, dst: Mat, solveMethod: number): Mat;
src

Coordinates of quadrangle vertices in the source image.

dst

Coordinates of the corresponding quadrangle vertices in the destination image.

solveMethod

method passed to cv::solve (#DecompTypes)

Returns

The Mat result. 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.