pair_coordinates

pair_coordinates(setA, setB, radius)[source]

Find optimal unique pairing between two sets of coordinates.

This function uses the Munkres or Kuhn-Munkres algorithm behind the scene to find the most optimal unique pairing when pairing points in set B against points in set A, using euclidean distance as the cost function.

Parameters
  • setA (ndarray) – an array of shape Nx2 contains the of XY coordinate of N different points.

  • setB (ndarray) – an array of shape Mx2 contains the of XY coordinate of M different points.

  • radius – valid area around a point in setA to consider a given coordinate in setB a candidate for matching.

Returns

an array of shape Kx2, each item in K contains

indices where point at index [0] in set A paired with point in set B at index [1].

unpairedA (ndarray): indices of unpaired points in set A. unpairedB (ndarray): indices of unpaired points in set A.

Return type

pairing (ndarray)