computes the watershed transform of image, returning the result as an array in which positive integers label the catchment basins.

uses a binary image marker to indicate regions where basins may be created.

Details and OptionsDetails and Options

  • WatershedComponents[image] finds basins at each regional minimum in image.
  • WatershedComponents works with 2D as well as 3D images.
  • WatershedComponents works with binary, grayscale, and other images.
  • WatershedComponents[image,marker] finds basins only at the positions corresponding to foreground regions in a binary image marker.
  • The target region marker can be any of the following:
  • markerimagea marker image
    {pos1,pos2,}a list of positions
  • Positions are assumed to be in the standard image coordinate system.
  • Typically, nonzero elements of marker are treated as seeds for the segmentation.
  • In the label array returned by WatershedComponents, zeros represent positions that do not belong to any foreground component.
  • For multichannel images, WatershedComponents operates on the intensity averaged over all channels.
  • The following options can be specified:
  • CornerNeighborsAutomaticwhether to include corner neighbors
    MethodAutomaticthe method to use
  • Possible Method settings include:
  • "Watershed"morphological watershed method (Meyer) (default)
    "Basins"modified watershed algorithm (Beucher, Meyer)
    "Rainfall"gradient descent or rainfall algorithm (Osma-Ruiz)
    "Immersion"watershed immersion algorithm (VincentSoille)
    {"MinimumSaliency",t}gradient descent algorithm that merges adjacent basins if their minimum boundary height is less than t
  • The and methods return the watershed lines, represented as 0s in the label array.
  • With the method, CornerNeighbors->False is always used. All other methods by default use CornerNeighbors->True.
Introduced in 2010
| Updated in 2014