updated SSC test and doc

This commit is contained in:
matlabbe
2026-05-16 15:40:19 -07:00
parent 614cd925b3
commit 425371a3d9
+7 -2
View File
@@ -1194,8 +1194,13 @@ TEST(Util2dTest, SSCSelectsRoughlyCorrectNumber) {
std::vector<int> selected = util2d::SSC(keypoints, maxKeypoints, tolerance, imgWidth, imgHeight, {});
EXPECT_GE(selected.size(), int(maxKeypoints * (1 - tolerance)));
EXPECT_LE(selected.size(), int(maxKeypoints * (1 + tolerance)));
// util2d::SSC() first reduces maxKeypoints by tolerance, then searches within ±tolerance of that.
const int effectiveMax = maxKeypoints - int(std::round(maxKeypoints * tolerance));
const int kMin = int(std::round(effectiveMax * (1.f - tolerance)));
const int kMax = int(std::round(effectiveMax * (1.f + tolerance)));
EXPECT_GE(selected.size(), kMin);
EXPECT_LE(selected.size(), kMax);
EXPECT_LE(selected.size(), maxKeypoints);
}
TEST(Util2dTest, SSCReturnsEmptyOnEmptyInput) {