calib_targets_chessboard/
lib.rs

1//! Plain chessboard detector built on top of `calib-targets-core`.
2//!
3//! ## Quickstart
4//!
5//! ```
6//! use calib_targets_chessboard::{ChessboardDetector, ChessboardParams};
7//! use calib_targets_core::Corner;
8//!
9//! let params = ChessboardParams::default();
10//! let detector = ChessboardDetector::new(params);
11//!
12//! let corners: Vec<Corner> = Vec::new();
13//! let result = detector.detect_from_corners(&corners);
14//! println!("detected: {}", result.is_some());
15//! ```
16//!
17//! New algorithm (graph-based, perspective-aware):
18//! 1. Filter strong ChESS corners.
19//! 2. Estimate two approximate global grid axes (u, v) from ChESS orientations.
20//! 3. Estimate a base spacing from nearest-neighbor distances.
21//! 4. For each corner, find up to 4 neighbors (right/left/up/down) based on:
22//!    - distance ~ base spacing,
23//!    - direction roughly along ±u or ±v (orientation-based),
24//! 5. Build an undirected 4-connected grid graph from these neighbor relations.
25//! 6. BFS each connected component, assign integer coordinates (i, j).
26//! 7. For each component, compute width×height and completeness.
27//! 8. Keep the best component that matches expected_rows/cols (up to swap) and completeness threshold.
28
29mod detector;
30mod geom;
31mod gridgraph;
32mod mesh_warp;
33mod params;
34mod rectified_view;
35
36pub use detector::{
37    ChessboardDebug, ChessboardDetectionResult, ChessboardDetector, GridGraphDebug,
38    GridGraphNeighborDebug, GridGraphNodeDebug,
39};
40pub use mesh_warp::{rectify_mesh_from_grid, MeshWarpError, RectifiedMeshView};
41pub use params::{ChessboardParams, GridGraphParams};
42pub use rectified_view::{rectify_from_chessboard_result, RectifiedBoardView, RectifyError};