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

problem with adding pixel values of two images

Sascha
Beginner
224 Views

I have two image: the first one is a test-card picture and the second is an orange banner.

When I do ippiAdd_8u_C3IRSfs(orange_pic, test-card, ....) the orange banner is shown properly only on the black background, what I' doing wrong?
(see attached image)

0 Kudos
3 Replies
Sergey_K_Intel
Employee
224 Views

Hi Sascha,

If you want orange banner to stay orange through the whole image width, the sample image arithmetic addition may not work. Suppose, that you have banner pixels of value (0x100, 0, 0), which in RGB is half-bridht red. Adding to black pixels (0, 0, 0) is OK. Your pixels remain (0x12a, 0, 0). But, what if you add your pixels to gray (say, 0x100, 0x100, 0x100)? You'll get the banner pixels as (0x200, 0x100, 0x100), which is not quite red :).

You need to supersede background pixels with new banner values. It can be done by ippiCopy function. You just need to specify the destination address correctly.

Regards,
Sergey

0 Kudos
Sascha
Beginner
224 Views

Hi Sergey,

I understand now - thank you so much.

When I use ippiCopy function I have "black" background instead of transparent background.(the banner is a png-image with some transparent areas). What I'm doing wrong in this case?

0 Kudos
Ying_H_Intel
Employee
224 Views

Hi Sascha, 

How many channel is the banner image?  If you are using ippiCopy_C3,  As IPP function just take 3 channel R,G, B image data, don't take the transparent feature,  so you may need to consider to use ippiCopy_xx_C3AC4, which may keep the transparent feature of the banner image. 

Best Regards,

Ying 

0 Kudos
Reply