pub struct ThresholdEngine {
pub tile_size: usize,
pub min_range: u8,
}Expand description
Adaptive thresholding engine using tile-based stats.
Fields§
§tile_size: usizeSize of the tiles used for local thresholding statistics.
min_range: u8Minimum intensity range for a tile to be considered valid.
Implementations§
Source§impl ThresholdEngine
impl ThresholdEngine
Sourcepub fn from_config(config: &DetectorConfig) -> Self
pub fn from_config(config: &DetectorConfig) -> Self
Create a ThresholdEngine from detector configuration.
Sourcepub fn compute_tile_stats<'a>(
&self,
arena: &'a Bump,
img: &ImageView<'_>,
) -> BumpVec<'a, TileStats>
pub fn compute_tile_stats<'a>( &self, arena: &'a Bump, img: &ImageView<'_>, ) -> BumpVec<'a, TileStats>
Compute min/max statistics for each tile in the image. Optimized with SIMD-friendly memory access patterns and subsampling (stride 2).
Sourcepub fn apply_threshold(
&self,
arena: &Bump,
img: &ImageView<'_>,
stats: &[TileStats],
output: &mut [u8],
)
pub fn apply_threshold( &self, arena: &Bump, img: &ImageView<'_>, stats: &[TileStats], output: &mut [u8], )
Apply adaptive thresholding to the image. Optimized with pre-expanded threshold maps and vectorized row processing.
Sourcepub fn apply_threshold_with_map(
&self,
arena: &Bump,
img: &ImageView<'_>,
stats: &[TileStats],
binary_output: &mut [u8],
threshold_output: &mut [u8],
)
pub fn apply_threshold_with_map( &self, arena: &Bump, img: &ImageView<'_>, stats: &[TileStats], binary_output: &mut [u8], threshold_output: &mut [u8], )
Apply adaptive thresholding and return both binary and threshold maps.
This is needed for threshold-model-aware segmentation, which uses the per-pixel threshold values to connect pixels by their deviation sign.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ThresholdEngine
impl RefUnwindSafe for ThresholdEngine
impl Send for ThresholdEngine
impl Sync for ThresholdEngine
impl Unpin for ThresholdEngine
impl UnsafeUnpin for ThresholdEngine
impl UnwindSafe for ThresholdEngine
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
Mutably borrows from an owned value. Read more
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>
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 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>
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 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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.