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

Summing of RGB channels into a single plane

sribug
Beginner
697 Views

Hi
I am new to ipp, I am trying to add the RGB values of a planar color image to a single plane.
ie I have a 3 plane color image with R0,R1, R2... G0,G1,G2,... B0,B1,B2,...
now I need to sum these color maps so that i get R0+G0+B0, R1+G1+B1, R2+G2+B2,.....
Is there any Ipp function for the same ?

Thanks in Advance

0 Kudos
8 Replies
Gennady_F_Intel
Moderator
697 Views
Hi,
there is no separate function to do what you need in one call, but you can try to use arithmetic functions like ippsAdd_8u16u to do that.
--Gennady
0 Kudos
Tamer_Assad
Innovator
697 Views
Hi Sribug,

You may utilize IPP by converting indirect, using YUV422 as an intermediate common format for IPP.

first: convert your planar RGB into YUV422 using (ippiRGBToYUV422_8u_P3)
then: convert the resulted YUV422 plans into your target packed RGB using (ippiYUV422ToRGB_8u_P3C3)

refer to Image and Video Processing manual, I hope this works for you.

Regards,
Tamer Assad
0 Kudos
sribug
Beginner
697 Views
Thanks for the reply Tamer and Gennady.
I will try the above solutions and see if it works.
0 Kudos
Gennady_F_Intel
Moderator
697 Views
it would be intersting if you compare the performance differencies of these two approaches. :).
--Gennady
0 Kudos
sribug
Beginner
697 Views
Sure that can be done!
Can I use the function ippiSumWindowColumn by any chance for the same purpose for summing up the RGB values from the 3 channels?
Not sure how this functionality works..
0 Kudos
Gennady_F_Intel
Moderator
697 Views
I am not sure, but it seems to me it would be much more slower. Moreover, look at this function API , the destination image datatypes is Ipp32f* pDst, but based on your original description you need 16u.
--Gennady

0 Kudos
Tamer_Assad
Innovator
697 Views

Hi Sribug,

Converting your planar RGB into packed RGB is a sort operation applied on the indexes.

Assuming that your source planar RGB is: {R0, R1, G0, G1, B0, B1}

The target Packed RGB should be: {R0, G0, B0, R1, G1, B1}

IPP doesnt have a function name for this conversion; Fortunately, ippiCopy() can do it for you directly.

See IPP manual, Image and Video Processing-> Image Data Exchange and Initialization Functions-> Copy()

You just need to utilize Case 7: Composing color image from separate planes


Regards,
Tamer Assad
0 Kudos
sribug
Beginner
697 Views
Thanks Tamer. I used ippiCopy() and it worked fine.
0 Kudos
Reply