Fix DpSeamFinder::hasOnlyOneNeighbor

std::lower_bound is linear for set
https://en.cppreference.com/w/cpp/algorithm/lower_bound
This commit is contained in:
KaurkerDevourer 2022-02-11 14:38:48 +03:00 committed by Stepan Styopkin
parent 1890157faa
commit 9198e30688

View 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;
}