Realm

oa::image::threshold_auto

Binary-threshold an FP32 image with a histogram-selected level. Each (batch, channel) plane is quantized into 256 uniform buckets over [0, 1]; the Otsu or Triangle method selects one threshold per plane following the OpenCV THRESH_OTSU/THRESH_TRIANGLE contracts, and pixels strictly above it produce max_value while all others produce 0.0. Returns the thresholded image together with the per-plane threshold Matrix shaped like the leading dimensions. Errors Returns an error unless the image is nonempty FP32 NCHW/CHW, max_value is finite, and all sizes fit the shader ABI.

FnRust public API

Function Documentation

pub fn threshold_auto( input: &Image, method: AutoThreshold, max_value: f32, ) -> Result<( Image, Matrix )>
Binary-threshold an FP32 image with a histogram-selected level. Each (batch, channel) plane is quantized into 256 uniform buckets over [0, 1]; the Otsu or Triangle method selects one threshold per plane following the OpenCV THRESH_OTSU/THRESH_TRIANGLE contracts, and pixels strictly above it produce max_value while all others produce 0.0. Returns the thresholded image together with the per-plane threshold Matrix shaped like the leading dimensions. Errors Returns an error unless the image is nonempty FP32 NCHW/CHW, max_value is finite, and all sizes fit the shader ABI.