SegmentWatershed
Performs marker-controlled watershed segmentation of an image.
Syntax
IppStatus ippiSegmentWatershed_8u_C1IR(const Ipp8u*
pSrc
, int
srcStep
, Ipp8u*
pMarker
, int
markerStep
, IppiSize
roiSize
, IppiNorm
norm
, int
flag
, Ipp8u*
pBuffer
);
IppStatus ippiSegmentWatershed_8u16u_C1IR(const Ipp8u*
pSrc
, int
srcStep
, Ipp16u*
pMarker
, int
markerStep
, IppiSize
roiSize
, IppiNorm
norm
, int
flag
, Ipp8u*
pBuffer
);
IppStatus ippiSegmentWatershed_32f16u_C1IR(const Ipp32f*
pSrc
, int
srcStep
, Ipp16u*
pMarker
, int
markerStep
, IppiSize
roiSize
, IppiNorm
norm
, int
flag
, Ipp8u*
pBuffer
);
Include Files
ippcv.h
Domain Dependencies
Headers:
ippcore.h
,
ippvm.h
,
ipps.h
,
ippi.h
Libraries:
ippcore.lib
,
ippvm.lib
,
ipps.lib
,
ippi.lib
Parameters
- pSrc
- Pointer to the source image ROI.
- srcStep
- Distance, in bytes, between the starting points of consecutive lines in the source image.
- pMarker
- Pointer to the ROI of the source and destination image of markers.
- markerStep
- Distance, in bytes, between the starting points of consecutive lines in the image with markers.
- roiSize
- Size of the source and destination image ROI, in pixels.
- norm
- flag
- Specifies the algorithm of segmentation. The value is a logical sum of the following mandatory values:
- IPP_SEGMENT_QUEUE
- Priority queue is used to define the order of pixel processing.
- IPP_SEGMENT_DISTANCE
- Distance transform algorithm is used for segmentation.
- IPP_SEGMENT_BORDER_4
- Pixels of the 4-connectivity border between image segments are marked with theIPP_MAX_8U(255) value.
- IPP_SEGMENT_BORDER_8
- Pixels of the 8-connectivity border between image segments are marked with theIPP_MAX_8U(255) value.
- pBuffer
- Pointer to the working buffer.
Description
This function operates with ROI (see Regions of Interest in Intel IPP).
This function performs marker-controlled watershed segmentation of the source image. Non-zero pixels of the
pMarker
image belong to water source markers. Marker values propagate through the whole image according to the watershed algorithm. Image segments are formed by groups of connected pMarker
pixels with the same value. The parameter norm
controls marker propagation connectivity. Watershed segmentation is preferable for images with local minimums, for example, gradient images. Image markers generally correspond to these local minimums and can be created, for example, manually or using morphological reconstruction.The parameter
flag
specifies how watershed segmentation is performed. This parameter is a logical sum of two values among the following supported values:- Optional additional values of theflag:IPP_SEGMENT_BORDER_4andIPP_SEGMENT_BORDER_8specify the border of the segments. All pixels adjacent to the differently marked pixels are considered as border pixels, and their values are set toIPP_MAX_8U(255) for 8-bit markers, orIPP_MAX_16U(65535) for 16-bit markers. In this case, the valueIPP_MAX_8U(IPP_MAX_16U) should not be used to mark segments. If these optional values are not specified, segments are formed without borders.
The function requires the working buffer
pBuffer
, which size should be computed by the function ippiSegmentWatershedGetBufferSize
beforehand.Figure
“Watershed Segmentation with Different Norms”
shows the plateau filling through the watershed segmentation with different values of the norm
parameters. Initial image (a) has the labeled with markers upper and lower fourths with low pixel value, the central plateau between them, the ridge between the plateau and the lower forth with one pixel hole in the center of it. The following pictures are segmentation results: b) - for L1 norm (block distance), c)- Linf norm (chessboard distance), d) - approximate L2 (Euclidian) norm [Bor86], e) Fast Marching distance. Watershed Segmentation with Different Norms

Return Values
- ippStsNoErr
- Indicates no error. Any other value indicates an error or a warning.
- ippStsNullPtrErr
- Indicates an error condition if one of the specified pointers isNULL.
- ippStsSizeErr
- Indicates an error condition ifroiSizehas a field with zero or negative value.
- ippStsStepErr
- Indicates an error condition if one of thesrcStepormarkerStepis less thanroiSize.width* <pixelSize>.
- ippNotEvenStsStepErr
- Indicates an error condition if one of thesrcStepormarkerStepfor 16-bit integer images is not divisible by 2.
- ippStsBadArgErr
- Indicates an error condition ifnormhas an illegal value.