Realm

oa::image::find_contours

External contour extraction per plane, following findContours with RETR_EXTERNAL semantics: foreground pixels above threshold are labeled as connected components under the selected connectivity, each component’s minimum-index boundary pixel seeds a Moore-neighbor trace that emits an ordered (x, y) point list. Returns an F32 [planes, max_contours, max_points, 2] point matrix and a U32 [planes, max_contours] length matrix; unused slots stay zero. max_points bounds each contour (zero selects 4 * (height + width); longer contours truncate), and max_contours bounds the per-plane contour count. propagation_passes bounds component labeling (zero selects height + width). Contour order and slot assignment are unspecified across planes. Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image, threshold is finite, and max_contours is nonzero.

FnRust public API

Function Documentation

pub fn find_contours( input: &Image, threshold: f32, connectivity: Connectivity, max_contours: u32, max_points: u32, propagation_passes: u32, ) -> Result<( Matrix, Matrix )>
External contour extraction per plane, following findContours with RETR_EXTERNAL semantics: foreground pixels above threshold are labeled as connected components under the selected connectivity, each component’s minimum-index boundary pixel seeds a Moore-neighbor trace that emits an ordered (x, y) point list. Returns an F32 [planes, max_contours, max_points, 2] point matrix and a U32 [planes, max_contours] length matrix; unused slots stay zero. max_points bounds each contour (zero selects 4 * (height + width); longer contours truncate), and max_contours bounds the per-plane contour count. propagation_passes bounds component labeling (zero selects height + width). Contour order and slot assignment are unspecified across planes. Errors Returns an error unless the image is a nonempty FP32 NCHW/CHW image, threshold is finite, and max_contours is nonzero.