pub struct ThresholdAlgorithm { /* private fields */ }Expand description
Threshold-based glint detection algorithm
This algorithm identifies glint pixels by applying threshold values to each band of the image. A pixel is marked as glint if any band exceeds its corresponding threshold value.
The algorithm uses a disjunctive approach: if any band at a pixel location exceeds its threshold, that pixel is marked as glint.
Implementations§
Source§impl ThresholdAlgorithm
impl ThresholdAlgorithm
Sourcepub fn new(thresholds: Vec<f64>) -> Result<Self>
pub fn new(thresholds: Vec<f64>) -> Result<Self>
Create a new threshold algorithm with the given threshold values
§Arguments
thresholds- Threshold values for each band, must be in range [0.0, 1.0]
§Example
use glint_mask_tools::algorithms::ThresholdAlgorithm;
// RGB thresholds: stricter for blue (glint often appears in blue),
// less strict for red and green
let algorithm = ThresholdAlgorithm::new(vec![0.9, 0.8, 0.7])?;Sourcepub fn uniform(threshold: f64, band_count: usize) -> Result<Self>
pub fn uniform(threshold: f64, band_count: usize) -> Result<Self>
Create a threshold algorithm with uniform thresholds for all bands
§Arguments
threshold- Single threshold value to use for all bandsband_count- Number of bands to create thresholds for
Sourcepub fn thresholds(&self) -> &[f64]
pub fn thresholds(&self) -> &[f64]
Get the threshold values
Sourcepub fn band_count(&self) -> usize
pub fn band_count(&self) -> usize
Get the number of bands this algorithm expects
Trait Implementations§
Source§impl Clone for ThresholdAlgorithm
impl Clone for ThresholdAlgorithm
Source§fn clone(&self) -> ThresholdAlgorithm
fn clone(&self) -> ThresholdAlgorithm
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ThresholdAlgorithm
impl Debug for ThresholdAlgorithm
Source§impl GlintAlgorithm for ThresholdAlgorithm
impl GlintAlgorithm for ThresholdAlgorithm
Source§fn detect_glint(&self, image: &Array3<f64>) -> Result<Array2<u8>>
fn detect_glint(&self, image: &Array3<f64>) -> Result<Array2<u8>>
Apply the glint detection algorithm to an image Read more
Source§fn description(&self) -> &'static str
fn description(&self) -> &'static str
Get a description of this algorithm
Source§fn validate_parameters(&self) -> Result<()>
fn validate_parameters(&self) -> Result<()>
Validate that the algorithm parameters are valid
Source§fn required_bands(&self) -> Option<usize>
fn required_bands(&self) -> Option<usize>
Get the required number of bands for this algorithm Read more
Source§fn supports_bands(&self, band_count: usize) -> bool
fn supports_bands(&self, band_count: usize) -> bool
Check if this algorithm supports the given band configuration
Auto Trait Implementations§
impl Freeze for ThresholdAlgorithm
impl RefUnwindSafe for ThresholdAlgorithm
impl Send for ThresholdAlgorithm
impl Sync for ThresholdAlgorithm
impl Unpin for ThresholdAlgorithm
impl UnsafeUnpin for ThresholdAlgorithm
impl UnwindSafe for ThresholdAlgorithm
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> 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> ⓘ
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 more