Intel® Integrated Performance Primitives (Intel® IPP) Developer Guide and Reference

ID 790148
Date 10/31/2024
Public
Document Table of Contents

SegmentGradient

Performs image segmentation by region growing to the least gradient direction.

Syntax

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

IppStatus ippiSegmentGradient_8u_C3IR(const Ipp8u* pSrc, int srcStep, Ipp8u* pMarker, int markerStep, IppiSize roiSize, IppiNorm norm, int flags, 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 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);
flags
optional flag:

IPP_SEGMENT_BORDER_4

pixels of the 4-connectivity border between image segments are marked with value (IPP_MAX_8U)-1 (254).

IPP_SEGMENT_BORDER_8

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

Description

This function operates with ROI (see Regions of Interest in Intel IPP).

This function performs image segmentation by region growing with markers. Non-zero pixels of pMarker image belong to initial image regions. Marker values propagate through the whole image in the direction of the least value of the absolute value of the image gradient. For 3-channel image the gradient is calculated as the maximum of channel gradients. Image segments are formed by groups of connected pMarker pixels with the same value. The parameter norm controls marker propagation connectivity. Gradient segmentation is generally done for an image without explicit calculation of the image gradient. [Meyer92]

If IPP_SEGMENT_BORDER flag is defined, then the pixels adjacent to differently marked pixels are assumed to be border pixels and are set to a special value (254). This value must not be used to mark segments in this case.

Another special value (255) is used inside the function and can not be used to mark segment inany case.

The function requires the working buffer pBuffer whose size should be computed by the function ippiSegmentGradientGetBufferSize beforehand.

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>.

ippStsBadArgErr

Indicates an error condition if norm has an illegal value.