Realm

oa::image::pyr_mean_shift_filtering

Pyramid mean-shift edge-preserving smoothing, following cv::pyrMeanShiftFiltering. The image is downsampled max_level times with pyr_down; each level then runs a per-pixel mean-shift pass that, for up to five iterations, averages the (2*sp+1)^2 window samples whose channel-vector distance stays below sr and adopts that mean position and color, converging when the spatial shift drops under one pixel. Coarse-to-fine levels seed their starting color from the parent’s converged result. Channels participate as one color vector per plane pixel; returns an image with identical shape, layout, and format. Errors Returns an error unless input is a nonempty FP32 NCHW/CHW image with at most 4 channels, sp/sr are finite and positive, max_level is in [1, 4], and the coarsest level still fits the spatial window support.

FnRust public API

Function Documentation

pub fn pyr_mean_shift_filtering( input: &Image, sp: f32, sr: f32, max_level: u32 ) -> Result<Image>
Pyramid mean-shift edge-preserving smoothing, following cv::pyrMeanShiftFiltering. The image is downsampled max_level times with pyr_down; each level then runs a per-pixel mean-shift pass that, for up to five iterations, averages the (2*sp+1)^2 window samples whose channel-vector distance stays below sr and adopts that mean position and color, converging when the spatial shift drops under one pixel. Coarse-to-fine levels seed their starting color from the parent’s converged result. Channels participate as one color vector per plane pixel; returns an image with identical shape, layout, and format. Errors Returns an error unless input is a nonempty FP32 NCHW/CHW image with at most 4 channels, sp/sr are finite and positive, max_level is in [1, 4], and the coarsest level still fits the spatial window support.