Skip to main content

remove_small_objects

Function remove_small_objects 

Source
pub fn remove_small_objects(
    input: &Tensor,
    min_size: usize,
) -> Result<Tensor, ImgProcError>
Expand description

Remove small connected components below a size threshold. Removes connected components with area less than min_size.

Takes a single-channel [H, W, 1] binary image. Pixels > 0.5 are foreground. Connected components (4-connected) with fewer than min_size foreground pixels are set to 0.0.