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

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 can be used to segment contiguous regions of interest into distinct objects.

`L = watershed(A)`

`L = watershed(A,conn)`

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`

.To prevent oversegmentation, remove shallow minima from the image by using the

`imhmin`

function before you use the`watershed`

function.

`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`

| `imhmin`

| `regionprops`