Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

docs(feature): link the matchers from the Local features page section (#5886)

Dmytro Mishkincbd8e09e9371
diff --git a/docs/source/get-started/conventions.rst b/docs/source/get-started/conventions.rst
index b20c325bf..32c4c5b56 100644
--- a/docs/source/get-started/conventions.rst
+++ b/docs/source/get-started/conventions.rst
@@ -1226,6 +1226,11 @@ full rules.
the smaller of the two; its Convention block covers moving a LAF to an image of another size.
- kornia's LAF detectors pad the slots that no detection filled with an all-zero LAF and a zero response, so that a
batch is one tensor. Drop those slots with :func:`~kornia.feature.laf_is_filled` before matching.
+- The ``match_*`` functions return ``(dists, idxs)``, one row per match; a lower ``dists`` is a better match.
+ See the Convention block of :func:`~kornia.feature.match_nn` for each matcher's distance definition.
+- ``idxs`` holds ``(index in desc1, index in desc2)`` for unbatched matchers. :func:`~kornia.feature.match_smnn_batched`
+ prepends the batch index: ``(batch_index, index in desc1, index in desc2)``.
+- :class:`~kornia.feature.LightGlueMatcher` returns a score in place of ``dists``; a higher score is a better match.
OpenCV keypoints and SIFT descriptors convert as follows:
diff --git a/kornia/feature/integrated.py b/kornia/feature/integrated.py
index f44d73283..87ac4e462 100644
--- a/kornia/feature/integrated.py
+++ b/kornia/feature/integrated.py
@@ -717,8 +717,9 @@ class LocalFeatureMatcher(nn.Module):
r"""nn.Module, which finds correspondences between two images based on local features.
Convention:
- - ``keypoints0`` and ``keypoints1`` are the centres ``(x, y)`` of the matched LAFs, which ``lafs0`` and
- ``lafs1`` return; see :func:`~kornia.feature.laf_from_center_scale_ori` for the LAF frame.
+ - ``keypoints0`` and ``keypoints1`` are the centres ``(x, y)`` of the returned LAF tensors ``lafs0`` and
+ ``lafs1``, respectively; see :func:`~kornia.feature.laf_from_center_scale_ori` and
+ :ref:`Local features <local-features-conventions>` for the LAF frame.
``confidence`` is ``1 - dists`` of the matcher (see :func:`~kornia.feature.match_nn`).
- All-zero LAFs, the padding slots of kornia's detectors (see :func:`~kornia.feature.laf_is_filled`), are
dropped before matching.
@@ -915,10 +916,11 @@ class LightGlueMatcher(GeometryAwareDescriptorMatcher):
See :cite:`LightGlue2023` for more details.
Convention:
- - ``lafs1`` and ``lafs2`` are LAFs in the pixel frame of :func:`~kornia.feature.laf_from_center_scale_ori`,
- and their centres go to LightGlue unchanged as the keypoints. ``hw1`` and ``hw2`` are the ``(H, W)`` of
- each image, which become LightGlue's ``image_size`` ``(W, H)``; without them, the image size is taken as
- the largest keypoint coordinates of that image, ``(max x, max y)``.
+ - ``lafs1`` and ``lafs2`` are LAFs in the pixel frame of :func:`~kornia.feature.laf_from_center_scale_ori`
+ (see :ref:`Local features <local-features-conventions>`), and their centres go to LightGlue unchanged as
+ the keypoints. ``hw1`` and ``hw2`` are the ``(H, W)`` of each image, which become LightGlue's
+ ``image_size`` ``(W, H)``; without them, the image size is taken as the largest keypoint coordinates of
+ that image, ``(max x, max y)``.
- What the network gets besides the keypoints depends on ``feature_name`` (case-insensitive):
- ``"aliked"``, ``"dedodeb"``, ``"dedodeg"``, ``"disk"``, ``"superpoint"``: nothing else.
diff --git a/kornia/feature/loftr/loftr.py b/kornia/feature/loftr/loftr.py
index 5d790b230..12b6ea339 100644
--- a/kornia/feature/loftr/loftr.py
+++ b/kornia/feature/loftr/loftr.py
@@ -93,7 +93,7 @@ class LoFTR(nn.Module):
image1 plus the offset found by the fine stage, at most 4 pixels along each axis. Both are :math:`(x, y)` in
the frame of the reference implementation, in which the pretrained models put the centre of pixel
:math:`(x, y)` at :math:`(x + 0.5, y + 0.5)`: subtract 0.5 to get kornia's frame
- (:func:`~kornia.feature.laf_from_center_scale_ori`), in which pixel centres have integer coordinates.
+ (:ref:`Local features <local-features-conventions>`), in which pixel centres have integer coordinates.
- ``confidence`` is the coarse matching score of the match, a dual-softmax score with the default
``match_type``; only matches above ``max(thr, 0)`` are returned, with the ``thr`` of
``config["match_coarse"]``, 0.2 by default.