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.
ChessboardNotDetected
The chessboard assembly stage found fewer corners than min_corners, or could not form
a connected grid from the detected corners.
Checklist:
-
How many corners were detected? Look for
input_corners=Nin the log.- If
N < min_corners: lowermin_cornersor lowermin_corner_strength. - If
Nis zero or very small: the ChESS detector found nothing. Check image resolution —px_per_squareindefault_chess_config()should be close to the actual pixel size of one board square.
- If
-
Corners found but grid assembly fails?
- Check
max_spacing_pix: if the physical board squares are larger than this value in pixels, the graph edges are pruned and the grid cannot be assembled. - Check
min_spacing_pix: if two ChESS responses land on the same corner, they may confuse the graph. Raisemin_spacing_pix.
- Check
-
Orientation clustering failing? If the board is close to axis-aligned and the two corner directions are not well separated, try setting
use_orientation_clustering = false(synthetic / controlled images only). -
Multiple boards in the scene? Set
expected_rows/expected_colsso the detector only accepts the correct grid size.
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 image?
- Enable
multi_threshold: true(already the default for ChArUco). - Lower
min_border_scoreto0.65–0.70.
- Enable
-
Uneven lighting?
multi_thresholdhandles this automatically. If already enabled, check whether the board surface has specular reflections — these cannot be corrected by thresholding alone. -
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. Adjustpx_per_squareinChessConfig.
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 — the homography RANSAC may not converge. Raise
orientation_tolerance_degso more corners enter the initial grid.
- Board is partially visible — lower
-
inliersnear threshold:- One or two spurious decodings are pulling the fit off. Raise
min_border_scoreslightly to reject low-confidence markers.
- One or two spurious decodings are pulling the fit off. Raise
Common image problems
| Problem | Recommended fix |
|---|---|
| Strong blur | Lower min_border_score to 0.65, enable multi_threshold |
| Uneven / gradient lighting | multi_threshold (already default) |
| Strong perspective / wide-angle | Raise max_spacing_pix, raise orientation_tolerance_deg |
| Partial occlusion | Lower completeness_threshold, lower min_marker_inliers |
| Very small board in frame | Raise px_per_square to match actual pixel size |
| Very large board / high-res image | Raise max_spacing_pix to ≥ image_width / cols / 2 |
| Multiple boards in frame | Set expected_rows / expected_cols explicitly |
| Specular reflections on board | Pre-process with local contrast normalization (CLAHE) |
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.