FUNCTION REFERENCE
watershed
Label catchment basins and watershed ridge lines.
Label catchment basins and watershed ridge lines.
Syntax
L = watershed(A, conn)Meyer priority flooding labels regional minima and expands them in increasing height order. Ridge pixels have label zero. conn is 4 or 8, default 8. L is double. Equal-height queue entries use deterministic insertion order. NaN is rejected; infinite heights are accepted.
Example
watershed(repmat([1 0 1 2 1 0 1], 5, 1), 4)Differences from MATLAB: 2-D only; plateau tie choices can differ.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.