Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How does opencv convert RGB to RGBA

I am doing so work with opencv and I found this: https://docs.opencv.org/3.4/de/d25/imgproc_color_conversions.html

Opencv can perform conversion from RGB space to RGBA space, but how does it do it?

As far as I can understand from the text, they just append the grayscale value as the alpha channel, correct?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

But that is not really true alpha is it? As far as I can tell, the alpha value is used to describe transparency?

>Solution :

No, the grayscale value is not appended. That’s not how alpha channels work at all.

A constant 255 is appended to form the RGBA tuple, which means "opaque".

max(ChannelRange) means 1.0 for float type, 255 for uint8 type, 65535 for uint16 type.

OpenCV is generally not (yet?) aware of the special meaning of alpha channels, or how to calculate with them. It treats all channels the same.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading