-
-
Notifications
You must be signed in to change notification settings - Fork 184
/
Copy pathtest_range_width_matcher.py
52 lines (43 loc) · 1.43 KB
/
test_range_width_matcher.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import unittest
import numpy as np
from .context import (
FeatureDetector,
FeatureMatcher,
Stitcher,
load_test_img,
test_input,
test_output,
)
class TestRangeMatcher(unittest.TestCase):
def test_BestOf2NearestRangeMatcher(self):
img1 = load_test_img("weir_1.jpg")
img2 = load_test_img("weir_2.jpg")
img3 = load_test_img("weir_3.jpg")
detector = FeatureDetector("orb")
features = [detector.detect_features(img) for img in [img1, img2, img3]]
matcher = FeatureMatcher(range_width=1)
pairwise_matches = matcher.match_features(features)
conf_matrix = FeatureMatcher.get_confidence_matrix(pairwise_matches)
self.assertTrue(
np.array_equal(
conf_matrix > 0,
np.array(
[[False, True, False], [True, False, True], [False, True, False]]
),
)
)
def test_matches_graph_issue56(self):
settings = {
"range_width": 1,
"confidence_threshold": 0,
"matches_graph_dot_file": test_output("range_width_matches_graph.txt"),
}
stitcher = Stitcher(**settings)
stitcher.stitch(
[
test_input("weir_1.jpg"),
test_input("weir_2.jpg"),
test_input("weir_3.jpg"),
]
)
# TODO: Automated test that matches graph is correct