Skip to content

sampsonDistance

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

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

ARGUMENTSpt1, pt2, F
FUNCTIONsampsonDistance
RETURN TYPEnumber
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Calculates the Sampson Distance between two points.

The function cv::sampsonDistance calculates and returns the first order approximation of the geometric error as:


sd( \texttt{pt1} , \texttt{pt2} )=
\frac{(\texttt{pt2}^t \cdot \texttt{F} \cdot \texttt{pt1})^2}
{((\texttt{F} \cdot \texttt{pt1})(0))^2 +
((\texttt{F} \cdot \texttt{pt1})(1))^2 +
((\texttt{F}^t \cdot \texttt{pt2})(0))^2 +
((\texttt{F}^t \cdot \texttt{pt2})(1))^2}

The fundamental matrix may be calculated using the #findFundamentalMat function. See [HartleyZ00] 11.4.3 for details.

sampsonDistance(pt1: Mat, pt2: Mat, F: Mat): number;
pt1

first homogeneous 2d point

pt2

second homogeneous 2d point

F

fundamental matrix

Returns

The computed Sampson distance.

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.