Expand description
Core types and utilities for calibration target detection.
This crate is intentionally small and purely geometric. It does not depend on any concrete corner detector implementation or image type, but it owns the shared detector configuration contracts used across the workspace.
§Quickstart
use calib_targets_core::{LabeledCorner, TargetDetection, TargetKind};
use nalgebra::Point2;
let corner = LabeledCorner::new(Point2::new(12.0, 8.0), 0.9);
let detection = TargetDetection::new(TargetKind::Chessboard, vec![corner]);
println!("{}", detection.corners.len());§Includes
- Homography estimation and warping helpers.
- Lightweight grayscale image views and sampling.
- Grid alignment and target detection types.
Modules§
- io
- Shared JSON IO helpers for config and report types.
Structs§
- Axis
Estimate - Local estimate of one undirected grid axis at a detected corner.
- Coord
- The canonical integer grid-coordinate type
(u, v)—uis the grid’s first axis (right),vthe second (down). Re-exported fromprojective_gridso the whole workspace names a single type. Integer coordinate on a lattice. - Detector
Config - High-level detection configuration.
- Gray
Image - Owned 8-bit grayscale image.
- Gray
Image View - Borrowed view over an 8-bit grayscale image.
- Grid
Transform - An affine integer lattice-coordinate transform:
destination = matrix * source + translation. - Homography
- A 3×3 projective homography matrix.
- Homography
Quality - Numerical quality of a homography matrix.
- Labeled
Corner - A corner that is part of a detected target, with optional ID info.
- Rectified
View - A rectified (fronto-parallel) view of a detected board, plus the mapping back to the original image.
- Target
Detection - One detected target (board instance) in an image.
Enums§
- Orientation
Method - Method used to fit the two grid axes at a detected corner.
- Rect
ToImg Mapper - Mapping from rectified-image coordinates back to original-image coordinates.
- Target
Kind - The kind of target that a detection corresponds to.
Constants§
- GRID_
TRANSFORMS_ C4 - The 4 rotations
C4on the integer grid: the orientation-preserving (determinant == +1) subgroup ofGRID_TRANSFORMS_D4. - GRID_
TRANSFORMS_ D4 - The 8 dihedral transforms
D4on the integer grid.
Functions§
- axis_
estimate_ to_ next - Promote
AxisEstimateinto theprojective_gridcrate’s generic local-axis shape. - cell_
rect_ corners_ at - The four corners of a unit grid cell at
gc, in canonical rectified space, in clockwise TL, TR, BR, BL order (the workspace-wide quad/homography order). - complete_
cell_ corners - The four image corners of the unit cell whose top-left intersection is grid
(u, v), in TL, TR, BR, BL order (clockwise — the canonical quad order used for every homography fit in the workspace). ReturnsNoneif any of the cell’s four grid intersections is absent from the map. - corner_
map_ bounds - Inclusive grid-coordinate bounds
(min_u, min_v, max_u, max_v)over a corner map’s keys, orNonewhen the map is empty. - default_
chess_ config - Reasonable default settings for the
chess-cornersChESS detector. - estimate_
homography_ rect_ to_ img - Estimate H such that
p_dst ~ H * p_srcfrom N >= 4 point correspondences. - estimate_
homography_ with_ quality - Estimate H such that
p_dst ~ H * p_srcfrom N >= 4 point correspondences, returning the matrix together with itsHomographyQuality. - homography_
from_ 4pt - Compute H from exactly 4 point correspondences:
dst ~ H * src. - homography_
from_ 4pt_ with_ quality - 4-point variant of
estimate_homography_with_quality. - log_
sigmoid - Numerically stable
log(sigmoid(x)). - sample_
bilinear - Bilinearly sample a grayscale image at sub-pixel
(x, y). - sample_
bilinear_ fast - Bilinearly sample a grayscale image, skipping bounds checks on the hot path.
- sample_
bilinear_ u8 - Bilinearly sample a grayscale image and round the result to
u8. - square_
predict_ grid_ position - Predict a square-grid corner position from complete cardinal neighbor pairs.
- warp_
perspective_ gray - Warp into a rectified image: for each destination pixel center, map to
source image coordinates via
H_img_from_rectand bilinear-sample.
Type Aliases§
- Corner
Map - A grid → image corner map: integer grid intersections to their sub-pixel image positions. The shared currency of the marker / ChArUco square-cell warp paths.
- Grid
Alignment - Semantic alias for a transform that maps detected grid coordinates into a board/model coordinate frame.