# WatershedComponents

WatershedComponents[image]

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

WatershedComponents[image,marker]

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

# Details 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 multichannel images, operating on the intensity averaged over all channels.
• In the returned label array, zeros represent positions that do not belong to any foreground component.
• 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:
•  markerimage a marker image {pos1,pos2,…} a list of positions
• Positions posi are assumed to be in the standard image coordinate system.
• Typically, nonzero elements of marker are treated as seeds for the segmentation.
• The following options can be specified:
•  CornerNeighbors Automatic whether to include corner neighbors Method Automatic the 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 (Vincent–Soille) {"MinimumSaliency",t} gradient descent algorithm that merges adjacent basins if their minimum boundary height is less than t
• The "Watershed" and "Immersion" methods return the watershed lines, represented as 0s in the label array.
• With the "MinimumSaliency" method, is always used. All other methods by default use .

# Examples

open allclose all

## Basic Examples(2)

Watershed segmentation of an image with two regional minima:

 In[1]:=
 Out[1]//MatrixForm=

Visualize the segmentation:

 In[2]:=
 Out[2]=

Watershed segmentation of a 3D image:

 In[1]:=
 Out[1]=