calib_targets_chessboard/
params.rs

1use calib_targets_core::OrientationClusteringParams;
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, Deserialize, Serialize)]
5pub struct GridGraphParams {
6    pub min_spacing_pix: f32,
7    pub max_spacing_pix: f32,
8    pub k_neighbors: usize,
9    pub orientation_tolerance_deg: f32,
10}
11
12impl Default for GridGraphParams {
13    fn default() -> Self {
14        Self {
15            min_spacing_pix: 5.0,
16            max_spacing_pix: 50.0,
17            k_neighbors: 8,
18            orientation_tolerance_deg: 22.5,
19        }
20    }
21}
22
23/// Parameters specific to the chessboard detector.
24#[derive(Clone, Debug, Deserialize, Serialize)]
25pub struct ChessboardParams {
26    /// Minimal corner strength to consider.
27    pub min_corner_strength: f32,
28
29    /// Minimal number of corners in a detection to be considered valid.
30    pub min_corners: usize,
31
32    /// Expected number of *inner* corners in vertical direction (rows).
33    pub expected_rows: Option<u32>,
34
35    /// Expected number of *inner* corners in horizontal direction (cols).
36    pub expected_cols: Option<u32>,
37
38    /// Minimal completeness ratio (#detected corners / full grid size)
39    /// when expected_rows/cols are provided.
40    pub completeness_threshold: f32,
41
42    pub use_orientation_clustering: bool,
43    pub orientation_clustering_params: OrientationClusteringParams,
44}
45
46impl Default for ChessboardParams {
47    fn default() -> Self {
48        Self {
49            min_corner_strength: 0.0,
50            min_corners: 16,
51            expected_rows: None,
52            expected_cols: None,
53            completeness_threshold: 0.7,
54            use_orientation_clustering: true,
55            orientation_clustering_params: OrientationClusteringParams::default(),
56        }
57    }
58}