Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

watershed

Watershed transformation and watershed based object detection


Description

Watershed transformation and watershed based object detection.

Usage

watershed(x, tolerance=1, ext=1)

Arguments

x

An Image object or an array.

tolerance

The minimum height of the object in the units of image intensity between its highest point (seed) and the point where it contacts another object (checked for every contact pixel). If the height is smaller than the tolerance, the object will be combined with one of its neighbors, which is the highest. Tolerance should be chosen according to the range of x. Default value is 1, which is a reasonable value if x comes from distmap.

ext

Radius of the neighborhood in pixels for the detection of neighboring objects. Higher value smoothes out small objects.

Details

The algorithm identifies and separates objects that stand out of the background (zero). It inverts the image and uses water to fill the resulting valleys (pixels with high intensity in the source image) until another object or background is met. The deepest valleys become indexed first, starting from 1.

The function bwlabel is a simpler, faster alternative to segment connected objects from binary images.

Value

An Grayscale Image object or an array, containing the labelled version of x.

Author(s)

Oleg Sklyar, osklyar@ebi.ac.uk, 2007

See Also

Examples

x = readImage(system.file('images', 'shapes.png', package='EBImage'))
  x = x[110:512,1:130]
  display(x, title='Binary')
  y = distmap(x)
  display(normalize(y), title='Distance map')
  w = watershed(y)
  display(normalize(w), title='Watershed')

EBImage

Image processing and analysis toolbox for R

v4.32.0
LGPL
Authors
Andrzej Oleś, Gregoire Pau, Mike Smith, Oleg Sklyar, Wolfgang Huber, with contributions from Joseph Barry and Philip A. Marais
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.