Skip to content

Commit

Permalink
switch to flann based matcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Colin McFadden committed Jun 14, 2024
1 parent ca9386e commit 52f31c8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions stitcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ def calculate_offset(self,img1, img2, enableMask):

# As of 10/11/2016, Flann is broken on binary builds of opencv for windows. Fall back to BF in those cases.
# if(platform.system() != 'Windows'):
# flann = cv2.FlannBasedMatcher({'algorithm': 0, 'trees': 5}, {'checks': CONFIG['flann_checks']})
# matches = flann.knnMatch(des1, des2, k=2)
flann = cv2.FlannBasedMatcher({'algorithm': 0, 'trees': 5}, {'checks': CONFIG['flann_checks']})
matches = flann.knnMatch(des1, des2, k=2)
# else:
bfMatch = cv2.BFMatcher(cv2.NORM_L2)
matches = bfMatch.knnMatch(des1, des2, k=2)
# bfMatch = cv2.BFMatcher(cv2.NORM_L2)
# matches = bfMatch.knnMatch(des1, des2, k=2)

# Limit to reasonable matches
good_matches = [m for m, n in matches if m.distance < 0.7 * n.distance]
Expand Down

0 comments on commit 52f31c8

Please sign in to comment.