The watershed segmentation algorithm is a region-based image segmentation
technique inspired by topography. It treats the grayscale intensity of an image
as a topographic surface, where brighter pixels represent peaks and darker pixels
represent valleys. The algorithm simulates flooding of this surface to separate
distinct regions. Steps:
Topographic Interpretation: The input image is treated as a 3D landscape,
where pixel intensity corresponds to elevation.
Flooding Process: Starting from local minima, the algorithm simulates water
flooding the surface. As the water rises, distinct regions (basins) are formed.
Watershed Lines: When two basins meet, a boundary (watershed line) is formed
to prevent merging.
Region Labeling: Each basin is assigned a unique label, producing a segmented
image where boundaries are clearly defined.
The processing mode 'vector' will output a vector file, and process the input
image piecewise. This allows performing segmentation of very large images. IN
contrast, 'raster' mode will output a labeled raster, and it cannot handle
large data. If mode is 'raster', all the 'vector_*' arguments are ignored.