DIPlib Documentation - ©1995-2017 Quantitative Imaging Group, Delft University of Technology.

Watershed

Morphological segmentation

SYNOPSIS

#include "dip_morphology.h"

dip_Error dip_Watershed ( in, mask, out, connectivity, max_depth, max_size, binaryOutput )

DATA TYPES

integer, float

FUNCTION

Watershed segmentation with built-in region merging. max_depth and max_size control the merging procedure. Any region with max_size or less pixels and with max_depth grey-value difference or less will be merged to neighbouring regions when they touch (as opposed to build a watershed). max_size equal to 0 means that the size of the region is not tested when merging. The regions are grown according to the connectivity parameter. See The connectivity parameter for more information. The output is either a labelled image where the pixels belonging to a catchment basin are labelled, or a binary image where the watershed pixels are 1 and the rest is 0. This is controlled by binaryOutput.

If mask is not 0, only the pixels within mask will be considered. All the other pixels will be marked as watershed pixels.

ARGUMENTS

Data typeNameDescription
dip_ImageinInput
dip_ImagemaskMask
dip_ImageoutOutput
dip_intconnectivityConnectivity
dip_floatmax_depthMaximum depth of a region that can be merged
dip_intmax_sizeMaximum size of a region that can be merged
dip_BooleanbinaryOutputDIP_FALSE if the output should be a labelled image

SEE ALSO

SeededWatershed, UpperEnvelope, LocalMinima, GrowRegions