Skip to content

LightGlueMatcher

Features and matchingclassOpenCV 5.0.0
import { LightGlueMatcher } from '@banou/opencv-wasm'

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

ARGUMENTSConstructor or factory
CLASSLightGlueMatcher
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. 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;
modelPath

Path to the ONNX model file.

scoreThreshold

Match confidence threshold.

backend

DNN backend

target

DNN target

Returns

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;
modelData

Buffer containing the model data.

scoreThreshold

Match confidence threshold.

backend

DNN backend

target

DNN target

Returns

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;
queryKpts

Query image keypoints (Nx2 float matrix with x,y coordinates).

trainKpts

Train image keypoints (Nx2 float matrix with x,y coordinates).

queryImageSize

Size of the query image (width, height).

trainImageSize

Size 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.