Skip to main content

calib_targets_core/
lib.rs

1//! Core types and utilities for calibration target detection.
2//!
3//! This crate is intentionally small and purely geometric. It does *not*
4//! depend on any concrete corner detector implementation or image type, but it
5//! owns the shared detector configuration contracts used across the workspace.
6//!
7//! ## Quickstart
8//!
9//! ```
10//! use calib_targets_core::{LabeledCorner, TargetDetection, TargetKind};
11//! use nalgebra::Point2;
12//!
13//! let corner = LabeledCorner::new(Point2::new(12.0, 8.0), 0.9);
14//! let detection = TargetDetection::new(TargetKind::Chessboard, vec![corner]);
15//!
16//! println!("{}", detection.corners.len());
17//! ```
18//!
19//! ## Includes
20//!
21//! - Homography estimation and warping helpers.
22//! - Lightweight grayscale image views and sampling.
23//! - Grid alignment and target detection types.
24#![deny(missing_docs)]
25
26mod bit_likelihood;
27mod chess;
28mod corner;
29mod corner_map;
30mod grid_alignment;
31mod grid_smoothness;
32mod homography;
33mod image;
34pub mod io;
35mod rectify;
36
37pub use bit_likelihood::log_sigmoid;
38pub use grid_smoothness::square_predict_grid_position;
39pub use homography::{
40    estimate_homography_rect_to_img, estimate_homography_with_quality, homography_from_4pt,
41    homography_from_4pt_with_quality, warp_perspective_gray, Homography, HomographyQuality,
42};
43pub use image::{
44    sample_bilinear, sample_bilinear_fast, sample_bilinear_u8, GrayImage, GrayImageView,
45};
46pub use rectify::{RectToImgMapper, RectifiedView};
47
48// Only the two `chess-corners` types the workspace's own public API
49// legitimately exposes are re-exported: `DetectorConfig` is the ChESS config
50// object a consumer constructs, `OrientationMethod` is the documented
51// orientation knob. Advanced ChESS tuning types are imported from the
52// `chess-corners` crate directly, where they belong — re-exporting the whole
53// upstream surface would freeze it into this crate's semver contract.
54pub use chess::{default_chess_config, DetectorConfig, OrientationMethod};
55pub use corner::{axis_estimate_to_next, AxisEstimate, LabeledCorner, TargetDetection, TargetKind};
56pub use corner_map::{complete_cell_corners, corner_map_bounds, CornerMap};
57pub use grid_alignment::{
58    cell_rect_corners_at, GridAlignment, GridTransform, GRID_TRANSFORMS_C4, GRID_TRANSFORMS_D4,
59};
60
61/// The canonical integer grid-coordinate type `(u, v)` — `u` is the grid's
62/// first axis (right), `v` the second (down). Re-exported from
63/// [`projective_grid`] so the whole workspace names a single type.
64pub use projective_grid::Coord;