Troubleshooting
This chapter maps each error variant to a diagnostic checklist. For parameter descriptions, see Tuning the Detector.
Reading the debug log
Enable debug logging before anything else:
RUST_LOG=debug cargo run --example detect_charuco -- testdata/small2.png
Or from code:
#![allow(unused)]
fn main() {
tracing_subscriber::fmt().with_max_level(tracing::Level::DEBUG).init();
}
Key log lines and what they tell you:
| Log line | Meaning |
|---|---|
input_corners=N | N ChESS corners passed the strength filter |
chessboard stage failed: ... | Grid assembly error; reason follows |
marker scan produced N detections | N cells decoded a valid marker ID |
alignment result: inliers=N | N markers matched the board spec |
cell (x,y) failed decode | That cell did not match any dictionary entry |
cell (x,y) passed threshold but no dict match | Binarization ok, wrong dictionary |
If you do not see these lines, confirm RUST_LOG=debug is set in the shell that runs
the binary, not in a parent process.
detect_chessboard reports no board
The facade detect_chessboard returns Err(DetectError::NoDetection) when
no board is found — a miss carries no specific cause, only that some stage
declined to emit a detection. To diagnose, run the chessboard crate’s serializable
topological trace, calib_targets_chessboard::trace_topological,
which is layered over the production path (so it reflects what detect()
actually does) and reports per-corner usability plus the labelled
components:
#![allow(unused)]
fn main() {
use calib_targets::detect::{default_chess_config, detect_corners, gray_view};
use calib_targets_chessboard::{trace_topological, ChessboardParams};
let img: image::GrayImage = todo!();
let corners = detect_corners(&gray_view(&img), &default_chess_config());
match trace_topological(&corners, &ChessboardParams::default()) {
Ok(trace) => {
let usable = trace.corners.iter().filter(|c| c.usable).count();
println!("corners_in: {}", trace.diagnostics.corners_in);
println!("corners_used: {usable}");
println!("components: {}", trace.final_components.len());
println!("total labels: {}", trace.diagnostics.final_labels);
}
Err(e) => println!("topological stage produced no grid: {e}"),
}
}
trace_topological(and theTopologicalTracetype) are gated behind the chessboard crate’s off-by-defaultdiagnosticsfeature. Enable it withcalib-targets-chessboard’sdiagnosticsfeature — or the facade’sdiagnosticsfeature — to call it; the hotdetect_*path builds no trace.
Checklist:
-
No ChESS corners found?
corners.is_empty()(andtrace.diagnostics.corners_in == 0). The ChESS detector saw nothing — check image resolution / contrast; overridecalib_targets::detect::default_chess_config()with a customDetectorConfigif necessary — e.g.DetectorConfig::chess().with_threshold(8.0)to drop the noise floor below the workspace default of15.0. Since chess-corners 1.0 the threshold is a plain absolute response floor (f32); theThresholdenum and its relative mode are gone — ChESS reads only an absolute floor now. -
Corners found but few
usable? The prefilter is rejecting most corners — either onstrengthor because their axes are too uncertain to vote (max(σ₀, σ₁) > axis_align_tol_rad). Lowermin_corner_strength, and check the axis clustering tolerances (cluster_tol_degdefault12.0→ try16.0;min_peak_weight_fractiondefault0.02→ try0.01). A perfectly rectilinear board with axes on the π-wrap boundary is handled by plateau-aware peak picking. -
Usable corners but no
final_components(orErr(DetectionFailed))? The topological builder assembled no quad mesh. Trydetect_chessboard_bestwithChessboardParams::sweep_default()(widens the clustering and attachment tolerances). -
Components found but
detect_chessboardstill reports no board? The final geometry check refused the detection (survivors belowmin_labeled_corners) or only tiny components survived. Try a wider config viadetect_chessboard_best; if the scene legitimately holds multiple boards, usedetect_chessboard_alland handle each component separately. -
Multiple same-board components in the scene (ChArUco markers break contiguity): this is expected. Use
detect_chessboard_all; each piece comes back with its own locally-rebased(i, j).
NoMarkers
All ChESS corners were found and the chessboard grid was assembled, but no ArUco/AprilTag marker was decoded inside any cell.
Checklist:
-
Correct dictionary? The
dictionaryfield in the board spec must match the one used when printing. A mismatch producescell (x,y) passed threshold but no dict matchin the log for every cell. -
Correct
marker_size_rel? If the sampled region is the wrong fraction of the cell, the bit cells will be misaligned. Verify against the board spec. -
Blurry or small markers? Every cell is thresholded on its own and its bits are scored softly, so there is no border or threshold knob to lower. What helps is resolution: more pixels per marker bit (move closer, or set the corner detector’s
upscalefor small cells), and a correctinset_frac. -
Uneven lighting? Per-cell thresholding already absorbs smooth gradients. Specular reflections inside a marker cannot be corrected by thresholding at all.
-
Wrong scale? If
px_per_squareis far from the actual pixel size, the projective warp used for cell sampling will produce a very small or very large patch. AdjustCharucoParams.px_per_square.
AlignmentFailed { inliers: N }
Markers were decoded, but fewer than min_marker_inliers of them matched the board
specification in a geometrically consistent way.
Checklist:
-
inliers = 0: No decoded marker ID appears in the board layout at all.- Board spec mismatch: wrong
rows,cols,dictionary, ormarker_layout. - Marker IDs may be correct but the layout offset is wrong (e.g. the board was
generated with a non-zero
first_markerid).
- Board spec mismatch: wrong
-
inlierssmall but non-zero:- Board is partially visible — lower
min_marker_inliersto the number of markers you reliably expect to see. - Strong perspective distortion — raise the chessboard-side attachment
tolerances (
attach_axis_tol_deg,edge_axis_tol_deg) so more corners enter the grid, or usedetect_charuco_bestwith a sweep.
- Board is partially visible — lower
-
inliersnear threshold:- The board is barely visible or the markers barely resolved; see the
NoMarkerschecklist above. Do not lowermin_marker_inliersbelow what the board guarantees.
- The board is barely visible or the markers barely resolved; see the
Common image problems
| Problem | Recommended fix |
|---|---|
| Strong blur | More pixels per square: move closer, or the corner detector’s upscale |
| Uneven / gradient lighting | Nothing to do — markers are thresholded per cell |
| Strong perspective / wide-angle | Raise edge_axis_tol_deg / attach_axis_tol_deg / geometry_check_local_h_tol_rel on the chessboard side |
| Partial occlusion | Use detect_chessboard_all; for ChArUco, lower min_marker_inliers |
| Multiple same-board components | detect_chessboard_all; cap via max_components |
| Very small ChArUco board in frame | Raise CharucoParams.px_per_square to match actual square size |
| Specular reflections on board | Pre-process with local contrast normalisation (CLAHE); if pre-processing is off the table, lower min_peak_weight_fraction so clustering can cope with the reduced corner count |
Grid components found but detection returns Err(NoDetection) | Use detect_chessboard_best; inspect trace_topological_detection (final_components, chessboard.final_drops) |
Getting more help
- Open an issue on GitHub
and attach the debug log (with
RUST_LOG=debug), image, and board spec. - See Tuning the Detector for full parameter reference.
- See Understanding Results for field meanings and score thresholds.