flann_Index
import { flann_Index } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Native object: release it with using or delete(). Factories can return null; check before calling methods.
A nearest-neighbor search index over feature vectors. Choose index and search parameters for the descriptor type and distance metric.
Constructors and members
static new
Create an owned flann_Index object. Release native handles with using or delete().
new(features: Mat, params: flann_IndexParams, distType: flann_DistanceType): flann_Index;3 available overloads
new(): flann_Index;new(features: Mat, params: flann_IndexParams): flann_Index;new(features: Mat, params: flann_IndexParams, distType: flann_DistanceType): flann_Index;featuresfeatures argument (Mat).
paramsparams argument (flann_IndexParams).
distTypedist type argument (flann_DistanceType).
The flann_Index result.
clone
Create another handle to the same native object. This retains the object without copying its pixels or algorithm state; dispose both handles separately.
clone(): this;The this result.
build
Build or replace the search index from rows of feature descriptors and the chosen index parameters.
build(features: Mat, params: flann_IndexParams, distType: number): void;2 available overloads
build(features: Mat, params: flann_IndexParams): void;build(features: Mat, params: flann_IndexParams, distType: number): void;featuresfeatures argument (Mat).
paramsparams argument (flann_IndexParams).
distTypedist type argument (number).
knnSearch
Find up to knn nearest indexed feature vectors for each query row. Write their row indices and distances into the supplied output matrices.
knnSearch(query: Mat, indices: Mat, dists: Mat, knn: number, params: flann_SearchParams): void;2 available overloads
knnSearch(query: Mat, indices: Mat, dists: Mat, knn: number): void;knnSearch(query: Mat, indices: Mat, dists: Mat, knn: number, params: flann_SearchParams): void;queryquery argument (Mat).
indicesOutput destination, filled by the native operation. indices argument (Mat).
distsOutput destination, filled by the native operation. dists argument (Mat).
knnknn argument (number).
paramsparams argument (flann_SearchParams).
radiusSearch
Find indexed feature vectors within the distance radius of the query. Write up to maxResults indices and distances and return the native match count.
radiusSearch(query: Mat, indices: Mat, dists: Mat, radius: number, maxResults: number, params: flann_SearchParams): number;2 available overloads
radiusSearch(query: Mat, indices: Mat, dists: Mat, radius: number, maxResults: number): number;radiusSearch(query: Mat, indices: Mat, dists: Mat, radius: number, maxResults: number, params: flann_SearchParams): number;queryquery argument (Mat).
indicesOutput destination, filled by the native operation. indices argument (Mat).
distsOutput destination, filled by the native operation. dists argument (Mat).
radiusradius argument (number).
maxResultsmax results argument (number).
paramsparams argument (flann_SearchParams).
The number result.
save
Save the index structure to a path in this instance's virtual filesystem. Keep the original feature data for loading it again.
save(filename: EmbindString): void;filenamefilename argument (EmbindString).
load
Load a saved index using its original feature matrix. Return whether loading succeeded.
load(features: Mat, filename: EmbindString): boolean;featuresfeatures argument (Mat).
filenamefilename argument (EmbindString).
The boolean result.
release
Release the built search index while keeping this handle available for rebuilding.
release(): void;getDistance
Return the FLANN distance metric selected when the index was built.
getDistance(): number;The number result.
getAlgorithm
Return the FLANN index algorithm selected by the index parameters.
getAlgorithm(): number;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.