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 a 893-codeword codebook, 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.
See DetectionResult::center_frame and DetectionResult::homography_frame
for the frame metadata on each result.
Modules§
- codebook
- Generated codebook for 16-sector ring markers.
- codec
- Marker ID decoding from ring sector patterns.
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
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.
- Ellipse
- Geometric ellipse parameters fitted to a ring marker boundary.
- FitMetrics
- Fit quality metrics for a detected marker.
- 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.
- 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.
- 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.
Enums§
- Circle
Refinement Method - Center-correction strategy used after local fits are accepted.
- Detection
Frame - Coordinate frame used by serialized detection outputs.
Traits§
- Pixel
Mapper - Mapping between raw image pixels and detector working-frame pixels.