Combines two images using constant alpha values.
IppStatus ippiAlphaCompC_<mod>(const Ipp<datatype>* pSrc1, int src1Step, Ipp<datatype> alpha1, const Ipp<datatype>* pSrc2, int src2Step, Ipp<datatype> alpha2, Ipp<datatype>* pDst, int dstStep, IppiSize roiSize, IppiAlphaType alphaType);
Supported values for mod:
8u_C1R |
8u_C3R |
8u_C4R |
8u_AC4R |
16u_C1R |
16u_C3R |
16u_C4R |
16u_AC4R |
8s_C1R |
|||
16s_C1R |
|||
32u_C1R |
|||
32s_C1R |
|||
32f_C1R |
IppStatus ippiAlphaCompC_<mod>(const Ipp<datatype>* constpSrc1[4], int src1Step, Ipp<datatype> alpha1, const Ipp<datatype>* const pSrc2[4], int src2Step, Ipp<datatype> alpha2, Ipp<datatype>* const pDst[4], int dstStep, IppiSize roiSize, IppiAlphaType alphaType);
Supported values for mod:
8u_AP4R |
16u_AP4R |
pSrc1, pSrc2 |
Pointers to the source image ROI for pixel-order data. An array of pointers to ROI in the separate source color planes in case of planar data. |
src1Step, src2Step |
Distances in bytes between starts of consecutive lines in the source images. |
pDst |
Pointer to the destination image ROI for pixel-order data. An array of pointers to ROI in the separate destination color planes in case of planar data. |
dstStep |
Distance in bytes between starts of consecutive lines in the destination image. |
roiSize |
Size of the source and destination ROI in pixels. |
alpha1, alpha2 |
Constant alpha values to use for the compositing operation. |
alphaType |
The composition type to perform. See Table “Possible Values of the Parameter alphaType” for the type value and description. |
The function ippiAlphaCompC is declared in the ippi.h file. It operates with ROI (see Regions of Interest in Intel IPP).
This function performs an image compositing operation on one-channel image buffers, three-channel RGB and four-channel RGBA image buffers and on planar images, using constant alpha values alpha1 and alpha2. These values are passed to the function as parameters.
The compositing is done by overlaying pixels from the foreground image ROI pSrc1 with pixels from the background image ROI pSrc2 to produce pixels in the resultant image ROI pDst. The alpha values are normalized to the range [0..1].
The type of the compositing operation is indicated by the alphaType parameter. Use Table “Possible Values of the Parameter alphaType” to choose a valid alphaType value depending on the required composition type. For example, the resulting pixel color components for the OVER operation (see Table “Types of Image Composing Operations”) are computed as follows:
rC = α1 * rA +(1 - α1)* α2 *rB
gC = α1 * gA +(1 - α1)* α2 *gB
bC = α1 * bA +(1 - α1)* α2 *bB
where α1, α2 are the normalised alpha values alpha1, alpha2.
This function can be used for unsigned pixel data only.
Example “Using Alpha Composition Function” shows how to use alpha composition function.
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. |
IppStatus acomp( void ) { Ipp8u imga[8*8], imgb[8*8], imgc[8*8]; IppiSize roi = { 8, 8 }; IppStatus st; ippiImageRamp_8u_C1R( imga, 8, roi, 0, 1, ippAxsHorizontal ); ippiImageRamp_8u_C1R( imgb, 8, roi, 0, 2, ippAxsHorizontal ); st = ippiAlphaCompC_8u_C1R( imga, 8, 255/3, imgb, 8, 255, imgc, 8, roi, ippAlphaOver ); printf( "over: a=%d,A=255/3; b=%d,B=255; c=%d // c=a*A+b*(1-A)*B\n",imga[6],imgb[6],imgc[6] ); return st; }
Output
over: a=6,A=255/3; b=12,B=255; c=10 // c=a*A+b*B*(1-A)
Copyright © 2000 - 2011, Intel Corporation. All rights reserved.