Skip to main content

dilate

Function dilate 

Source
pub fn dilate(mask: &[bool], width: u32, height: u32, radius: u32) -> Vec<bool>
Expand description

Morphological dilation of a boolean mask.

Expands true pixels by radius in all directions using separable box dilation (horizontal pass then vertical pass). O(n) per pass regardless of radius.

The dilated mask is used for clustering only — original mask is preserved for accurate pixel statistics.