Realm

oa::image::distance_transform

Distance transform per plane, following distanceTransform: every pixel above threshold measures the chamfer distance to the nearest background pixel. DistanceType::L1 uses a 4-neighborhood with unit weights (exact Manhattan distance); DistanceType::L2 uses an 8-neighborhood with weights 1 / sqrt(2), the classic 3x3 chamfer approximation. The F32 output carries plane x height x width distances, zero on background. propagation_passes bounds the relaxation (zero selects height + width per plane, the worst-case propagation distance). Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image and threshold is finite.

FnRust public API

Function Documentation

pub fn distance_transform( input: &Image, threshold: f32, distance: DistanceType, propagation_passes: u32 ) -> Result<Matrix>
Distance transform per plane, following distanceTransform: every pixel above threshold measures the chamfer distance to the nearest background pixel. DistanceType::L1 uses a 4-neighborhood with unit weights (exact Manhattan distance); DistanceType::L2 uses an 8-neighborhood with weights 1 / sqrt(2), the classic 3x3 chamfer approximation. The F32 output carries plane x height x width distances, zero on background. propagation_passes bounds the relaxation (zero selects height + width per plane, the worst-case propagation distance). Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image and threshold is finite.