Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6704 Discussions

AddWeighted using a "third image" pixel weights

andrewk88
Beginner
322 Views
Hi,
I'm looking for an IPP optimized mutation of the AddWeighted operation in which constant value weight would be replaced by the 0/1 pixel weights coming fromthe "third image" as follows:
image[x,y] = image3[x,y]*image1[x,y] + (1-image3)*image2
assuming that "non-zero" value of compare operation below = 1???
image3[x,y] = ippiCompareEqualEps (image1[x,y], image2[x,y]);
Best regards,
AndrewK
0 Kudos
1 Reply
Vladimir_Dudnik
Employee
322 Views
Hi,

This function exists in ippCV:

/* ///////////////////////////////////////////////////////////////////////////////////////
// Name: ippiAddWeighted_8u32f_C1IR, ippiAddWeighted_8s32f_C1IR,
// ippiAddWeighted_16u32f_C1IR, ippiAddWeighted_32f_C1IR,
// ippiAddWeighted_8u32f_C1IMR, ippiAddWeighted_8s32f_C1IMR,
// ippiAddWeighted_16u32f_C1IMR,ippiAddWeighted_32f_C1IMR
//
// Purpose: Add image, multiplied by alpha, to accumulator, multiplied by (1 - alpha).
//
// Return:
// ippStsNoErr Ok
// ippStsNullPtrErr One of pointers is NULL
// ippStsSizeErr The width or height of images is less or equal zero
// ippStsStepErr Step is too small to fit image.
// ippStsNotEvenStepErr Step is not multiple of element.
//
// Arguments:
// pSrc1 Pointer to first source image
// src1Step Wtep in the first source image
// pSrc2 Pointer to second source image
// src2Step Wtep in the second source image
// pMask Pointer to mask
// maskStep Wtep in the mask image
// pSrcDst Pointer to accumulator image
// srcDstStep Wtep in the accumulator image
// roiSize Image size
// alpha Weight of source image
*/

Or something look like this:

/* /////////////////////////////////////////////////////////////////////////////
// Alpha Compositing Operations
///////////////////////////////////////////////////////////////////////////// */

// Types of compositing operation (alphaType)
// OVER ippAlphaOver ippAlphaOverPremul
// IN ippAlphaIn ippAlphaInPremul
// OUT ippAlphaOut ippAlphaOutPremul
// ATOP ippAlphaATop ippAlphaATopPremul
// XOR ippAlphaXor ippAlphaXorPremul
// PLUS ippAlphaPlus ippAlphaPlusPremul
//
// Type result pixel result pixel (Premul) result alpha
// OVER aA*A+(1-aA)*aB*B A+(1-aA)*B aA+(1-aA)*aB
// IN aA*A*aB A*aB aA*aB
// OUT aA*A*(1-aB) A*(1-aB) aA*(1-aB)
// ATOP aA*A*aB+(1-aA)*aB*B A*aB+(1-aA)*B aA*aB+(1-aA)*aB
// XOR aA*A*(1-aB)+(1-aA)*aB*B A*(1-aB)+(1-aA)*B aA*(1-aB)+(1-aA)*aB
// PLUS aA*A+aB*B A+B aA+aB

Regards,
Vladimir

0 Kudos
Reply