Skip to content

HistCompMethods

Image processingclassOpenCV 5.0.0
import { HistCompMethods } from '@banou/opencv-wasm'

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

ARGUMENTSConstructor or factory
CLASSHistCompMethods
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.

imgproc_feature Histogram comparison methods

Constructors and members

static HISTCMP_CORREL

Correlation

d(H_1,H_2) =  \frac{\sum_I (H_1(I) - \bar{H_1}) (H_2(I) - \bar{H_2})}{\sqrt{\sum_I(H_1(I) - \bar{H_1})^2 \sum_I(H_2(I) - \bar{H_2})^2}}
where
\bar{H_k} =  \frac{1}{N} \sum _J H_k(J)
and `N` is a total number of histogram bins.
HISTCMP_CORREL: HistCompMethodsValue<0>,

static HISTCMP_CHISQR

Chi-Square

d(H_1,H_2) =  \sum _I  \frac{\left(H_1(I)-H_2(I)\right)^2}{H_1(I)}
HISTCMP_CHISQR: HistCompMethodsValue<1>,

static HISTCMP_INTERSECT

Intersection

d(H_1,H_2) =  \sum _I  \min (H_1(I), H_2(I))
HISTCMP_INTERSECT: HistCompMethodsValue<2>,

static HISTCMP_BHATTACHARYYA

Synonym for HISTCMP_BHATTACHARYYA

HISTCMP_BHATTACHARYYA: HistCompMethodsValue<3>,

static HISTCMP_HELLINGER

Synonym for HISTCMP_BHATTACHARYYA

HISTCMP_HELLINGER: HistCompMethodsValue<3>,

static HISTCMP_CHISQR_ALT

Synonym for HISTCMP_BHATTACHARYYA Alternative Chi-Square

d(H_1,H_2) =  2 * \sum _I  \frac{\left(H_1(I)-H_2(I)\right)^2}{H_1(I)+H_2(I)}
This alternative formula is regularly used for texture comparison. See e.g. [Puzicha1997]
HISTCMP_CHISQR_ALT: HistCompMethodsValue<4>,

static HISTCMP_KL_DIV

Kullback-Leibler divergence

d(H_1,H_2) = \sum _I H_1(I) \log \left(\frac{H_1(I)}{H_2(I)}\right)
HISTCMP_KL_DIV: HistCompMethodsValue<5>

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.