miop.feature_matching

Classes

DenseRoma([num_matches, tiny])

Perform dense feature matching between image pairs using the RoMa model.

Interpolate()

Densify sparse feature matches into full disparity maps using interpolation.

class miop.feature_matching.DenseRoma(num_matches=5000, tiny=False)[source]

Bases: DAGNode

Perform dense feature matching between image pairs using the RoMa model.

RoMa can be installed from the researcher’s repository: https://github.com/Parskatt/RoMa

eval(img_collection)[source]

Run RoMa matching on an image collection.

Parameters:

img_collection (ImageCollection) – A collection of faces, each containing a list of image pairs to match.

Returns:

A nested list of matched keypoints for each face. Each element contains a list of two (N, 2) arrays representing the matched keypoints in the two images.

Return type:

List[List[np.ndarray]]

plot_images(img1, img2)[source]

Plot two images side by side.

Parameters:
  • img1 (np.ndarray) – First image. Shape (H, W, 3) or (H, W).

  • img2 (np.ndarray) – Second image. Shape (H, W, 3) or (H, W).

plot_keypoints(kpts, colors='lime')[source]

Plot keypoints on the currently displayed images.

Parameters:
  • kpts (List[np.ndarray]) – List of (N, 2) arrays containing keypoint coordinates.

  • colors (str or List[str], optional) – Color or list of colors for the keypoints. Default is “lime”.

plot_matches(kpts0, kpts1)[source]

Plot lines between matching keypoints in a pair of images.

Parameters:
  • kpts0 (np.ndarray) – (N, 2) array of keypoints in the first image.

  • kpts1 (np.ndarray) – (N, 2) array of keypoints in the second image.

show(idx, n)[source]

Visualize matching keypoints for a given face and image index.

Parameters:
  • idx (tuple of int) – A tuple of (face_index, image_index).

  • n (int) – Number of keypoints/matches to display.

class miop.feature_matching.Interpolate[source]

Bases: DAGNode

Densify sparse feature matches into full disparity maps using interpolation.

Interpolation is done with scipy.interpolate.griddata(method=’linear’).

eval(matches)[source]

Generate dense disparity maps from sparse matches.

Parameters:

matches (List[List[np.ndarray]]) – A nested list of shape (M, N), where M is the number of faces and N is the number of image pairs. Each entry is a (2, N, 2) array of matched keypoints, where the first element contains keypoints from image 1 and the second from image 2.

Returns:

A nested list of shape (M, N), where each element contains two (H, W) arrays: the horizontal and vertical disparity maps.

Return type:

List[List[np.ndarray]]