pub struct Detector { /* private fields */ }Expand description
Primary detection interface.
Encapsulates board layout and detection configuration. Create once, detect on many images.
§Examples
use ringgrid::{BoardLayout, Detector};
use image::GrayImage;
use std::path::Path;
let board = BoardLayout::from_json_file(Path::new("target.json")).unwrap();
let detector = Detector::new(board);
let image = GrayImage::new(640, 480);
let result = detector.detect(&image);
println!("Found {} markers", result.detected_markers.len());Implementations§
Source§impl Detector
impl Detector
Sourcepub fn new(board: BoardLayout) -> Self
pub fn new(board: BoardLayout) -> Self
Create a detector with a board layout and default marker-scale search prior.
Sourcepub fn with_marker_scale(
board: BoardLayout,
marker_scale: MarkerScalePrior,
) -> Self
pub fn with_marker_scale( board: BoardLayout, marker_scale: MarkerScalePrior, ) -> Self
Create a detector with an explicit marker-scale prior.
Sourcepub fn with_marker_diameter_hint(
board: BoardLayout,
marker_diameter_px: f32,
) -> Self
pub fn with_marker_diameter_hint( board: BoardLayout, marker_diameter_px: f32, ) -> Self
Create a detector with a fixed marker-diameter hint.
Sourcepub fn from_target_json_file(path: &Path) -> Result<Self, Box<dyn Error>>
pub fn from_target_json_file(path: &Path) -> Result<Self, Box<dyn Error>>
Load target JSON and create a detector in one step using default marker-scale search prior.
Sourcepub fn from_target_json_file_with_scale(
path: &Path,
marker_scale: MarkerScalePrior,
) -> Result<Self, Box<dyn Error>>
pub fn from_target_json_file_with_scale( path: &Path, marker_scale: MarkerScalePrior, ) -> Result<Self, Box<dyn Error>>
Load target JSON and create a detector with explicit marker-scale prior.
Sourcepub fn from_target_json_file_with_marker_diameter(
path: &Path,
marker_diameter_px: f32,
) -> Result<Self, Box<dyn Error>>
pub fn from_target_json_file_with_marker_diameter( path: &Path, marker_diameter_px: f32, ) -> Result<Self, Box<dyn Error>>
Load target JSON and create a detector with fixed marker-diameter hint.
Sourcepub fn with_config(config: DetectConfig) -> Self
pub fn with_config(config: DetectConfig) -> Self
Create with full config control.
Sourcepub fn config(&self) -> &DetectConfig
pub fn config(&self) -> &DetectConfig
Access the current configuration.
Sourcepub fn config_mut(&mut self) -> &mut DetectConfig
pub fn config_mut(&mut self) -> &mut DetectConfig
Mutable access to configuration for post-construction tuning.
Sourcepub fn detect(&self, image: &GrayImage) -> DetectionResult
pub fn detect(&self, image: &GrayImage) -> DetectionResult
Detect markers in a grayscale image.
When config.self_undistort.enable is false, runs single-pass
detection in image coordinates.
When config.self_undistort.enable is true, runs baseline detection,
estimates a self-undistort model, and optionally runs a second seeded
pass with the estimated mapper.
Sourcepub fn detect_with_mapper(
&self,
image: &GrayImage,
mapper: &dyn PixelMapper,
) -> DetectionResult
pub fn detect_with_mapper( &self, image: &GrayImage, mapper: &dyn PixelMapper, ) -> DetectionResult
Detect with a custom pixel mapper (two-pass pipeline).
Pass-1 runs without mapper for seed generation, pass-2 runs with mapper.
Marker centers in the returned result are always image-space.
Mapper-frame centers are exposed via DetectedMarker.center_mapped.
This method always uses the provided mapper and does not run
self-undistort estimation from config.self_undistort.
Auto Trait Implementations§
impl Freeze for Detector
impl RefUnwindSafe for Detector
impl Send for Detector
impl Sync for Detector
impl Unpin for Detector
impl UnsafeUnpin for Detector
impl UnwindSafe for Detector
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.