LFDD Algorithms

Local Feature Detection and Description (LFDD) algorithms detect and describe keypoints for an image. All classes inherit KptDetDescAlgo and they implement a detect_and_describe function to return a KptDetDescAlgo.Result object containing detection results for a given image.

Local Feature Detection and Description (LFDD) algorithms implemented are listed below

Detection and Description

SIFT - Scale Invariant Feature Transform

Introduced in Lowe2004, SIFT is a popular local feature detection and description algorithm.

The following wrappers are included

class featmf.lfdd.sift.SIFTWrapper(norm_desc: bool = False, root_sift: bool = False, **sift_params)

The algorithm is directly imported from OpenCV’s SIFT implementation. There is also the option for using RootSIFT descriptors introduced in Arandjelovic2012.

__init__(norm_desc: bool = False, root_sift: bool = False, **sift_params) None
Parameters:
  • norm_desc (bool) – If True, the output descriptors are normalized

  • root_sift (bool) – If True, use RootSIFT descriptors from Arandjelovic2012

  • **sift_params

    Parameters for SIFT_create function in opencv

Since RootSIFT normalizes descriptors, do not set norm_desc and root_sift as True together.

detect_and_describe(img: ndarray, *args: Any, **kwargs: Any) Result

Detect and describe keypoints in an image using SIFT.

In detection results, the keypoints and descriptors are stored as np.ndarray objects.

- keypoints: [N, 4] array of keypoints. Each row is [x, y, size, orientation]. The orientation is in radians, and size is the keypoint neighborhood (diameter).
- descriptors: [N, 128] array of descriptors.
- scores: [N,] array of scores.
Parameters:
  • img (np.ndarray) – Input image of shape [H, W, C], where C is 1 (grayscale) or 3 (RGB). Can also be a [H, W] grayscale image.

  • *args

    Additional arguments (not used)

  • **kwargs

    Additional keyword arguments (not used)

Raises:

ValueError – If the image shape is invalid.