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§
Required Methods§
Sourcefn threshold_apply(&self, lower: f64, upper: f64) -> Result<Self::Output, Error>
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.