Skip to content

compareHist

Image processingfunctionOpenCV 5.0.0
import { compareHist } from '@banou/opencv-wasm'

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

ARGUMENTSH1, H2, method
FUNCTIONcompareHist
RETURN TYPEnumber
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Compares two histograms.

The function cv::compareHist compares two dense or two sparse histograms using the specified method.

The function returns d(H_1, H_2) .

While the function works well with 1-, 2-, 3-dimensional dense histograms, it may not be suitable for high-dimensional sparse histograms. In such histograms, because of aliasing and sampling problems, the coordinates of non-zero histogram bins can slightly shift. To compare such histograms or more general sparse configurations of weighted points, consider using the #EMD function.

compareHist(H1: Mat, H2: Mat, method: number): number;
H1

First compared histogram.

H2

Second compared histogram of the same size as H1 .

method

Comparison method, see #HistCompMethods

Returns

The number result.

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.