LightGlueMatcher
import { LightGlueMatcher } 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. Inherits DescriptorMatcher.
LightGlue feature matcher.
LightGlue is a CNN-based feature matcher, as described in [Lindenberger23] . It takes keypoint locations and descriptors from two images and directly predicts match pairs. Unlike traditional matchers that compute descriptor distances, LightGlue uses attention mechanisms to produce confidence scores for each potential match pair.
The matcher extends DescriptorMatcher and supports the standard match(), knnMatch(), and radiusMatch() interfaces. Context (keypoints and image sizes) must be provided via setPairInfo() before matching.
Constructors and members
static create
Creates LightGlueMatcher from a model file path.
create(modelPath: EmbindString, scoreThreshold: number, backend: number, target: number): LightGlueMatcher | null;4 available overloads
create(modelPath: EmbindString): LightGlueMatcher | null;create(modelPath: EmbindString, scoreThreshold: number): LightGlueMatcher | null;create(modelPath: EmbindString, scoreThreshold: number, backend: number): LightGlueMatcher | null;create(modelPath: EmbindString, scoreThreshold: number, backend: number, target: number): LightGlueMatcher | null;modelPathPath to the ONNX model file.
scoreThresholdMatch confidence threshold.
backendDNN backend
targetDNN target
The LightGlueMatcher | null result.
static createFromMemory
Creates LightGlueMatcher from in-memory model data.
createFromMemory(modelData: ucharVector, scoreThreshold: number, backend: number, target: number): LightGlueMatcher | null;4 available overloads
createFromMemory(modelData: ucharVector): LightGlueMatcher | null;createFromMemory(modelData: ucharVector, scoreThreshold: number): LightGlueMatcher | null;createFromMemory(modelData: ucharVector, scoreThreshold: number, backend: number): LightGlueMatcher | null;createFromMemory(modelData: ucharVector, scoreThreshold: number, backend: number, target: number): LightGlueMatcher | null;modelDataBuffer containing the model data.
scoreThresholdMatch confidence threshold.
backendDNN backend
targetDNN target
The LightGlueMatcher | null result.
setPairInfo
Sets the keypoint and image size context for the next match() call.
This provides the spatial context that LightGlue needs in addition to descriptors.
Must be called before match()/knnMatch()/radiusMatch() unless using automatic context
from in-process ALIKED instances.
setPairInfo(queryKpts: Mat, trainKpts: Mat, queryImageSize: Size, trainImageSize: Size): void;3 available overloads
setPairInfo(queryKpts: Mat, trainKpts: Mat): void;setPairInfo(queryKpts: Mat, trainKpts: Mat, queryImageSize: Size): void;setPairInfo(queryKpts: Mat, trainKpts: Mat, queryImageSize: Size, trainImageSize: Size): void;queryKptsQuery image keypoints (Nx2 float matrix with x,y coordinates).
trainKptsTrain image keypoints (Nx2 float matrix with x,y coordinates).
queryImageSizeSize of the query image (width, height).
trainImageSizeSize of the train image (width, height).
clearPairInfo
Clears stored pair context information.
clearPairInfo(): void;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.