Commit 42e0dfbd authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[core][components matching] Cleaning

parent d773e20c
Pipeline #22169 passed with stage
in 2 minutes and 26 seconds
......@@ -26,7 +26,7 @@
__authors__ = ["J. Garriga"]
__license__ = "MIT"
__date__ = "21/01/2020"
__date__ = "28/02/2020"
import cv2
import numpy
......@@ -218,29 +218,6 @@ class ComponentsMatching():
assert all((isinstance(match, cv2.DMatch) for match in values)
for values in matches.values()), \
"Dictionary `matches` has to contain values of type `cv2.DMatch`"
"""
if len(matches[(i, j)])>MIN_MATCH_COUNT:
kp2 = self.components[id2][j].keypoints
src_pts = numpy.float32([kp1[m.queryIdx].pt for m in matches[(i, j)]]).reshape(-1,1,2)
dst_pts = numpy.float32([kp2[m.trainIdx].pt for m in matches[(i, j)]]).reshape(-1,1,2)
M, mask = cv2.findHomography(src_pts, dst_pts, cv2.RANSAC,5.0)
matchesMask = mask.ravel().tolist()
h,w = component.image.shape
pts = numpy.float32([ [0,0],[0,h-1],[w-1,h-1],[w-1,0] ]).reshape(-1,1,2)
dst = cv2.perspectiveTransform(pts,M)
img2 = cv2.polylines(img2,[numpy.int32(dst)],True,255,3, cv2.LINE_AA)
else:
print("Not enough matches are found - %d/%d" % (len(matches[(i,j)]),MIN_MATCH_COUNT))
matchesMask = None
draw_params = dict(matchColor = (0,255,0), # draw matches in green color
singlePointColor = None,
matchesMask = matchesMask, # draw only inliers
flags = 2)"""
img = cv2.drawMatches(self.descriptors[id1][i].image,
self.descriptors[id1][i].keypoints,
......
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