Trait ThresholdApplyExt

Source
pub trait ThresholdApplyExt<T> {
    type Output;

    // Required method
    fn threshold_apply(
        &self,
        lower: f64,
        upper: f64,
    ) -> Result<Self::Output, Error>;
}
Expand description

Applies an upper and lower limit threshold on a type T.

Required Associated Types§

Source

type Output

The output is a binary image.

Required Methods§

Source

fn threshold_apply(&self, lower: f64, upper: f64) -> Result<Self::Output, Error>

Apply the threshold with the given limits.

An image is segmented into background and foreground elements, where any pixel value within the limits are considered foreground elements and any pixels with a value outside the limits are considered part of the background. The upper and lower limits are inclusive.

If only a lower limit threshold is to be applied, the f64::INFINITY value can be used for the upper limit.

§Errors

The current implementation assumes a single channel image, i.e., greyscale image. Thus, if more than one channel is present, then a ChannelDimensionMismatch error occurs.

An InvalidParameter error occurs if the lower limit is greater than the upper limit.

Implementations on Foreign Types§

Source§

impl<T, U> ThresholdApplyExt<T> for ArrayBase<U, Ix3>
where U: Data<Elem = T>, T: Copy + Clone + Ord + Num + NumAssignOps + ToPrimitive + FromPrimitive,

Source§

type Output = ArrayBase<OwnedRepr<bool>, Dim<[usize; 3]>>

Source§

fn threshold_apply(&self, lower: f64, upper: f64) -> Result<Self::Output, Error>

Implementors§

Source§

impl<T, U, C> ThresholdApplyExt<T> for ImageBase<U, C>
where U: Data<Elem = T>, Image<U, C>: Clone, T: Copy + Clone + Ord + Num + NumAssignOps + ToPrimitive + FromPrimitive + PixelBound, C: ColourModel,