Fix DpSeamFinder::hasOnlyOneNeighbor
authorKaurkerDevourer <styopkin@yandex-team.ru>
Fri, 11 Feb 2022 11:38:48 +0000 (14:38 +0300)
committerStepan Styopkin <drhykterstein@gmail.com>
Sat, 19 Feb 2022 11:24:05 +0000 (14:24 +0300)
std::lower_bound is linear for set
https://en.cppreference.com/w/cpp/algorithm/lower_bound

modules/stitching/src/seam_finders.cpp

index c8a320d..a19f5a6 100644 (file)
@@ -554,8 +554,8 @@ void DpSeamFinder::computeGradients(const Mat &image1, const Mat &image2)
 bool DpSeamFinder::hasOnlyOneNeighbor(int comp)
 {
     std::set<std::pair<int, int> >::iterator begin, end;
-    begin = lower_bound(edges_.begin(), edges_.end(), std::make_pair(comp, std::numeric_limits<int>::min()));
-    end = upper_bound(edges_.begin(), edges_.end(), std::make_pair(comp, std::numeric_limits<int>::max()));
+    begin = edges_.lower_bound(std::make_pair(comp, std::numeric_limits<int>::min()));
+    end = edges_.upper_bound(std::make_pair(comp, std::numeric_limits<int>::max()));
     return ++begin == end;
 }