darfix.core.componentsMatching.ComponentsMatching#

class darfix.core.componentsMatching.ComponentsMatching(components)[source]#

Bases: object

Class to compute component matching.

Parameters:

components (array_like) – List of stack of images. Every element of the list contains a stack of components from a certain dataset.

draw_matches(final_matches, matches, id1=None, id2=None, displayMatches=False)[source]#

Create stack of images with each pair of matches.

Parameters:
  • final_matches (dict) – Dictionary with the best pairs of matches per items.

  • matches (dict) – Dictionary with keys the pairs of matches and with values the information of every pair of components.

  • id1 (Union[int,None]) – Id of the first dataset to compare.

  • id2 (Union[int,None]) – Id of the second dataset to compare.

  • displayMatches (bool) – If True, dictionary matches has to contain values of type cv2.DMatch.

Returns array_like:

stack with the pairs of images, and if so, info about the matching.

euclidean_distance(X, Y)[source]#

Compute euclidean distance between two images.

match_components(id1=None, id2=None, method=Method.orb_feature_matching, tol=8)[source]#

Match components. Given the components x1,…,xn of dataset 1 and the components y1,…,ym of dataset 2, this function computes the pairs (xi,yi) that have better matching. Considering that each component of dataset 1 corresponds to one and only one component of dataset 2.

Parameters:
  • id1 (Union[int,None]) – Id of the first dataset to compare.

  • id2 (Union[int,None]) – Id of the second dataset to compare.

  • method (Method) – Method to use for the matching.

Returns:

Dictionary with components ids of id1 per keys and their corresponding id component of id2 match per values, and dictionary with the matching info per pair of components.

Return type:

(dict, dict)