pub struct Detector { /* private fields */ }Expand description
High-level chessboard-corner detector.
Owns the pyramid and detector-specific scratch buffers so the caller can reuse them across successive frames.
Implementations§
Source§impl Detector
impl Detector
Sourcepub fn new(cfg: DetectorConfig) -> Result<Self, ChessError>
pub fn new(cfg: DetectorConfig) -> Result<Self, ChessError>
Build a detector with the given config.
§Errors
Returns ChessError::Upscale when the DetectorConfig::upscale
configuration is invalid.
Sourcepub fn with_default() -> Self
pub fn with_default() -> Self
Build a detector with the default config.
Sourcepub fn config(&self) -> &DetectorConfig
pub fn config(&self) -> &DetectorConfig
Borrow the active config.
Sourcepub fn set_config(&mut self, cfg: DetectorConfig) -> Result<(), ChessError>
pub fn set_config(&mut self, cfg: DetectorConfig) -> Result<(), ChessError>
Replace the active config.
§Errors
Returns ChessError::Upscale when the new config’s upscale
section is invalid.
Sourcepub fn config_mut(&mut self) -> &mut DetectorConfig
pub fn config_mut(&mut self) -> &mut DetectorConfig
Mutable access to the active config for ad-hoc tweaks. The
caller is responsible for keeping the config valid; callers
that change DetectorConfig::upscale should use
Self::set_config instead so the upscale invariants are
re-validated.
Sourcepub fn detect_u8(
&mut self,
img: &[u8],
width: u32,
height: u32,
) -> Result<Vec<CornerDescriptor>, ChessError>
pub fn detect_u8( &mut self, img: &[u8], width: u32, height: u32, ) -> Result<Vec<CornerDescriptor>, ChessError>
Detect chessboard corners from a raw 8-bit grayscale buffer.
§Errors
Returns ChessError::DimensionMismatch if img.len() != width * height. Returns ChessError::Upscale if the upscale
configuration becomes invalid (this should not normally
happen — Detector::new / Detector::set_config validate
up-front).
Sourcepub fn detect(
&mut self,
img: &GrayImage,
) -> Result<Vec<CornerDescriptor>, ChessError>
pub fn detect( &mut self, img: &GrayImage, ) -> Result<Vec<CornerDescriptor>, ChessError>
Detect chessboard corners from an [image::GrayImage].
§Errors
Returns ChessError::Upscale if the upscale configuration
becomes invalid.
Sourcepub fn detect_view(&mut self, view: ImageView<'_>) -> Vec<CornerDescriptor>
pub fn detect_view(&mut self, view: ImageView<'_>) -> Vec<CornerDescriptor>
Detect chessboard corners from a borrowed ImageView.
Lower-level than Self::detect_u8 / Self::detect:
upscaling is not applied here. Use this when you have a
pre-upscaled image or you don’t want the upscale pipeline at
all.
Sourcepub fn radon_heatmap_u8(
&mut self,
img: &[u8],
width: u32,
height: u32,
) -> Result<ResponseMap, ChessError>
pub fn radon_heatmap_u8( &mut self, img: &[u8], width: u32, height: u32, ) -> Result<ResponseMap, ChessError>
Compute the dense Radon response map for img at working
resolution. Convenience wrapper for visualisation; the detector
itself uses the response internally and never returns it.
§Errors
Returns ChessError::DimensionMismatch if img.len() != width * height. Returns ChessError::Upscale if the upscale
configuration is invalid.
Sourcepub fn radon_heatmap(
&mut self,
img: &GrayImage,
) -> Result<ResponseMap, ChessError>
pub fn radon_heatmap( &mut self, img: &GrayImage, ) -> Result<ResponseMap, ChessError>
Compute the dense Radon response map from an
[image::GrayImage]. See Self::radon_heatmap_u8.
§Errors
Inherits the error contract of Self::radon_heatmap_u8.
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more