summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-11-16 23:20:12 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2026-11-16 23:20:12 +0100
commitbc11f74636b216224b59a3a97f05b050a5ab7988 (patch)
treea2cc101db4749222d1dcfbac9889d9f8bfeae0a4
parent9f4700da89f9ceda9f67ffe4b4d073dd68ecd739 (diff)
core: drop the absolute-RMS rejection threshold
The rms > 30 px gate was a heuristic backstop, and a flawed one: pixels are the wrong unit (30 px means something different on a 600 px crop than on a 4000 px panorama), and over-determined fits - 4+ markers, unmodeled distortion, honest marker slop - routinely sit at tens of px RMS while being perfectly good fits. Rejecting those would be worse than the garbage-commits it was guarding against, which the principled checks (marker order, same-side feasibility, validity filter) already cover exactly. RMS is still computed and printed to the fit session log as a purely informational line (final rms=NN.Npx).
-rw-r--r--crates/gipfel-core/src/lsq.rs24
1 files changed, 11 insertions, 13 deletions
diff --git a/crates/gipfel-core/src/lsq.rs b/crates/gipfel-core/src/lsq.rs
index 182cd84..078d421 100644
--- a/crates/gipfel-core/src/lsq.rs
+++ b/crates/gipfel-core/src/lsq.rs
@@ -636,19 +636,17 @@ pub fn comp_params(
));
}
- // The fit must actually MATCH the markers. cost = 0.5 * sum(resid^2)
- // over 2n residuals, so rms = sqrt(cost/n). A huge residual means the
- // marked geometry cannot be represented in this projection mode at
- // all - e.g. a panorama (linear pixel spacing) fitted rectinearly has
- // provably no exact solution for wide spans; the optimizer then
- // commits absurd parameters (pitch -80 deg, scale at the sanity
- // floor) that pass the other guards but never match the markers.
- let rms = (final_cost / n as f64).max(0.0).sqrt();
- if final_cost.is_finite() && rms > 30.0 {
- return bail(format!(
- "Fit cannot match the markers (RMS {rms:.0} px) - this projection cannot represent the marked geometry. Is this a panorama? Switch to cylindrical mode."
- ));
- }
+ // Informational only: RMS pixel error of the marked peaks in the
+ // final solution (cost = 0.5 * sum(resid^2) over 2n residuals, so
+ // rms = sqrt(cost/n)). NOT a rejection criterion - over-determined
+ // fits (4+ markers, unmodeled distortion) legitimately sit at tens
+ // of px, and the pixel unit does not translate across image sizes.
+ // Unsatisfiable geometries are caught by the principled checks
+ // (marker order, same-side feasibility, validity filter).
+ flog(format!(
+ "final rms={:.2}px",
+ (final_cost / n as f64).max(0.0).sqrt()
+ ));
*parms = new_parms;
Ok(())