DIPlib Documentation - ©1995-2005 Pattern Recognition 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 )

DATATYPES

integer, float

FUNCTION

Watershed segmention with built-in region merging. max_depth and max_size control the merging procedure. Any region smaller than max_size and less deep than max_depth will be merged to neighbouring regions when they touch (as opposed to build a watershed). 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

UpperEnvelope, LocalMinima, GrowRegions

DIPlib on-line documentation | Function reference | Global function index