Skip to main content

watershed_instance

Function watershed_instance 

Source
pub fn watershed_instance(
    gradient: &Array2<f64>,
    markers: &Array2<i32>,
) -> Result<Array2<i32>>
Expand description

Marker-controlled watershed segmentation.

Floods a gradient image starting from pre-placed markers. Each marker expands into its catchment basin. Pixels labelled 0 in markers are uninitialized and will be flooded; non-zero pixels are seeds. The returned label map uses the same non-zero label values as markers; pixels where no basin reached them retain label 0.

ยงArguments

  • gradient - Gradient magnitude image [height, width] (higher = boundary)
  • markers - Initial marker map; 0 = unlabelled, positive = seed label