Skip to main content

Crate calib_targets_chessboard

Crate calib_targets_chessboard 

Source
Expand description

Invariant-first chessboard detector.

Takes a slice of ChESS X-junction corners and returns an integer-labelled chessboard grid. The crate’s only output contract is: every labelled corner has been proven to sit at a real grid intersection. Missing corners are acceptable; wrong corners are not.

High detection rate on our private regression set with zero wrong (i, j) labels (non-negligible lens distortion and motion blur).

Algorithm reference: see book/src/chessboard.md.

§Pipeline

  1. Pre-filter (strength + fit-quality + axes validity).
  2. Global grid-direction centers {Θ₀, Θ₁} via axes-histogram + 2-means.
  3. Per-corner cluster label (canonical vs swapped axis assignment).
  4. Global cell-size s (cross-cluster nearest-neighbor mode).
  5. Seed: pick a 2×2 quad passing every geometric invariant; cell size comes OUT of the seed.
  6. Grow: BFS over (i, j) boundary with the full invariant stack enforced at every attachment.
  7. Validate: line collinearity + local-H residual; blacklist outliers; restart Stages 5–7 with the blacklist excluded.
  8. Recall boosters: line extrapolation, interior gap fill, component merge, weak-cluster rescue.

Each stage is its own module; see the submodules.

§Quickstart

use calib_targets_chessboard::{Detector, DetectorParams};
use calib_targets_core::Corner;

fn detect(corners: &[Corner]) {
    let det = Detector::new(DetectorParams::default());
    if let Some(d) = det.detect(corners) {
        println!("labelled {} corners", d.target.corners.len());
    }
}

§Rectification helpers

Two pattern-agnostic rectifiers are exposed under mesh_warp and rectified_view: they take a &[LabeledCorner] plus an inlier index list (typically Detection::strong_indices) and produce a rectified view. They are independent of the detector pipeline and can be used with any consistent (i, j) labelling.

Re-exports§

pub use boosters::apply_boosters;
pub use boosters::BoosterResult;
pub use cell_size::estimate_cell_size;
pub use cluster::cluster_axes;
pub use cluster::cluster_axes_debug;
pub use cluster::AxisCluster;
pub use cluster::ClusterCenters;
pub use cluster::ClusterDebug;
pub use corner::ClusterLabel;
pub use corner::CornerAug;
pub use corner::CornerStage;
pub use detector::build_detection_from_grow;
pub use detector::DebugFrame;
pub use detector::Detection;
pub use detector::Detector;
pub use detector::InstrumentedResult;
pub use detector::IterationTrace;
pub use detector::StageCounts;
pub use detector::DEBUG_FRAME_SCHEMA;
pub use grow::grow_from_seed;
pub use grow::GrowResult;
pub use mesh_warp::rectify_mesh_from_grid;
pub use mesh_warp::MeshWarpError;
pub use mesh_warp::RectifiedMeshView;
pub use params::DetectorParams;
pub use params::GraphBuildAlgorithm;
pub use rectified_view::rectify_from_chessboard_result;
pub use rectified_view::RectifiedBoardView;
pub use rectified_view::RectifyError;
pub use seed::find_seed;
pub use topological::detect_all_topological;
pub use validate::validate;

Modules§

boosters
Phase E — recall boosters (spec §5.8).
cell_size
Global cell-size estimation for the detector.
cluster
Axes-based orientation clustering for the detector.
corner
Per-corner augmented state carried through the pipeline.
detector
Detector orchestrator: run the precision core end-to-end.
grow
Stage 6 — BFS-style growth over the labelled (i, j) set.
mesh_warp
params
Chessboard detector parameters.
rectified_view
seed
Chessboard seed finder.
topological
Topological dispatch path for the chessboard detector.
validate
Stage 7 — post-growth validation.

Structs§

Seed
Seed quad: corner indices at grid cells (0, 0), (1, 0), (0, 1), (1, 1)` respectively.
SeedOutput
Output of a seed finder: the 2×2 quad plus a cell size derived directly from the seed’s own edge lengths.
ValidationResult
Outcome of one validation pass.