code: def compute_matches(
      feature_source,
      feature_target,
      kp_source,
      kp_target,
      ratio=False,
      sym=False,
  ):
      """
      compute matches between features
      """
  
      tree_source = KDTree(feature_source)
      tree_target = KDTree(feature_target)
      _, nn_ind_source = tree_target.query(feature_source, k=1)
      _, nn_ind_target = tree_source.query(feature_target, k=1)
  
      # symetric test
      if sym:
          indmatch = np.where(
              nn_ind_source.T[0][nn_ind_target.T[0]]
              == np.arange(len(feature_source))
          )[0]
      else:
          indmatch = np.arange(len(feature_target))
      new_kp_source = np.copy(kp_source[nn_ind_target.T[0][indmatch]])
      new_kp_target = np.copy(kp_target[indmatch])
  
      return new_kp_source, new_kp_target
  
file_path: torch-points3d/scripts/test_registration_scripts/descriptor_matcher.py
imports: import pandas
  import hydra
  import numpy
  from sklearn.neighbors import KDTree
  import os
  import os.path
  from omegaconf import OmegaConf
  import sys
  import matplotlib.pyplot
label_desc: Use image node_id 2 for calling a global function with example usage: compute_matches(feature_source, feature_target, kp_source, kp_target, ratio, sym) and returns: new_kp_source,  new_kp_target