Skip to content

ANNIndex_create

Features and matchingfunctionOpenCV 5.0.0
import { ANNIndex_create } from '@banou/opencv-wasm'

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

ARGUMENTSdim, distType
FUNCTIONANNIndex_create
RETURN TYPEANNIndex | null
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Creates an instance of annoy index class with given parameters

ANNIndex_create(dim: number, distType: number): ANNIndex | null;
2 available overloads
ANNIndex_create(dim: number): ANNIndex | null;
ANNIndex_create(dim: number, distType: number): ANNIndex | null;
dim

The dimension of the feature vector.

distType

Metric to calculate the distance between two feature vectors, can be DIST_EUCLIDEAN, DIST_MANHATTAN, DIST_ANGULAR, DIST_HAMMING, or DIST_DOTPRODUCT.

Returns

The ANNIndex | null 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.