| 55 | }; |
| 56 | |
| 57 | TEST(DenseMatcherTestSuite, denseMatcherTest) { |
| 58 | TestMatchingAlgorithm tma; |
| 59 | |
| 60 | tma.listA.push_back(1.0); |
| 61 | tma.listA.push_back(3.0); |
| 62 | tma.listA.push_back(2.0); |
| 63 | tma.listA.push_back(0.9); |
| 64 | |
| 65 | /// This shouldn't be matched because 18 - 4 > 4.0 |
| 66 | tma.listB.push_back(18.0); |
| 67 | tma.listB.push_back(2.1); |
| 68 | tma.listB.push_back(4.0); |
| 69 | // This shouldn't be matched with listA[0] because of skipping listA[0] |
| 70 | // So, it will be matches with listA[3] |
| 71 | tma.listB.push_back(1.0); |
| 72 | |
| 73 | // We should have 1 --> 2 and 2 --> 1 |
| 74 | |
| 75 | okvis::DenseMatcher matcher; |
| 76 | |
| 77 | matcher.match(tma); |
| 78 | |
| 79 | ASSERT_EQ(3u, tma.matches.size()); |
| 80 | |
| 81 | for (size_t i = 0; i < tma.matches.size(); ++i) { |
| 82 | switch (tma.matches[i].first) { |
| 83 | case 1: |
| 84 | ASSERT_EQ(2, tma.matches[i].second); |
| 85 | break; |
| 86 | case 2: |
| 87 | ASSERT_EQ(1, tma.matches[i].second); |
| 88 | break; |
| 89 | case 3: |
| 90 | ASSERT_EQ(3, tma.matches[i].second); |
| 91 | break; |
| 92 | default: |
| 93 | FAIL() << "Unexpected match " << tma.matches[i].first << " --> " << tma.matches[i].second; |
| 94 | } |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | TEST(DenseMatcherTestSuite, denseMatcherDistanceRatioTest) { |
| 99 | TestMatchingAlgorithm tma; |