Community
cancel
Showing results for
Did you mean:
Beginner
106 Views

Summing of RGB channels into a single plane

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 ?

8 Replies
Moderator
106 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.
Innovator
106 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,
Beginner
106 Views
I will try the above solutions and see if it works.
Moderator
106 Views
it would be intersting if you compare the performance differencies of these two approaches. :).
Beginner
106 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..
Moderator
106 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.

Innovator
106 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,