Home > Software engineering >  How does opencv convert RGB to RGBA
How does opencv convert RGB to RGBA

Time:08-17

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?

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

CodePudding user response:

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.

  • Related