Skip to main content

Detector

Struct Detector 

Source
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

Source

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.

Source

pub fn with_default() -> Self

Build a detector with the default config.

Source

pub fn config(&self) -> &DetectorConfig

Borrow the active config.

Source

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.

Source

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.

Source

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).

Source

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.

Source

pub fn diagnostics(&self) -> DetectorDiagnostics<'_>

Borrow a detector-bound diagnostics accessor.

The returned DetectorDiagnostics exposes intermediate detector outputs — the dense ChESS response map and the Radon heatmap — sourced from this detector’s already-configured DetectorConfig, so a caller holding a configured Detector need not re-supply a config to obtain diagnostic data.

This is the detector-bound half of the diagnostics channel; the free functions in crate::diagnostics serve stateless callers. Both share the same opt-in, looser-stability contract: diagnostic outputs are advisory and may change as the detector internals evolve, independently of the Detector::detect result contract.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.