Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
For the latest information on Intel’s response to the Log4j/Log4Shell vulnerability, please see Intel-SA-00646
6599 Discussions

Summing of RGB channels into a single plane

sribug
Beginner
132 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
132 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
Tamer_Assad
Innovator
132 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
sribug
Beginner
132 Views
Thanks for the reply Tamer and Gennady.
I will try the above solutions and see if it works.
Gennady_F_Intel
Moderator
132 Views
it would be intersting if you compare the performance differencies of these two approaches. :).
--Gennady
sribug
Beginner
132 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..
Gennady_F_Intel
Moderator
132 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

Tamer_Assad
Innovator
132 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
sribug
Beginner
132 Views
Thanks Tamer. I used ippiCopy() and it worked fine.
Reply