pub struct DecodeConfig {
pub codebook_profile: CodebookProfile,
pub code_band_ratio: f32,
pub samples_per_sector: usize,
pub n_radial_rings: usize,
pub max_decode_dist: u8,
pub min_decode_confidence: f32,
pub min_decode_margin: u8,
pub min_decode_contrast: f32,
pub threshold_max_iters: usize,
pub threshold_convergence_eps: f32,
}Expand description
Configuration for sector decoding.
Fields§
§codebook_profile: CodebookProfileEmbedded codebook profile to match against.
Default: CodebookProfile::Base, which preserves the shipped stable
IDs 0..892. extended is explicit opt-in and expands the codebook at
the cost of a weaker minimum cyclic Hamming distance.
code_band_ratio: f32Ratio of code band center radius to outer ellipse semi-major axis.
The code band is sampled at code_band_ratio * (a, b) in the
ellipse coordinate frame.
Default: DecodeConfig::DEFAULT_CODE_BAND_RATIO.
samples_per_sector: usizeNumber of angular samples per sector.
Default: DecodeConfig::DEFAULT_SAMPLES_PER_SECTOR.
n_radial_rings: usizeNumber of radial rings to sample within the code band.
Default: DecodeConfig::DEFAULT_N_RADIAL_RINGS.
max_decode_dist: u8Maximum Hamming distance for a valid decode.
Default: DecodeConfig::DEFAULT_MAX_DECODE_DIST.
min_decode_confidence: f32Minimum confidence for a valid decode.
Default: DecodeConfig::DEFAULT_MIN_DECODE_CONFIDENCE.
min_decode_margin: u8Minimum Hamming margin (second_best_dist - best_dist) for a valid decode.
A margin of 0 means the two closest codewords are equidistant from the
observed word — genuinely ambiguous. Default rejects ties (margin = 0).
For setups without homography validation (e.g. no camera intrinsics),
setting this to the selected profile’s minimum cyclic Hamming distance
accepts only matches that are unambiguous within that profile’s distance
guarantee. For the shipped baseline profile this value is 2.
Default: DecodeConfig::DEFAULT_MIN_DECODE_MARGIN.
min_decode_contrast: f32Minimum accepted sector-intensity contrast (max - min) before decode.
Default: DecodeConfig::DEFAULT_MIN_DECODE_CONTRAST.
threshold_max_iters: usizeMaximum iterations for iterative 2-means threshold refinement.
Default: DecodeConfig::DEFAULT_THRESHOLD_MAX_ITERS.
threshold_convergence_eps: f32Convergence epsilon for iterative 2-means threshold refinement.
Stop when |new_threshold - old_threshold| <= eps.
Default: DecodeConfig::DEFAULT_THRESHOLD_CONVERGENCE_EPS.
Implementations§
Source§impl DecodeConfig
impl DecodeConfig
Sourcepub const DEFAULT_CODE_BAND_RATIO: f32 = 0.76
pub const DEFAULT_CODE_BAND_RATIO: f32 = 0.76
Default radial location of the code band as a fraction of outer radius.
Sourcepub const DEFAULT_SAMPLES_PER_SECTOR: usize = 5
pub const DEFAULT_SAMPLES_PER_SECTOR: usize = 5
Default number of angular intensity samples per bit sector.
Sourcepub const DEFAULT_N_RADIAL_RINGS: usize = 3
pub const DEFAULT_N_RADIAL_RINGS: usize = 3
Default number of concentric rings used for radial sampling.
Sourcepub const DEFAULT_MAX_DECODE_DIST: u8 = 3
pub const DEFAULT_MAX_DECODE_DIST: u8 = 3
Default maximum Hamming distance accepted by decode.
Sourcepub const DEFAULT_MIN_DECODE_CONFIDENCE: f32 = 0.3
pub const DEFAULT_MIN_DECODE_CONFIDENCE: f32 = 0.3
Minimum decode confidence with the corrected formula
clamp(1-dist/6) * clamp(margin/profile.min_cyclic_dist).
A perfect decode (dist=0, margin≥2) scores 1.0; this threshold accepts
matches down to dist=2 with margin≥1 on the shipped baseline profile.
Sourcepub const DEFAULT_MIN_DECODE_MARGIN: u8 = 1
pub const DEFAULT_MIN_DECODE_MARGIN: u8 = 1
Minimum Hamming margin required for a valid decode.
A margin of 0 means two codewords are equidistant from the observed word (genuinely ambiguous). Setting this to 1 (default) rejects such ties.
Sourcepub const DEFAULT_MIN_DECODE_CONTRAST: f32 = 0.03
pub const DEFAULT_MIN_DECODE_CONTRAST: f32 = 0.03
Default minimum sector-intensity contrast (max - min) before decode.
Sourcepub const DEFAULT_THRESHOLD_MAX_ITERS: usize = 10
pub const DEFAULT_THRESHOLD_MAX_ITERS: usize = 10
Default iteration cap for iterative 2-means threshold refinement.
Sourcepub const DEFAULT_THRESHOLD_CONVERGENCE_EPS: f32 = 1e-4
pub const DEFAULT_THRESHOLD_CONVERGENCE_EPS: f32 = 1e-4
Default convergence epsilon for iterative 2-means threshold refinement.
Trait Implementations§
Source§impl Clone for DecodeConfig
impl Clone for DecodeConfig
Source§fn clone(&self) -> DecodeConfig
fn clone(&self) -> DecodeConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DecodeConfig
impl Debug for DecodeConfig
Source§impl Default for DecodeConfig
impl Default for DecodeConfig
Source§impl<'de> Deserialize<'de> for DecodeConfigwhere
DecodeConfig: Default,
impl<'de> Deserialize<'de> for DecodeConfigwhere
DecodeConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for DecodeConfig
impl RefUnwindSafe for DecodeConfig
impl Send for DecodeConfig
impl Sync for DecodeConfig
impl Unpin for DecodeConfig
impl UnsafeUnpin for DecodeConfig
impl UnwindSafe for DecodeConfig
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().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.