Table of Contents

Class LightGlueMatcher

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

LightGlue: a deep learning based descriptor matcher with an attention mechanism (OpenCV 5). Runs an ONNX model through the DNN module. Requires OpenCV built with the dnn module.

public class LightGlueMatcher : DescriptorMatcher, IDisposable
Inheritance
LightGlueMatcher
Implements
Inherited Members

Methods

ClearPairInfo()

Clears stored pair context information.

public void ClearPairInfo()

Create(string, float, int, int)

Creates a LightGlueMatcher from a model file path.

public static LightGlueMatcher Create(string modelPath, float scoreThreshold = 0, int backend = 0, int target = 0)

Parameters

modelPath string

Path to the ONNX model file.

scoreThreshold float

Match confidence threshold.

backend int

DNN backend (see Backend). Default is 0 (DEFAULT).

target int

DNN target (see Target). Default is 0 (CPU).

Returns

LightGlueMatcher

CreateFromMemory(byte[], float, int, int)

Creates a LightGlueMatcher from an in-memory ONNX model buffer.

public static LightGlueMatcher CreateFromMemory(byte[] modelData, float scoreThreshold = 0, int backend = 0, int target = 0)

Parameters

modelData byte[]

Buffer containing the model data.

scoreThreshold float

Match confidence threshold.

backend int

DNN backend (see Backend). Default is 0 (DEFAULT).

target int

DNN target (see Target). Default is 0 (CPU).

Returns

LightGlueMatcher

SetPairInfo(InputArray, InputArray, Size, Size)

Sets the keypoint and image size context for the next match() call. Must be called before match()/knnMatch()/radiusMatch() unless using automatic context from in-process ALIKED instances.

public void SetPairInfo(InputArray queryKpts, InputArray trainKpts, Size queryImageSize = default, Size trainImageSize = default)

Parameters

queryKpts InputArray

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

trainKpts InputArray

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

queryImageSize Size

Size of the query image (width, height).

trainImageSize Size

Size of the train image (width, height).