Developer Reference

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

FloodFill

Performs flood filling of connected area.

Syntax

Case 1: Operations on one-channel data
IppStatus ippiFloodFill_4Con_<mod>(Ipp<datatype>*
pImage
, int
imageStep
, IppiSize
roiSize
, IppiPoint
seed
, Ipp<datatype>
newVal
, IppiConnectedComp*
pRegion
, Ipp8u*
pBuffer
);
IppStatus ippiFloodFill_8Con_<mod>(Ipp<DataType>*
pImage
, int
imageStep
, IppiSize
roiSize
, IppiPoint
seed
, Ipp<datatype>
newVal
, IppiConnectedComp*
pRegion
, Ipp8u*
pBuffer
);
Supported values for
mod
:
8u_C1IR
16u_C1IR
32s_C1IR
32f_C1IR
Case 2: Operations on three-channel data
IppStatus ippiFloodFill_4Con_<mod>(Ipp<datatype>*
pImage
, int
imageStep
, IppiSize
roiSize
, IppiPoint
seed
, Ipp<datatype>*
pNewVal
, IppiConnectedComp*
pRegion
, Ipp8u*
pBuffer
);
IppStatus ippiFloodFill_8Con_<mod>(Ipp<DataType>*
pImage
, int
imageStep
, IppiSize
roiSize
, IppiPoint
seed
, Ipp<datatype>*
pNewVal
, IppiConnectedComp*
pRegion
, Ipp8u*
pBuffer
);
Supported values for
mod
:
8u_C3IR
16u_C3IR
32f_C3IR
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
pImage
Pointer to the ROI in the source and destination image (for the in-place operation).
imageStep
Distance in bytes between starts of consecutive lines in the image buffer.
roiSize
Size of the image ROI in pixels.
seed
Initial point.
newVal
Value to fill with for one-channel data.
pNewVal
Pointer to the vector containing values to fill with for three-channel data.
pRegion
Pointer to the connected components structure that stores information about the refilled area.
pBuffer
Pointer to the temporary buffer.
Description
This function operates with ROI (see Regions of Interest in Intel IPP ).
This function performs flood filling of the group of connected pixels whose pixel values are equal to the value in the
seed
point. Values of these pixel is set to the
newVal
value.
The function requires a temporary buffer whose size should be computed with the function
ippiFloodFillGetSize
beforehand.
The functions with the “
_4con
” suffixes check 4-connected neighborhood of each pixel, that is, side neighbors. The functions with the “
_8con
” suffixes check 8-connected neighborhood of each pixel, that is, side and corner neighbors. See Figure
Pixels Connectivity Patterns”
.
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
imageStep
is less than
pRoiSize.width
*
<pixelSize>
.
ippStsNotEvenStepErr
Indicates an error condition if steps for floating-point images are not divisible by 4, or steps for 16-bit integer images are not divisible by 2.
ippStsOutOfRangeErr
Indicates an error condition if the
seed
point is out of ROI.

Example

/******************************************************************************* * Copyright 2015-2020 Intel Corporation. * * This software and the related documents are Intel copyrighted materials, and * your use of them is governed by the express license under which they were * provided to you (License). Unless the License provides otherwise, you may not * use, modify, copy, publish, distribute, disclose or transmit this software or * the related documents without Intel's prior written permission. * * This software and the related documents are provided as is, with no express * or implied warranties, other than those that are expressly stated in the * License. *******************************************************************************/ // A simple example of flood filling of connected area // using Intel(R) Integrated Primitives (Intel(R) IPP) functions: // ippiFloodFillGetSize // ippiFloodFill_4Con_32s_C1IR // ippiFloodFill_8Con_32s_C1IR #include <stdio.h> #include "ipp.h" #define WIDTH 8 /* source image width */ #define HEIGHT 8 /* source image height */ static Ipp32s pImage[WIDTH*HEIGHT] = /* Pointer to ROI of initial image */ { 0, 10, 90, 0, 0, 0, 0, 0, 0, 10, 10, 90, 0, 0, 0, 0, 0, 10, 0, 10, 0, 0, 0, 0, 0, 10, 10, 90, 0, 0, 0, 0, 0, 0, 10, 0, 0, 10, 10, 10, 0, 10, 0, 0, 0, 10, 0, 10, 0, 0, 0, 10, 0, 10, 10, 10, 0, 0, 0, 0, 10, 0, 0, 0 }; /* Next two defines are created to simplify code reading and understanding */ #define EXIT_MAIN exitLine: /* Label for Exit */ #define check_sts(st) if((st) != ippStsNoErr) goto exitLine; /* Go to Exit if Intel(R) IPP function returned status different from ippStsNoErr */ /* Results of ippMalloc() are not validated because Intel(R) IPP functions perform bad arguments check and will return an appropriate status */ int main(void) { IppStatus status = ippStsNoErr; int imageStep = WIDTH*sizeof(Ipp32s); /* Steps, in bytes, through the source images */ IppiSize roiSize = { WIDTH, HEIGHT }; /* Size of source ROI in pixels */ IppiConnectedComp pRegion = {0}; /* Pointer to repainted region properties structure */ IppiPoint seedPoint1 = {1,0},seedPoint2 = {5,4}; /* Coordinates of the seed point inside image ROI */ int Point1NewValue = 1, Point2NewValue = 2; /* Value to fill with for one-channel data */ Ipp8u* pBuffer = NULL; /* Pointer to the work buffer */ int bufferSize = 0; /* Calculate size of temporary buffer for flood filling operation */ check_sts( status = ippiFloodFillGetSize(roiSize, &bufferSize) ) pBuffer = ippsMalloc_8u(bufferSize); /* Perform flood filling of 4-connected area */ check_sts( status = ippiFloodFill_4Con_32s_C1IR(pImage, imageStep, roiSize, seedPoint1, Point1NewValue, &pRegion, pBuffer) ) /* Perform flood filling of 8-connected area */ check_sts( status = ippiFloodFill_8Con_32s_C1IR(pImage, imageStep, roiSize, seedPoint2, Point2NewValue, &pRegion, pBuffer) ) EXIT_MAIN ippsFree(pBuffer); printf("Exit status %d (%s)\n", (int)status, ippGetStatusString(status)); return (int)status; }

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