Expand description
§ringgrid
Pure-Rust detector for dense coded ring calibration targets on a hex lattice.
ringgrid detects ring markers in grayscale images, decodes their 16-sector binary IDs from the shipped baseline 893-codeword profile (with an opt-in extended profile available for advanced use), fits subpixel ellipses via Fitzgibbon’s direct method with RANSAC, and estimates a board-to-image homography. No OpenCV dependency — all image processing is in Rust.
§Detection Modes
- Simple —
Detector::detect: single-pass detection in image coordinates. Use when the camera has negligible distortion. - External mapper —
Detector::detect_with_mapper: two-pass pipeline with aPixelMapper(e.g.CameraModel) for distortion-aware detection. - Self-undistort —
Detector::detectwithSelfUndistortConfig::enableset totrue: estimates a 1-parameter division-model distortion from detected markers and optionally re-runs detection with the estimated correction.
§Quick Start
use ringgrid::{BoardLayout, Detector};
use std::path::Path;
let board = BoardLayout::from_json_file(Path::new("target.json")).unwrap();
let image = image::open("photo.png").unwrap().to_luma8();
let detector = Detector::new(board);
let result = detector.detect(&image);
for marker in &result.detected_markers {
if let Some(id) = marker.id {
println!("Marker {id} at ({:.1}, {:.1})", marker.center[0], marker.center[1]);
}
}§Coordinate Frames
Marker centers (DetectedMarker::center) are always in image-pixel
coordinates, regardless of mapper usage. When a PixelMapper is active,
DetectedMarker::center_mapped provides the working-frame (undistorted)
coordinates, and the homography maps board coordinates to the working frame.
DetectedMarker::board_xy_mm provides board-space marker coordinates in
millimeters when a valid decoded ID is available on the active board.
See DetectionResult::center_frame and DetectionResult::homography_frame
for the frame metadata on each result.
Re-exports§
pub use proposal::find_ellipse_centers;pub use proposal::find_ellipse_centers_with_heatmap;pub use proposal::Proposal;pub use proposal::ProposalConfig;pub use proposal::ProposalResult;
Modules§
- proposal
- Gradient-voting radial symmetry for ellipse center detection.
Structs§
- Board
Layout - Runtime board layout used by the detector.
- Board
Marker - A single marker’s position on the calibration board.
- Camera
Intrinsics - Pinhole camera intrinsics.
- Camera
Model - Complete camera model (intrinsics + radial-tangential distortion).
- Completion
Params - Configuration for homography-guided completion: attempt local fits for missing IDs at H-projected board locations.
- Decode
Config - Configuration for sector decoding.
- Decode
Metrics - Decode quality metrics for a detected marker.
- Detect
Config - Top-level detection configuration.
- Detected
Marker - A detected marker with its refined center and optional ID.
- Detection
Result - Full detection result for a single image.
- Detector
- Primary detection interface.
- Division
Model - Single-parameter division distortion model.
- Edge
Sample Config - Configuration for radial edge sampling.
- Ellipse
- Geometric ellipse parameters fitted to a ring marker boundary.
- FitMetrics
- Fit quality metrics for a detected marker.
- IdCorrection
Config - Structural ID verification and correction using hex neighborhood consensus.
- Inner
AsOuter Recovery Config - Configuration for automatic recovery of markers where the inner edge was incorrectly fitted as the outer ellipse.
- Inner
FitConfig - Configuration for robust inner ellipse fitting from outer-fit hints.
- Marker
Scale Prior - Scale prior for marker diameter in detector working pixels.
- Marker
Spec - Marker spec in outer-normalized radius units.
- Outer
Estimation Config - Configuration for outer-radius estimation around a center prior.
- Outer
FitConfig - Configuration for robust outer ellipse fitting from sampled edge points.
- PngTarget
Options - PNG target-generation options.
- Projective
Center Params - Projective-only unbiased center recovery from inner/outer conics.
- Radial
Tangential Distortion - Brown-Conrady radial-tangential distortion coefficients.
- Ransac
Homography Config - RANSAC configuration for homography fitting.
- Ransac
Stats - RANSAC statistics for homography fitting.
- Scale
Tier - One scale band for multi-scale adaptive detection.
- Scale
Tiers - An ordered set of scale tiers for multi-scale adaptive detection.
- Seed
Proposal Params - Seed-injection controls for proposal generation.
- Self
Undistort Config - Configuration for self-undistort estimation.
- Self
Undistort Result - Result of self-undistort estimation.
- SvgTarget
Options - SVG target-generation options.
Enums§
- Board
Layout Load Error - Load-time failures for board layout JSON.
- Board
Layout Validation Error - Validation failures for a board layout specification.
- Circle
Refinement Method - Center-correction strategy used after local fits are accepted.
- Codebook
Profile - Explicit embedded codebook profile selector.
- Detection
Frame - Coordinate frame used by serialized detection outputs.
- Detection
Source - Indicates which pipeline stage produced a
DetectedMarker. - Inner
FitReason - Stable reject/failure code for inner fit.
- Inner
FitStatus - Outcome category for robust inner ellipse fitting.
- Proposal
Downscale - Controls optional image downscaling before proposal generation.
- Target
Generation Error - Target-generation failures.
Traits§
- Pixel
Mapper - Mapping between raw image pixels and detector working-frame pixels.
Functions§
- propose_
with_ heatmap_ and_ marker_ diameter - Generate pass-1 proposals with heatmap using board geometry and a fixed marker diameter hint.
- propose_
with_ heatmap_ and_ marker_ scale - Generate pass-1 proposals with heatmap using board geometry and an explicit marker-scale prior.
- propose_
with_ marker_ diameter - Generate pass-1 center proposals using board geometry and a fixed marker diameter hint.
- propose_
with_ marker_ scale - Generate pass-1 center proposals using board geometry and an explicit marker-scale prior.