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

average of two images

massaro
Beginner
1,754 Views

Hi all, I am trying to calculate the average of two images, is there any IPP function for this purpose?

thanks!

0 Kudos
3 Replies
Ying_H_Intel
Employee
1,754 Views

Hi Massaro,

do you mean

pDstImage = pSrcImage1* alpha + pSrcImage2*(1- alpha).  when alpha=0.5 ?

 ippiAddWeighted_32f_C1R can do this.

You may check the function list in ippi.pdf and see if there are something you needed. http://software.intel.com/en-us/articles/intel-integrated-performance-primitives-documentation

Regards,

Ying

 

0 Kudos
massaro
Beginner
1,754 Views

Hi Ying, thanks for the help. I checked the defintion for AddWeighted, but it seems that the destination can only be floating-point arrays. For image processing, I feel it makes more sense to support an output type of 8u. I am not sure the cost of converting FP data to integer type for a large data array. Currently, I found an alternative ippsInterpolateC_NR_16s(). Luckily, the two images I need to average  are 16-bits. 

Anyway, thanks again for the help!

0 Kudos
Igor_A_Intel
Employee
1,754 Views

For 8u images the most simplest way is to use

 IPPAPI(IppStatus, ippiAdd_8u_C1RSfs,   (const Ipp8u* pSrc1, int src1Step, const Ipp8u* pSrc2,
                                        int src2Step, Ipp8u* pDst, int dstStep, IppiSize roiSize,
                                        int scaleFactor))

with scaleFactor == 1 (note - saturation is performed after applying scale factor - so result will be correct)

regards, Igor

0 Kudos
Reply