LightGlue

class grid.model.perception.matching.glightglue.LightGlue(*args, **kwargs)

LightGlue: Feature Matching Model

This class implements a wrapper for the LightGlue model, which computes point matches between two images using SuperPoint and LightGlue.

Credits:

https://github.com/cvg/LightGlue

License:

This code is licensed under the Apache 2.0 License.

__init__()

Initialize Lightglue model

run(image0, image1)

Uses LightGlue to compute point matches between two images.

Parameters:
  • image0 (np.ndarray) -- Input RGB image 1.

  • image1 (np.ndarray) -- Input RGB image 2.

Returns:

List of point correspondences (matches) between the images. points0 (np.ndarray): Feature points detected in image 1. points1 (np.ndarray): Feature points detected in image 2.

Return type:

matches (np.ndarray)

Example

>>> rgb_image_0 = img
>>> rgb_image_1 = img
>>> lightglue = LightGlue()
>>> matches, points0, points1 = lightglue.run(rgb_image_0, rgb_image_1)
>>> print(matches.shape, points0.shape, points1.shape)