Start » Filter Reference » Computer Vision » Image Segmentation » SegmentImage_Watersheds

SegmentImage_Watersheds


Module: FoundationBasic

Computes dark or bright watershed basins of an image.

Applications

A classic algorithm, useful for segmentation of ball-shaped objects like plant seeds, cells or fruits.
Name Type Description
Input value
inImage Image Input image
Input value
inRoi Region* Range of pixels to be processed
Input value
inMarkers RegionArray Local minima markers
Input value
inBasinsPolarity Polarity Whether to look for bright or dark basins
Output value
outBasins RegionArray

Requirements

For input inImage only pixel formats are supported: uint8.

Read more about pixel formats in Image documentation.

Description

This filter segments the image into basins based on a set of markers (inMarkers) and a flooding watersheds implementation for grayscale images.

By default a darker pixel is considered lower but that can be changes using the inBasinsPolarity parameter.

Markers have to be computed beforehand. One way to do that is to detect the ridges of the image and threshold it into a single region, Pass the resulting region into the DistanceTransform filter. Then threshold the distance image and split it into blobs.

Examples

Example image

Computed markers

Basins computed with watersheds

Errors

This filter can throw an exception to report error. Read how to deal with errors in Error Handling.

List of possible exceptions:

Error type Description
DomainError No markers present in SegmentImage_Watersheds.
DomainError Not supported inImage pixel format in SegmentImage_Watersheds. Supported formats: UInt8.

Complexity Level

This filter is available on Advanced Complexity Level.

See Also

  • ThresholdToRegion – Creates a region containing image pixels with values within the specified range.
  • DistanceTransform – Computes an image in which the pixel values denote the estimated distances to the nearest bright pixel in the input image.