Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Watershed transform

`L = watershed(A)`

`L = watershed(A,conn)`

returns a
label matrix `L`

= watershed(`A`

)`L`

that identifies the watershed regions of the
input matrix `A`

. The watershed transform finds "catchment
basins" or "watershed ridge lines" in an image by treating it as a surface where
light pixels represent high elevations and dark pixels represent low
elevations.

The watershed transform algorithm used by this function changed in version 5.4 (R2007a) of the Image Processing Toolbox™ software. The previous algorithm occasionally produced labeled watershed basins that were not contiguous. If you need to obtain the same results as the previous algorithm, use the function

`watershed_old`

.

`watershed`

uses the Fernand Meyer algorithm [1].

[1] Meyer, Fernand, "Topographic distance
and watershed lines,” *Signal Processing *,
Vol. 38, July 1994, pp. 113-125.

`bwdist`

| `bwlabel`

| `bwlabeln`

| `regionprops`