Commit 24faf95d authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[core][components matching] Adds check for similar vectors in sift

parent 42e0dfbd
Pipeline #22171 passed with stage
in 2 minutes and 23 seconds
......@@ -162,7 +162,7 @@ class ComponentsMatching():
elif method == Method.sift_feature_matching:
keypoints = self._create_sift_keypoints()
best_v = []
mp = sift.MatchPlan()
# Match components with id1 and id2
for i, kp1 in enumerate(keypoints[id1]):
......@@ -174,7 +174,13 @@ class ComponentsMatching():
# Only add match if neither x nor y are already in the list.
if x not in final_matches.keys() and y not in final_matches.values():
final_matches[x] = y
v = numpy.array([numpy.median(good[(x, y)][:, 1].x - good[(x, y)][:, 0].x),
numpy.median(good[(x, y)][:, 1].y - good[(x, y)][:, 0].y)])
if not numpy.any(best_v):
best_v = v
final_matches[x] = y
elif numpy.linalg.norm(best_v - v) < tol:
final_matches[x] = y
elif method == Method.euclidean_distance:
for i, X in enumerate(self.components[id1]):
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment