开发者

Image conversion : RGBA to RGB

开发者 https://www.devze.com 2022-12-22 05:04 出处:网络
assuming i h开发者_开发问答ad RGBA (32 bits) output from frame-grabber, with alpha channel unused (values retained while filled by frame-grabbers), is there any effective conversion method to RGB (24

assuming i h开发者_开发问答ad RGBA (32 bits) output from frame-grabber, with alpha channel unused (values retained while filled by frame-grabbers), is there any effective conversion method to RGB (24 bits) ?

I am dealing with 5 MegaPixels streaming images so speed does matter too. keep in mind that data in alpha channel can be discarded.


Just copy the data and skip the unused alpha bytes.

If speed is important for you, you may want to use SSE or MMX and use the built-in bit-shuffling instructions. That is usually a bit faster than ordinary c-code.

5 megapixels doesn't sound like that much of data unless you have to do it at 100fps though.


Just copy RGB bytes and discard alpha channel (1 byte). Possible optimizations will be hardware specific. For instance Intel has special color conversion functions in IPP library.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号