Developer Reference

  • 2020
  • 07/15/2020
  • Public Content
Contents

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
Specifies the type of the norm to form the mask for marker propagation:
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]
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.
and the following optional values:
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.
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:
  • 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.
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 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.

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804