KeypointMatcher

class giant.image_processing.feature_matchers.KeypointMatcher(options_type, *args, options=None, **kwargs)[source]

Abstract base class defining the interface for keypoint detection and matching.

Parameters:
abstractmethod detect_keypoints(image)[source]

Detect keypoints and compute descriptors in an image.

Parameters:

image (ndarray[tuple[Any, ...], dtype[_ScalarT]]) – The image to search for keypoints

Returns:

Tuple of (keypoints, descriptors)

Return type:

tuple[Sequence[KeyPoint], ndarray[tuple[Any, …], dtype[_ScalarT]]]

match_descriptors(descriptors1, descriptors2)[source]

Match keypoint descriptors using FLANN and Lowe’s ratio test.

Parameters:
  • descriptors1 (ndarray[tuple[Any, ...], dtype[_ScalarT]]) – Descriptors from first image

  • descriptors2 (ndarray[tuple[Any, ...], dtype[_ScalarT]]) – Descriptors from second image

Returns:

Tuple of (good_matches, all_matches)

Return type:

tuple[Sequence[DMatch], Sequence[Sequence[DMatch]]]

This can be overridden if desired

match_images(image1, image2)[source]

Orchestrates the detect-then-match process.

This concrete method fulfills the ImageMatcher interface requirement. It uses the abstract detect_and_compute and match_descriptors methods to perform the full matching pipeline.

Parameters:
  • image1 (ndarray[tuple[Any, ...], dtype[_ScalarT]]) – The first image to match keypoints

  • image2 (ndarray[tuple[Any, ...], dtype[_ScalarT]]) – The second image to match keypoints

Returns:

An array of the matched keypoint locations as nx2x2

Return type:

ndarray[tuple[Any, …], dtype[float64]]

filter_lowes(matches)[source]

Filters matches based on the Lowe’s ratio test

Parameters:

matches (Sequence[Sequence[DMatch]]) – a sequence of sequences of all the matches computed

Returns:

A sequence of the good matches that pass the ratio test.

Return type:

Sequence[DMatch]

Methods

detect_keypoints

Detect keypoints and compute descriptors in an image.

match_descriptors

Match keypoint descriptors using FLANN and Lowe's ratio test.

match_images

Orchestrates the detect-then-match process.

filter_lowes

Filters matches based on the Lowe's ratio test