Skip to content

DistanceTypes

geometryclassOpenCV 5.0.0
import { DistanceTypes } from '@banou/opencv-wasm'

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

ARGUMENTSConstructor or factory
CLASSDistanceTypes
RETURN TYPEOwned native handle
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Native object: release it with using or delete(). Factories can return null; check before calling methods.

Distance types for Distance Transform and M-estimators See: distanceTransform, fitLine

Constructors and members

static DIST_USER

User defined distance

DIST_USER: DistanceTypesValue<-1>,

static DIST_L1

distance = |x1-x2| + |y1-y2|

DIST_L1: DistanceTypesValue<1>,

static DIST_L2

the simple euclidean distance

DIST_L2: DistanceTypesValue<2>,

static DIST_C

distance = max(|x1-x2|,|y1-y2|)

DIST_C: DistanceTypesValue<3>,

static DIST_L12

L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1))

DIST_L12: DistanceTypesValue<4>,

static DIST_FAIR

distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998

DIST_FAIR: DistanceTypesValue<5>,

static DIST_WELSCH

distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846

DIST_WELSCH: DistanceTypesValue<6>,

static DIST_HUBER

distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345

DIST_HUBER: DistanceTypesValue<7>

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.