简体   繁体   English

opencv如何将RGB转RGBA

[英]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 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? Opencv可以进行RGB空间到RGBA空间的转换,但是它是怎么做到的呢?

As far as I can understand from the text, they just append the grayscale value as the alpha channel, correct?据我从文字中了解到,它们只是将 append 的灰度值作为 alpha 通道,对吗?

But that is not really true alpha is it?但这不是真正的阿尔法,是吗? As far as I can tell, the alpha value is used to describe transparency?据我所知,alpha值是用来描述透明度的吗?

No , the grayscale value is not appended.附加灰度值。 That's not how alpha channels work at all.这根本不是 Alpha 通道的工作方式。

A constant 255 is appended to form the RGBA tuple, which means "opaque" .附加一个常数 255以形成 RGBA 元组,这意味着“不透明”

max(ChannelRange) means 1.0 for float type, 255 for uint8 type, 65535 for uint16 type. max(ChannelRange)表示float类型为 1.0, uint8类型为 255, uint16类型为 65535。

OpenCV is generally not (yet?) aware of the special meaning of alpha channels, or how to calculate with them. OpenCV 通常(还没有?)知道 alpha 通道的特殊含义,或者如何使用它们进行计算。 It treats all channels the same.它对所有通道一视同仁。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM