Note: This page has been translated by MathWorks. Please click here

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

To view all translated materals including this page, select Japan 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`

, which can have
any dimension. 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 elements of `L`

are integer values
greater than or equal to `0`

. The elements labeled `0`

do
not belong to a unique watershed region. The elements labeled `1`

belong
to the first watershed region, the elements labeled 2 belong to the
second watershed region, and so on. By default, `watershed`

uses
8-connected neighborhoods for 2-D inputs and 26-connected neighborhoods
for 3-D inputs. For higher dimensions, `watershed`

uses
the connectivity given by `conndef(ndims(A),'maximal')`

.

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`

Was this topic helpful?