WatershedComponents
WatershedComponents[image] computes the watershed transform of image, returning the result as an array in which positive integers label the catchment basins.
WatershedComponents[image, marker]uses a binary image marker to indicate regions where basins may be created.WatershedComponents[video, ...]computes watershed segmentation on frames of video.
Examples
img = GradientFilter[ExampleData[{"TestImage", "Mandrill"}], 2];
WatershedComponents[img] // ColorizePlease visit the official Wolfram Language Reference for more details.