1 | initial version |
I ended up implementing vl_ubcmatch in python. Short and sweet :)
def find_matches(template_descriptors, current_img_descriptors, match_thresh):
flann_params = dict(algorithm=1, trees=4)
flann = cv2.flann_Index(current_img_descriptors, flann_params)
idx, dist = flann.knnSearch(template_descriptors, 2, params={})
del flann
matches = np.c_[np.arange(len(idx)), idx[:,0]]
pass_filter = dist[:,0]*match_thresh < dist[:,1]
matches = matches[pass_filter]
return matches
2 | added c++ version of the code |
I ended up implementing vl_ubcmatch in python. Short and sweet :)
def find_matches(template_descriptors, current_img_descriptors, match_thresh):
flann_params = dict(algorithm=1, trees=4)
flann = cv2.flann_Index(current_img_descriptors, flann_params)
idx, dist = flann.knnSearch(template_descriptors, 2, params={})
del flann
matches = np.c_[np.arange(len(idx)), idx[:,0]]
pass_filter = dist[:,0]*match_thresh < dist[:,1]
matches = matches[pass_filter]
return matches
If you want c++ version, this guy wrote about it in his blog.
In the comments, he gives a link to his cpp file with the code (change the extension from txt to cpp).
3 | No.3 Revision |
I ended up implementing vl_ubcmatch in python. Short and sweet :)
def find_matches(template_descriptors, current_img_descriptors, match_thresh):
flann_params = dict(algorithm=1, trees=4)
flann = cv2.flann_Index(current_img_descriptors, flann_params)
idx, dist = flann.knnSearch(template_descriptors, 2, params={})
del flann
matches = np.c_[np.arange(len(idx)), idx[:,0]]
pass_filter = dist[:,0]*match_thresh < dist[:,1]
matches = matches[pass_filter]
return matches
If you want a c++ version, this guy wrote about it extracted the cpp code from vlfeat's mex code in his
blog.
In the comments, he gives a link to his cpp file with the code (change the extension from txt to cpp).