def test_match_using_words(): configuration = config.default_config() nfeatures = 1000 features, words = example_features(nfeatures, configuration) matches = pyfeatures.match_using_words(features[0], words[0], features[1], words[1][:, 0], configuration['lowes_ratio'], configuration['bow_num_checks']) assert len(matches) == nfeatures for i, j in matches: assert i == j
def match_words(f1, words1, f2, words2, config): """Match using words and apply Lowe's ratio filter. Args: f1: feature descriptors of the first image w1: the nth closest words for each feature in the first image f2: feature descriptors of the second image w2: the nth closest words for each feature in the second image config: config parameters """ ratio = config["lowes_ratio"] num_checks = config["bow_num_checks"] return pyfeatures.match_using_words(f1, words1, f2, words2[:, 0], ratio, num_checks)