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

How to extract the data of one color channel

wwang
Beginner
847 Views
I have an image buffer that has RGB data inside. I want to get only the data of one channel. It seems like the function ippiCopy_8u_C3C1R can do it, but there is no parameter the let me specify which channel to copy?
0 Kudos
2 Replies
tld
Beginner
847 Views
It seems that the ippiCopy_8u_C3C1R function copies the "first" channel in the source buffer. By offsetting the source buffer, (by 1 or 2), you can choose which channel to copy...

Copy red channel:
ippiCopy(rgb, rgbStep, singleChannel, singleChannelStep, size);

Copy green channel:
ippiCopy(rgb+1, rgbStep, singleChannel, singleChannelStep, size);

Copy blue channel:
ippiCopy(rgb+2, rgbStep, singleChannel, singleChannelStep, size);


... otherwise, you can use ippiCopy_8u_C3P3R - however, this will copy all three channels to 3 separate buffers.
0 Kudos
Vladimir_Dudnik
Employee
847 Views

absolutely correct

Thank you Thomas

0 Kudos
Reply