Skip to main content

Watershed

Separates and identifies distinct regions or objects within an image through gradient information and marker-based segmentation.

🖼️ Image options and parameters of waterShed function

Watershed filter is a way of identifying objects by finding image's extreme points (minima or maxima) in terms of intensity and filling these spaces with color (label). The process reminds geological watershed, which is the origin of algorithm's name. In order for the "water" not to go overboard and stay within the limits of the region, these limits must be set.

There are two ways to do so. One way is to limit the intensity by threshold value. Another way is to apply a mask which can set the area where watershed will be implemented.

The watershed algorithm is particularly useful for segmenting objects in images, especially when objects are close to each other.

caution

If you look for bright-colored ROIs, then either look for maximum points or invert image before applying watershed.

Input image with given minimaWhat watershed finds
Image InputImage Output

Kinds of images compatible with algorithm

Image propertyWhat it meansPossible values
bitDepthnumber of bits per channel[8,16]
componentsnumber of components[1]
alphais alpha channel allowedfalse

Parameters and default values

  • image

  • options

Options

PropertyRequiredDefault value
maskno-
pointsnominimum points from getExtrema() function
thresholdno1