fix: correct MAGSAC++ IRLS gamma weight (B2 + B3) in sigmaConsensusPlusPlus - #49
Draft
f-dy wants to merge 1 commit into
Draft
fix: correct MAGSAC++ IRLS gamma weight (B2 + B3) in sigmaConsensusPlusPlus#49f-dy wants to merge 1 commit into
f-dy wants to merge 1 commit into
Conversation
…usPlus The IRLS refinement weight in sigmaConsensusPlusPlus evaluated the gamma at the wrong argument, identically to the bug fixed in graph-cut-ransac's getScore: - B3: the weight used sigma_max = current_maximum_sigma (= maximum_threshold), whereas the paper / getModelQualityPlusPlus use sigma_max = threshold / k. Now the weight's argument and prefactor use maximum_threshold/k; the inlier collection cutoff (current_maximum_sigma) is unchanged. - B2: the index used precision_of_stored_incomplete_gammas-style precision (1e4) against the coarse stored_gamma_values table (step 1e-3) -> gamma at 10x the argument. Now indexes the fine stored_complete_gamma_values table. This makes the IRLS weight match getModelQualityPlusPlus (already correct) and the MAGSAC++ paper. Changes results for the existing (DoF=4) estimators; validate on Adelaide/EVD/homogr before submission. Independent of danini#45 (per-estimator DoF), adapted onto this corrected base separately. Depends on the companion graph-cut-ransac PR for the duplicated getScore weight.
This was referenced May 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix: correct MAGSAC++ IRLS gamma weight (B2 + B3) in
sigmaConsensusPlusPlusProblem
The IRLS refinement weight in
MAGSAC::sigmaConsensusPlusPlus(magsac.h)evaluates the gamma at the wrong argument — the same bug class as in
graph-cut-ransac's
getScore, and inconsistent with this file's owngetModelQualityPlusPlus(which is correct):sigma_max = current_maximum_sigma(
= maximum_threshold). The MAGSAC++ paper, andgetModelQualityPlusPlus, usesigma_max = threshold / k(k = √χ²₀.₉₉(dof)).1e4precision against the coarse
stored_gamma_valuestable (step1e-3),reading
Γ(1.5, 10·t)— the gamma at 10× the intended argument.B2 and B3 partially cancel (
10/k² ≈ 0.75for DoF=4), which is why results arestill reasonable — but the IRLS weight is not the paper's, and disagrees with the
marginal scoring in the same class.
Fix
Mirror the already-correct
getModelQualityPlusPlus:The inlier-collection cutoff (
current_maximum_sigma > residual) is unchanged— the paper truncates the weight at
r ≤ k·σ_max = threshold.getModelQualityPlusPlusis untouched (already correct).
This changes results for the existing (DoF=4) estimators (it removes the
10/k²distortion in the IRLS refinement). Validate on Adelaide / EVD / homogr(median error and failure rate, before/after) before merging.
Companion graph-cut-ransac PR fixes the identical bug in the duplicated
getScoreweight: danini/graph-cut-ransac#53 — releasedtogether. Independent of the per-estimator-DoF PR #45, which is adapted onto this
corrected base separately.