MorphReconstructDilate

Reconstructs an image by dilation.

Syntax

IppStatus ippiMorphReconstructDilate_<mod>(const Ipp<datatype>* pSrc, int srcStep, Ipp<datatype>* pSrcDst, int srcDstStep, IppiSize roiSize, Ipp8u* pBuffer, IppiNorm norm);

Supported values for mod:

8u_C1IR 16u_C1IR 32f_C1IR 64f_C1IR

Parameters

pSrc

Pointer to the source image ROI.

srcStep

Distance in bytes between starts of consecutive lines in the source image.

pSrcDst

Pointer to the descreased and reconstructed image ROI.

srcDstStep

Distance in bytes between starts of consecutive lines in the decreased and reconstructed image.

roiSize

Size of the source and destination image ROI.

norm

Type of norm to form the mask for dilation; the following values are possible:

ippiNormInf

Infinity norm (8-connectivity, 3x3 rectangular mask).

ippiNormL1

L1 norm (4-connectivity, 3x3 cross mask).

pBuffer

Pointer to the buffer.

Description

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

This function performs morphological reconstruction of the decreased source image by dilation [Vincent93]. The operation is performed in the working buffer whose size should be computed using the function MorphReconstructGetBufferSize beforehand.

This operation enables detection of the regional maximums that can be used as markers for successive watershed segmentation.

Example “Morphological Reconstruction” shows how the morphological reconstruction can be used to build markers of objects with different brightness. Some value (cap size) is subtracted from the initial image and then the subtracted image is reconstructed to the initial one. Thresholding and opening complete the building of markers.  The figure below shows the results of these operations.

Building Markers for Segmentation by the Morphological Reconstruction



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 a zero or negative value.

ippStsStepErr

Indicates an error condition if srcStep or srcDstStep is less than roiSize.width * <pixelSize>.

ippStsNotEvenStepErr

Indicates an error condition if one of the step values is not divisible by 4 for floating-point images.

ippStsBadArgErr

Indicates an error condition if norm has an illegal value.

Morphological Reconstruction

IppiMorphAdvState *state;
IppiSize roi, msize={3,3};
IppiPoint anchor={msize.width/2, msize.height/2};
Ipp8u *src, *dst, *img;
Ipp8u *buf, *mask={1,1,1,1,1,1,1,1,1};
Int step, size;

...

ippiMorphReconstructGetBufferSize_8u_C1(roi, &size);
buf = ippsMalloc(size);
ippiMorphAdvInitAlloc_8u_C1R(roi, mask, msize, anchor, &state);

ippiCopy_8u_C1R(src, step, dst, step, roi);
ippiCopy_8u_C1R(src, step, img, step, roi);
// subtract cap size
ippiSubC_8u_C1IRSfs(cap, dst, step, roi, 0);
// reconstruct image
ippiMorphReconstructDilate_8u_C1IR(src, step, dst, step, roi, buf, norm);
// get caps
ippiSub_8u_C1IRSfs(dst, step, img, step, roi, 0);
// caps to white
ippiThreshold_GTVal_8u_C1IR(img, step, roi, 0, 255);
// delete noise
ippiMorphOpenBorder_8u_C1R(img, step, dst, step, roi, 
                               ippBorderRepl, state);
// revert to get markers
ippiXorC_8u_C1IR(0xff, dst, step, roi, 0);

ippiMorphAdvFree(state);
ippsFree(buf);


Submit feedback on this help topic

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