problem with adding pixel values of two images

problem with adding pixel values of two images

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)

AttachmentSize
Downloadimage/jpeg Snapshot000004.jpg73.98 KB
4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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

Regards,
Sergey

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?

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 

Leave a Comment

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