From 6788d2ec1ba02a85a98a899fb03f1956b13e23bd Mon Sep 17 00:00:00 2001 From: B1ueber2y Date: Sat, 15 Oct 2022 17:35:11 +0200 Subject: [PATCH] fix inlier threshold update at lsq. --- RansacLib/hybrid_ransac.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/RansacLib/hybrid_ransac.h b/RansacLib/hybrid_ransac.h index e418d2f..889156c 100644 --- a/RansacLib/hybrid_ransac.h +++ b/RansacLib/hybrid_ransac.h @@ -550,8 +550,11 @@ class HybridLocallyOptimizedMSAC : public HybridRansacBase { LeastSquaresFit(options, options.squared_inlier_thresholds_, solver_type, solver, rng, &m_non_min); + // The current threshold multiplier and its update. + std::vector cur_squared_inlier_thresholds = squared_inlier_thresholds; + for (int i = 0; i < options.num_lsq_iterations_; ++i) { - LeastSquaresFit(options, squared_inlier_thresholds, solver_type, solver, + LeastSquaresFit(options, cur_squared_inlier_thresholds, solver_type, solver, rng, &m_non_min); ScoreModel(options, solver, m_non_min, @@ -559,8 +562,8 @@ class HybridLocallyOptimizedMSAC : public HybridRansacBase { &score); UpdateBestModel(score, m_non_min, solver_type, score_best_minimal_model, best_minimal_model, best_solver_type); - for (int i = 0; i < kNumDataTypes; ++i) { - squared_inlier_thresholds[i] -= thresh_mult_updates[i]; + for (int j = 0; j < kNumDataTypes; ++j) { + cur_squared_inlier_thresholds[j] -= thresh_mult_updates[j]; } } }