Transforms an image to the integral representation.
IppStatus ippiIntegral_8u32s_C1R(const Ipp8u* pSrc, int srcStep, Ipp32s* pDst, int dstStep, IppiSize roiSize, Ipp32s val);
IppStatus ippiIntegral_8u32f_C1R(const Ipp8u* pSrc, int srcStep, Ipp32f* pDst, int dstStep, IppiSize roiSize, Ipp32f val);
pSrc |
Pointer to the source image ROI. |
srcStep |
Distance in bytes between starts of consecutive lines in the source image. |
pDst |
Pointer to the ROI in the destination integral image. |
dstStep |
Distance in bytes between starts of consecutive lines in the destination image. |
roiSize |
Size of source and destination image ROI in pixels. |
val |
The value to add to pDst image pixels |
The function ippiIntegral is declared in the
ippcv.h file. It operates with ROI (see Regions of
Interest in Intel IPP). This function transforms a source image pSrc to
the integral image pDst. Pixel values
of the destination image pDst are computed using
pixel values of the source image pSrc and the
specified value val in accordance with the following
formula:
where i,j are coordinates of the destination image pixels (see Figure 11-1 ) varying in the range i = 1 ,..., roiSize.height, j = 0,..., roiSize.width. Pixel values of zero row and column of pDst (i=0) is set to val.
The size of the destination images is (roiSize.width + 1) x (roiSize.height + 1).
Figure “Operation of the Integral and TiltedIntegral functions” shows what pixels (red circles) of the source image are used in computation new pixel values in the i,j coordinates.
For large images the result of summation can exceed the upper bound of the output data type. Table “Maximum Image Size for Integral Functions” lists the maximum image size for different function flavors and values. The code example below demonstrates how to use the function ippiIntegral.
ippStsNoEr |
Indicates no error. |
ippStsNullPtrErr |
Indicates an error if pSrc or pDst is NULL. |
ippStsSizeErr |
Indicates an error condition if roiSize has a field with zero or negative value. |
ippStsStepErr |
Indicates an error condition if srcStep is less than roiSize.width * <pixelSize>, or dstStep is less than (roiSize.width+1) * <pixelSize> . |
ippStsNotEvenStepErr |
Indicates an error condition if one dstStep is not divisible by 4. |
void func_inegral()
{
Ipp8u pSrc[5*4];
Ipp32s pDst[6*5];
IppiSize ROI = {5,4};
ippiSet_8u_C1R(1,pSrc,5,ROI);
Ipp32s val = 1;
ippiIntegral_8u32s_C1R(pSrc, 5, pDst, 6*4, ROI, val);
}
result:
pSrc -> 1 1 1 1 1 pDst -> 1 1 1 1 1 1
1 1 1 1 1 1 2 3 4 5 6
1 1 1 1 1 1 3 5 7 9 11
1 1 1 1 1 1 4 7 10 13 16
1 5 9 13 17 21
Copyright © 2000 - 2011, Intel Corporation. All rights reserved.