feat: wire --icp-depth-bias flag in refine_ground_plane.py

This commit is contained in:
2026-02-11 11:26:20 +00:00
parent be3e454644
commit 53e56006cc
2 changed files with 93 additions and 1 deletions
@@ -0,0 +1,10 @@
- Implemented `estimate_depth_biases(...)` in `aruco/icp_registration.py` using the same scene extraction + overlap gating pattern as ICP (`overlap_mode` auto-derived from `config.region`, then `compute_overlap_xz`/`compute_overlap_3d` + `min_overlap_area`).
- Pairwise bias observation uses robust medians of scalar residuals projected along source camera rays in world frame: `r = (p_target - p_source) dot ray_source_world`.
- Global solve is constrained least squares over pair equations `beta_j - beta_i ~= b_ij` with gauge fixed by forcing reference camera bias to exactly `0.0`; disconnected cameras remain at fallback `0.0`.
- Safety cap implemented via `max_abs_bias` defaulting to `0.3 m` (read from config via `getattr`), with clipping logs for implausible estimates.
- Task 2 integration in `refine_with_icp`: added config gate `depth_bias` (default `True`) and metrics field `depth_biases` to preserve visibility of applied prepass offsets.
- Refinement loop now applies copy-based depth correction per camera (`depth_corrected = data["depth"].copy()`), adds `beta`, masks non-positive depths to `NaN`, and unprojects from corrected depth without mutating the original input map.
## Patterns and Conventions
- Wired new CLI flags in `refine_ground_plane.py` using click options.
- Extended `_meta.icp_refined` JSON structure to include `depth_bias` config and `depth_biases` metrics.
- Logged estimated biases if available in `ICPMetrics`.