diff --git a/modules/stitching/src/matchers.cpp b/modules/stitching/src/matchers.cpp index 4c6cce8038..b3f1c7a1bf 100644 --- a/modules/stitching/src/matchers.cpp +++ b/modules/stitching/src/matchers.cpp @@ -826,7 +826,7 @@ void BestOf2NearestRangeMatcher::operator ()(const std::vector &f std::vector > near_pairs; for (int i = 0; i < num_images - 1; ++i) - for (int j = i + 1; j < std::min(num_images, i + range_width_); ++j) + for (int j = i + 1; j < std::min(num_images, i + 1 + range_width_); ++j) if (features[i].keypoints.size() > 0 && features[j].keypoints.size() > 0 && mask_(i, j)) near_pairs.push_back(std::make_pair(i, j));