SegmentWatershed

Performs watershed image segmentation using markers.

Syntax

IppStatus ippiSegmentWatershed_8u_C1IR(const Ipp8u* pSrc, int srcStep, Ipp8u* pMarker, int markerStep, IppiSize roiSize, IppiNorm norm, int flags, Ipp8u* pBuffer);

IppStatus ippiSegmentWatershed_8u16u_C1IR(const Ipp8u* pSrc, int srcStep, Ipp16u* pMarker, int markerStep, IppiSize roiSize, IppiNorm norm, int flags, Ipp8u* pBuffer);

Parameters

pSrc
Pointer to the source image ROI.
srcStep
Distance in bytes between starts 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 starts of consecutive lines in the image of markers.
roiSize
Size of the source and destination image ROI in pixels.
norm
Specifies 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];
flags
Specifies the algorithm of segmentation; it is the logical sum of two values: mandatory value, one of the following values:

IPP_SEGMENT_QUEUE

Priority queue is used to define the order of pixel processing;

IPP_SEGMENT_DISTANCE

distance transform is used for the segmentation;
and optional value, one of the following values:

IPP_SEGMENT_BORDER_4

pixels of the 4-connectivity border between image segments are marked with value IPP_MAX_8U (255);

IPP_SEGMENT_BORDER_8

pixels of the 8-connectivity border between image segments are marked with value IPP_MAX_8U (255).
pBuffer
Pointer to the working buffer.

Description

The function ippiSegmentWatershed is declared in the ippcv.h It operates with ROI (see Regions of Interest in Intel IPP).

This function performs image watershed segmentation with markers. Non-zero pixels of 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 flags specifies how watershed segmentation is performed. This parameter is a logical sum of two values.

Required value specifies algorithm of segmentation. Possible values:

IPP_SEGMENT_QUEUE

specifies the classic watershed segmentation scheme with priority queue [Vincent91].

IPP_SEGMENT_DISTANCE

specifies the watershed segmentation by calculating the topographic distance for each pixel [Lotufo00], [Meyer94].

Optional additional values of the flags: 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. Note in this case 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 whose 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.

Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.