Class LightGlueMatcher
java.lang.Object
org.opencv.core.Algorithm
org.opencv.features.DescriptorMatcher
org.opencv.features.LightGlueMatcher
LightGlue feature matcher.
LightGlue is a CNN-based feature matcher, as described in CITE: 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.
-
Field Summary
Fields inherited from class DescriptorMatcher
BRUTEFORCE, BRUTEFORCE_HAMMING, BRUTEFORCE_HAMMINGLUT, BRUTEFORCE_L1, BRUTEFORCE_SL2, FLANNBASED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic LightGlueMatcher__fromPtr__(long addr) voidClears stored pair context information.static LightGlueMatcherCreates LightGlueMatcher from a model file path.static LightGlueMatcherCreates LightGlueMatcher from a model file path.static LightGlueMatcherCreates LightGlueMatcher from a model file path.static LightGlueMatcherCreates LightGlueMatcher from a model file path.static LightGlueMatchercreateFromMemory(MatOfByte modelData) Creates LightGlueMatcher from in-memory model data.static LightGlueMatchercreateFromMemory(MatOfByte modelData, float scoreThreshold) Creates LightGlueMatcher from in-memory model data.static LightGlueMatchercreateFromMemory(MatOfByte modelData, float scoreThreshold, int backend) Creates LightGlueMatcher from in-memory model data.static LightGlueMatchercreateFromMemory(MatOfByte modelData, float scoreThreshold, int backend, int target) Creates LightGlueMatcher from in-memory model data.voidsetPairInfo(Mat queryKpts, Mat trainKpts) Sets the keypoint and image size context for the next match() call.voidsetPairInfo(Mat queryKpts, Mat trainKpts, Size queryImageSize) Sets the keypoint and image size context for the next match() call.voidsetPairInfo(Mat queryKpts, Mat trainKpts, Size queryImageSize, Size trainImageSize) Sets the keypoint and image size context for the next match() call.Methods inherited from class DescriptorMatcher
add, clear, clone, clone, create, empty, getTrainDescriptors, isMaskSupported, knnMatch, knnMatch, knnMatch, knnMatch, knnMatch, knnMatch, match, match, match, match, radiusMatch, radiusMatch, radiusMatch, radiusMatch, radiusMatch, radiusMatch, read, train, writeMethods inherited from class Algorithm
getDefaultName, getNativeObjAddr, save
-
Constructor Details
-
LightGlueMatcher
protected LightGlueMatcher(long addr)
-
-
Method Details
-
__fromPtr__
-
create
public static LightGlueMatcher create(String modelPath, float scoreThreshold, int backend, int target) Creates LightGlueMatcher from a model file path.- Parameters:
modelPath- Path to the ONNX model file.scoreThreshold- Match confidence threshold.backend- DNN backendtarget- DNN target- Returns:
- automatically generated
-
create
Creates LightGlueMatcher from a model file path.- Parameters:
modelPath- Path to the ONNX model file.scoreThreshold- Match confidence threshold.backend- DNN backend- Returns:
- automatically generated
-
create
Creates LightGlueMatcher from a model file path.- Parameters:
modelPath- Path to the ONNX model file.scoreThreshold- Match confidence threshold.- Returns:
- automatically generated
-
create
Creates LightGlueMatcher from a model file path.- Parameters:
modelPath- Path to the ONNX model file.- Returns:
- automatically generated
-
createFromMemory
public static LightGlueMatcher createFromMemory(MatOfByte modelData, float scoreThreshold, int backend, int target) Creates LightGlueMatcher from in-memory model data.- Parameters:
modelData- Buffer containing the model data.scoreThreshold- Match confidence threshold.backend- DNN backendtarget- DNN target- Returns:
- automatically generated
-
createFromMemory
public static LightGlueMatcher createFromMemory(MatOfByte modelData, float scoreThreshold, int backend) Creates LightGlueMatcher from in-memory model data.- Parameters:
modelData- Buffer containing the model data.scoreThreshold- Match confidence threshold.backend- DNN backend- Returns:
- automatically generated
-
createFromMemory
Creates LightGlueMatcher from in-memory model data.- Parameters:
modelData- Buffer containing the model data.scoreThreshold- Match confidence threshold.- Returns:
- automatically generated
-
createFromMemory
Creates LightGlueMatcher from in-memory model data.- Parameters:
modelData- Buffer containing the model data.- Returns:
- automatically generated
-
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.- Parameters:
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).
-
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.- Parameters:
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).
-
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.- Parameters:
queryKpts- Query image keypoints (Nx2 float matrix with x,y coordinates).trainKpts- Train image keypoints (Nx2 float matrix with x,y coordinates).
-
clearPairInfo
public void clearPairInfo()Clears stored pair context information.
-