10 sys.path.append(os.path.dirname(os.path.realpath(__file__))+
'/../core')
18 from learnedmatcher
import LearnedMatcher
22 def init(descriptorDim, matchThreshold, iterations, cuda, model_path):
23 print(
"OANet python init()")
25 lm = LearnedMatcher(model_path, inlier_threshold=1, use_ratio=0, use_mutual=0)
28 def match(kptsFrom, kptsTo, scoresFrom, scoresTo, descriptorsFrom, descriptorsTo, imageWidth, imageHeight):
31 kpt1 = np.asarray(kptsFrom)
32 kpt2 = np.asarray(kptsTo)
33 desc1 = np.asarray(descriptorsFrom)
34 desc2 = np.asarray(descriptorsTo)
37 matches, _, _ = lm.infer([kpt1, kpt2], [desc1, desc2])
41 if __name__ ==
'__main__':
43 init(128, 0.2, 20,
False,
True)
44 match([[1, 2], [1,3], [4,6]], [[1, 3], [1,2], [16,2]], [1, 3,6], [1,3,5], np.full((3, 128), 1), np.full((3, 128), 1), 640, 480)