vismatch.viz

Visualization utilities for image matching.

Adapted from LightGlue’s viz2d: https://github.com/cvg/LightGlue

vismatch.viz.plot_images(imgs, titles=None, cmaps='gray', dpi=100, pad=0.5, adaptive=True)[source][source]

Plot a set of images horizontally.

Parameters:

imgs (list[Tensor | ndarray | str | Path | Image])

Return type:

ndarray[Axes]

vismatch.viz.add_text(ax, text, pos=(0.01, 0.99), fs=15, color='w', outline_color='k', outline_width=2, va='top')[source][source]

Add text with outline to an image axis.

Parameters:
  • ax (Axes)

  • text (str)

  • pos (tuple[float, float])

  • fs (int)

Return type:

Axes

vismatch.viz.save_plot(fig=None, path=None, **kw)[source][source]

Save the current figure without any white margin.

Parameters:

path (str | Path)

Return type:

Path

vismatch.viz.plot_matches(img0, img1, result, show_matched_kpts=True, show_all_kpts=False, save_path=None, color='lime', lw=0.2, point_size=4, show_text=True)[source][source]

Plot matches between two images.

Parameters:
  • img0 (Tensor)

  • img1 (Tensor)

  • result (dict)

  • show_matched_kpts (bool)

  • show_all_kpts (bool)

  • save_path (str | Path | None)

  • color (str)

  • lw (float)

  • point_size (int)

  • show_text (bool)

vismatch.viz.plot_keypoints(img0, result, model_name='', color='orange', save_path=None)[source][source]

Plot keypoints in one image.

Parameters:
  • img0 (Tensor)

  • result (dict)

  • model_name (str)

  • save_path (str | Path | None)

Return type:

Axes

vismatch.viz.stitch(img0, img1, result)[source][source]

Stitch two images together using homography.

Parameters:
  • img0 (Tensor | ndarray)

  • img1 (Tensor | ndarray)

Return type:

ndarray