average of two images

average of two images

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


4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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




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!

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

Leave a Comment

Please sign in to add a comment. Not a member? Join today