Visible to Intel only — GUID: GUID-76A8DE28-D620-4B3A-881C-7CF02C2A16AD
Visible to Intel only — GUID: GUID-76A8DE28-D620-4B3A-881C-7CF02C2A16AD
FloodFill_Grad
Performs gradient flood filling of connected area on an image.
Syntax
Case 1: Operations on one-channel data
IppStatus ippiFloodFill_Grad4Con_<mod>(Ipp<DataType>* pImage, int imageStep, IppiSize roiSize, IppiPoint seed, Ipp<datatype> newVal, Ipp<datatype> minDelta, Ipp<datatype> maxDelta, IppiConnectedComp* pRegion, Ipp8u* pBuffer);
IppStatus ippiFloodFill_Grad8Con_<mod>(Ipp<DataType>* pImage, int imageStep, IppiSize roiSize, IppiPoint seed, Ipp<datatype> newVal, Ipp<datatype> minDelta, Ipp<datatype> maxDelta, IppiConnectedComp* pRegion, Ipp8u* pBuffer);
Supported values for mod:
8u_C1IR |
16u_C1IR |
32f_C1IR |
Case 2: Operations on three-channel data
IppStatus ippiFloodFill_Grad4Con_<mod>(Ipp<DataType>* pImage, int imageStep, IppiSize roiSize, IppiPoint seed, Ipp<datatype>* pNewVal, Ipp<datatype>* pMinDelta, Ipp<datatype>* pMaxDelta, IppiConnectedComp* pRegion, Ipp8u* pBuffer);
IppStatus ippiFloodFill_Grad8Con_<mod>(Ipp<DataType>* pImage, int imageStep, IppiSize roiSize, IppiPoint seed, Ipp<datatype>* pNewVal, Ipp<datatype>* pMinDelta, Ipp<datatype>* pMaxDelta, 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 (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.
- minDelta
- Minimum difference between neighbor pixels for one-channel data.
- maxDelta
- Maximum difference between neighbor pixels for one-channel data.
- newVal
- Value to fill with for one-channel data.
- pMinDelta
- Pointer to the minimum differences between neighbor pixels for three-channel images.
- pMaxDelta
- Pointer to the maximum differences between neighbor pixels for three-channel images.
- 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 in the seed pixel neighborhoods whose pixel values v satisfy the following conditions:
where v0 is the value of at least one of the current pixel neighbors, which already belongs to the refilled area, and dlw, dup are minDelta, maxDelta, respectively. Values of these pixels are set to the newVal value.
The function requires a temporary buffer whose size should be computed with the function ippiFloodFillGetSize_Grad beforehand.
The functions with the “_4con” suffixes check 4-connected neighborhood of each pixel, i.e., side neighbors. The functions with the “_8con” suffixes check 8-connected neighborhood of each pixel, i.e., 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 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 gradient flood filling of connected area
// using Intel(R) Integrated Primitives (Intel(R) IPP) functions:
// ippiFloodFillGetSize_Grad
// ippiFloodFill_Grad4Con_8u_C1IR
#include <stdio.h>
#include "ipp.h"
#define WIDTH 8 /* source image width */
#define HEIGHT 8 /* source image height */
/* 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 */
static Ipp8u pImage[WIDTH*HEIGHT] = /* Pointer to ROI of initial image */
{
0, 1, 2, 3, 4, 5, 6, 7,
0, 1, 2, 3, 4, 5, 6, 7,
0, 1, 2, 3, 4, 5, 6, 7,
0, 1, 2, 3, 4, 5, 6, 7,
0, 1, 2, 3, 4, 5, 6, 7,
0, 1, 2, 3, 4, 5, 6, 7,
0, 1, 2, 3, 4, 5, 6, 7,
0, 1, 2, 3, 4, 5, 6, 7
};
int main(void)
{
IppStatus status = ippStsNoErr;
int imageStep = WIDTH; /* Steps, in bytes, through the source images */
IppiSize roiSize = { WIDTH, HEIGHT};/* Size of source ROI in pixels */
IppiConnectedComp pRegion; /* Pointer to repainted region properties structure */
IppiPoint seedPoint = {1,0}; /* Coordinates of the seed point inside image ROI */
Ipp8u PointNewValue = 1; /* Value to fill with for one-channel data */
Ipp8u* pBuffer = NULL; /* Pointer to the work buffer */
Ipp8u minDelta=1, maxDelta=1; /* Minimum/maximum difference between neighbour pixels for one-channel data */
int bufferSize = 0;
/* Calculate size of temporary buffer for flood filling operation */
check_sts( status = ippiFloodFillGetSize_Grad(roiSize, &bufferSize) )
pBuffer = ippsMalloc_8u(bufferSize);
/* Perform gradient flood filling of 4-connected area */
check_sts( status = ippiFloodFill_Grad4Con_8u_C1IR(pImage, imageStep, roiSize, seedPoint, PointNewValue, minDelta, maxDelta, &pRegion, pBuffer) )
EXIT_MAIN
ippsFree(pBuffer);
printf("Exit status %d (%s)\n", (int)status, ippGetStatusString(status));
return (int)status;
}