Developer Reference for Intel® Integrated Performance Primitives
Performs marker-controlled watershed segmentation of an image.
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);
ippcv.h
Headers: ippcore.h, ippvm.h, ipps.h, ippi.h
Libraries: ippcore.lib, ippvm.lib, ipps.lib, ippi.lib
ippiNormInf |
Infinity norm (8-connectivity, 3x3 rectangular mask) |
ippiNormL1 |
L1 norm (4-connectivity, 3x3 cross mask) |
ippiNormL2 |
Approximation of L2 norm (8-connectivity, 3x3 mask) [Bor86] |
ippiNormFM |
Fast marching distance [Telea04] |
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 the IPP_MAX_8U (255) value. |
IPP_SEGMENT_BORDER_8 |
Pixels of the 8-connectivity border between image segments are marked with the IPP_MAX_8U (255) value. |
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:
Mandatory values specifying the algorithm of segmentation:
IPP_SEGMENT_QUEUE |
Classic watershed segmentation scheme with the priority queue [Vincent91] |
IPP_SEGMENT_DISTANCE |
Watershed segmentation by calculating the topographic distance for each pixel [Lotufo00], [Meyer94] |
Optional additional values of the flag: IPP_SEGMENT_BORDER_4 and IPP_SEGMENT_BORDER_8 specify the border of the segments. All pixels adjacent to the differently marked pixels are considered as border pixels, and their values are set to IPP_MAX_8U (255) for 8-bit markers, or IPP_MAX_16U (65535) for 16-bit markers. In this case, the value IPP_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.
ippStsNoErr |
Indicates no error. Any other value indicates an error or a warning. |
ippStsNullPtrErr |
Indicates an error condition if one of the specified pointers is NULL. |
ippStsSizeErr |
Indicates an error condition if roiSize has a field with zero or negative value. |
ippStsStepErr |
Indicates an error condition if one of the srcStep or markerStep is less than roiSize.width * < pixelSize>. |
ippNotEvenStsStepErr |
Indicates an error condition if one of the srcStep or markerStep for 16-bit integer images is not divisible by 2. |
ippStsBadArgErr |
Indicates an error condition if norm has an illegal value. |