Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ChArUco pipeline

Composes: the chessboard grid stack + ArUco bit decode + ChArUco alignment & corner IDs. Source of truth: crates/calib-targets-charuco/docs/PIPELINE.md. Crate reference: calib-targets-charuco.

A ChArUco board carries an ArUco marker in every white square. The pipeline runs the chessboard grid detector first, then decodes the per-cell markers, aligns them to the board spec, and assigns each inner corner its absolute, OpenCV-compatible corner ID. The markers are what make ChArUco robust to partial views and unambiguous about orientation.

End-to-end stages

#StageIn → OutWhat it does
0chessboard grid detectChESS corners → Vec<ChessboardDetection>ChessboardDetector::detect_all (the chessboard pipeline). The min_corner_strength floor keeps marker-bit saddles out of the grid (below).
1grid smoothness pre-filtergrid corners + image → cleaned cornersPer-corner position vs midpoint-averaged neighbours; a deviation over grid_smoothness_threshold_rel × px_per_square triggers a local ChESS redetection or a drop.
2marker cell enumerationcorner map → Vec<MarkerCell>Per cell, require all four corners {(i,j),(i+1,j),(i+1,j+1),(i,j+1)}; skip incomplete cells.
3marker decode + alignmentcells + image → markers + alignmentScore each cell’s soft bits (ArUco bit decode) against every (D4 rotation, integer translation) board hypothesis, pick the maximum-likelihood placement, and accept it only above chance and through a margin gate. See alignment.
4alignment validationmarkers + spec → inliersRequire ≥ min_marker_inliers (primary component) or ≥ min_secondary_marker_inliers (subsequent).
5ChArUco corner mappingcorners + alignment → IDed cornersMap each board-spec inner-corner position through the alignment; only inner-cell intersections get IDs (not marker corners).
6corner validationmapped corners + markers + image → validated cornersCheck each corner against its marker-predicted seed; deviation over corner_validation_threshold_rel × px_per_square → marker-constrained re-detection, which must land within that same distance of the seed, or drop. Re-detection uses the front end’s localizer.
7emit detectionvalidated corners + alignment → resultSort typed ChArUco corners by ID; refuse below the caller’s threshold.

What it inherits from the chessboard detector — and the strength floor

ChArUco runs the full chessboard topological pipeline (prefilter, clustering, the grid walk, booster recovery, and the mandatory geometry check). The chessboard precision contract carries forward: a wrong (i, j) label here would corrupt every downstream marker match.

CharucoParams::for_board sets two chessboard knobs that adapt the shared detector to marker scenes:

  • min_corner_strength = 33.0 — an absolute ChESS-strength floor that cuts the weak corner responses on ArUco marker-bit saddles before the grid grows. Those corners are grid-consistent but lie inside the marker interior; cutting them early keeps the topological per-cell axis test from being poisoned by marker-internal X-corners. This floor — not marker presence — is the precision lever here.
  • the chessboard’s final wrong-label geometry check stays enabled, exactly as for the standalone chessboard detector. Marker decoding is not a substitute: the board alignment searches D4 × integer translation, a rigid relabelling of whatever lattice the chessboard produced, so it cannot see or repair a labelling that is wrong within a component.

Failure modes

SymptomLikely stageWhat it means / knob to try
No grid / None from Stage 0Stage 0 (chessboard)Sparse corner cloud or clustering failure — see the chessboard failure modes.
NoMarkers (grid found, no decodes)Stage 3 (decode)Wrong dictionary / marker_size_rel / border_bits, or blur. Verify the board spec, give the markers more pixels (chess.upscale), check inset_frac.
AlignmentFailed { inliers: 0 }Stage 4No decoded ID is in the layout — board-spec mismatch (rows, cols, dictionary, marker_layout) or a non-zero first_marker offset.
AlignmentFailed, small but non-zero inliersStage 4Partial view or strong perspective — lower min_marker_inliers to what you reliably see.
Small soft-matcher marginStage 3 (board-level matcher)Ambiguous decodes / heavy bit noise — the margin gate is flagging a low-confidence alignment.
evidence_at_chance rejectionStage 3 (board-level matcher)The markers read are no stronger than chance decodes — typically a small grid fragment whose cells are too blurred to read. Give the markers more pixels or less blur; no knob relaxes this.
Corners drift off true intersectionsStage 6Weak alignment — verify the board pose / occlusion; check corner_validation_threshold_rel.
Wrong corner IDsneverA wrong chessboard (i, j) would cause this — file a bug at the chessboard layer.

Tuning

ChArUco config layers three surfaces:

  • Chessboard grid — CharucoParams.chessboard is a ChessboardParams (stable core + opt-in advanced). for_board pre-sets the marker-scene-safe min_corner_strength floor; do not lower it on marker boards.
  • Marker decode — inset_frac (default 0.06; raise when borders bleed into the bit grid). The marker’s size (board.marker_size_rel) and border ring (board.border_bits) come from the board spec, which must match the printed board.
  • Alignment — the board-level matcher’s alignment_min_margin / bit_likelihood_slope, the downstream min_marker_inliers / min_secondary_marker_inliers floors (default 1 each — the matcher is its own gate), and corner_validation_threshold_rel (default 0.08).

Board sampling scale is px_per_square (starts at 60 in for_board); adjust it first if the board appears at a very different pixel scale. For challenging images use CharucoParams::sweep_for_board(&board) with detect_charuco_best. See Tuning the Detector and Troubleshooting.

Cross-references