Class LightGlueMatcher


public class LightGlueMatcher extends DescriptorMatcher
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.
  • Constructor Details

    • LightGlueMatcher

      protected LightGlueMatcher(long addr)
  • Method Details

    • __fromPtr__

      public static LightGlueMatcher __fromPtr__(long addr)
    • 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 backend
      target - DNN target
      Returns:
      automatically generated
    • create

      public static LightGlueMatcher create(String modelPath, float scoreThreshold, int backend)
      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

      public static LightGlueMatcher create(String modelPath, float scoreThreshold)
      Creates LightGlueMatcher from a model file path.
      Parameters:
      modelPath - Path to the ONNX model file.
      scoreThreshold - Match confidence threshold.
      Returns:
      automatically generated
    • create

      public static LightGlueMatcher create(String modelPath)
      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 backend
      target - 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

      public static LightGlueMatcher createFromMemory(MatOfByte modelData, float scoreThreshold)
      Creates LightGlueMatcher from in-memory model data.
      Parameters:
      modelData - Buffer containing the model data.
      scoreThreshold - Match confidence threshold.
      Returns:
      automatically generated
    • createFromMemory

      public static LightGlueMatcher createFromMemory(MatOfByte modelData)
      Creates LightGlueMatcher from in-memory model data.
      Parameters:
      modelData - Buffer containing the model data.
      Returns:
      automatically generated
    • setPairInfo

      public void setPairInfo(Mat queryKpts, Mat trainKpts, Size queryImageSize, Size trainImageSize)
      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

      public void setPairInfo(Mat queryKpts, Mat trainKpts, Size queryImageSize)
      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

      public void setPairInfo(Mat queryKpts, Mat trainKpts)
      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.