@@ -40,6 +40,9 @@ int CountNonZero(const cv::Mat& image) {
40
40
return cv::countNonZero (image_gray);
41
41
}
42
42
43
+ // Clang-tidy doesn't like the macros
44
+ // NOLINTBEGIN(readability-function-cognitive-complexity)
45
+
43
46
TEST_CASE (" Stitcher pipeline defaults" ) {
44
47
xpano::pipeline::StitcherPipeline<kReturnFuture > stitcher;
45
48
@@ -93,9 +96,6 @@ TEST_CASE("Stitcher pipeline defaults") {
93
96
CHECK (total_pixels == non_zero_pixels);
94
97
}
95
98
96
- // Clang-tidy doesn't like the macros
97
- // NOLINTBEGIN(readability-function-cognitive-complexity)
98
-
99
99
TEST_CASE (" Stitcher pipeline single pano matching" ) {
100
100
xpano::pipeline::StitcherPipeline<kReturnFuture > stitcher;
101
101
auto loading_task = stitcher.RunLoading (
@@ -134,8 +134,6 @@ TEST_CASE("Stitcher pipeline no matching") {
134
134
}
135
135
}
136
136
137
- // NOLINTEND(readability-function-cognitive-complexity)
138
-
139
137
const std::vector<std::filesystem::path> kShuffledInputs = {
140
138
" data/image01.jpg" , // Pano 1
141
139
" data/image06.jpg" , // 2
@@ -500,3 +498,37 @@ TEST_CASE("Stitcher pipeline polling") {
500
498
CHECK_THAT (pano1->rows , WithinRel (976 , eps));
501
499
CHECK_THAT (pano1->cols , WithinRel (1335 , eps));
502
500
}
501
+
502
+ const std::vector<std::filesystem::path> kInputsWithStack = {
503
+ " data/image01.jpg" , // Minimal shift
504
+ " data/image05.jpg" , // between images
505
+ " data/image06.jpg" ,
506
+ " data/image07.jpg" ,
507
+ };
508
+
509
+ TEST_CASE (" Stitcher pipeline stack detection" ) {
510
+ const float min_shift = 0 .2f ;
511
+ xpano::pipeline::StitcherPipeline<kReturnFuture > stitcher;
512
+ auto loading_task =
513
+ stitcher.RunLoading (kInputsWithStack , {}, {.min_shift = min_shift});
514
+ auto result = loading_task.future .get ();
515
+ auto progress = loading_task.progress ->Report ();
516
+ CHECK (progress.tasks_done == progress.num_tasks );
517
+
518
+ std::vector<xpano::algorithm::Match> good_matches;
519
+ std::copy_if (result.matches .begin (), result.matches .end (),
520
+ std::back_inserter (good_matches), [](const auto & match) {
521
+ return match.matches .size () >= xpano::kDefaultMatchThreshold ;
522
+ });
523
+
524
+ CHECK (result.images .size () == 4 );
525
+
526
+ REQUIRE (good_matches.size () == 2 );
527
+ CHECK (good_matches[0 ].avg_shift < min_shift);
528
+ CHECK (good_matches[1 ].avg_shift >= min_shift);
529
+
530
+ REQUIRE (result.panos .size () == 1 );
531
+ CHECK_THAT (result.panos [0 ].ids , Equals<int >({2 , 3 }));
532
+ }
533
+
534
+ // NOLINTEND(readability-function-cognitive-complexity)
0 commit comments