简体   繁体   English

RGB到RGB加AMBER

[英]RGB to RGB plus AMBER

I want to control DMX light from a higher system. 我想从更高的系统控制DMX灯光。 I receive only RGB values 0-255. 我只收到RGB值0-255。 DMX light have RED, GREEN, BLUE and AMBER light (0-255). DMX灯有红色,绿色,蓝色和琥珀色(0-255)。 How can i convert RGB to RGB + Amber? 如何将RGB转换为RGB +琥珀色?

I tried manually adjust the light, but the conversion table is not an option for me, because i have limited memory. 我尝试手动调节灯光,但是转换表对我来说不是一个选择,因为我的内存有限。 Thanks. 谢谢。 R [R

In light, there are different color spaces. 根据光线,存在不同的色彩空间。 Each color space is a dimensional space such that combining colors along the "dimension" will result in a mixed color. 每个颜色空间都是一个维空间,因此沿“维”组合颜色将导致混合的颜色。

RGB, means that you get to mix various values of Red, Green, and Blue. RGB,意味着您可以混合使用Red,Green和Blue的各种值。 Amber is already a mixture, so to "add Amber" to RGB, you have to decide how to adjust the Red, Green, and Blue values such that they seem a bit more Amber. 琥珀色已经是混合色,因此要将“琥珀色”“添加”到RGB,必须决定如何调整“红色”,“绿色”和“蓝色”值,使它们看起来更像琥珀色。

Amber is #FFBF00 or (RGB: 255, 191, 0), so the first step would be to figure out how much of "Amber" a RGB value is. 琥珀色为#FFBF00或(RGB:255,191,0),因此第一步将是确定RGB值占多少“琥珀色”。 For example, (RGB: 128, 80, 0) is 50% Amber and 0% everything else. 例如,(RGB:128,80,0)为50%琥珀色,其他为0%。

Once you can figure out the Amber percentage, you can "pull out the Amber" leaving the rest of the non-amber color in RGB. 一旦确定了琥珀色的百分比,就可以“拉出琥珀色”,将其余的非琥珀色保留为RGB。 Then you can have a RGBAmber color space. 然后,您可以拥有RGBAmber颜色空间。

Keep in mind that you can't over-drive RGB, so if you add (RGBAmber: 50%, 20%, 0%, 100%) it will be converted to RGB(100%, ...) which won't let the red scale up as much as the other colors, making the amber things seem a bit off. 请记住,您不能过度驱动RGB,因此如果添加(RGBAmber:50%,20%,0%,100%),它将被转换为RGB(100%,...),不会让红色与其他颜色一样多地放大,使琥珀色的东西看起来有点偏离。

In reality, this will properly approximate the construction of the fourth amber dimension; 实际上,这将适当地近似第四个琥珀尺寸的构造。 but, it won't be correct. 但是,这是不正确的。 The truth is that you cannot fully construct the fourth dimension from the other three because the Red Green and Blue physically mix differently than the Amber channel produces. 事实是,您无法从其他三个维度完全构建第四个维度,因为红色绿色和蓝色在物理上的混合方式与琥珀色通道产生的方式不同。 For example, it is fully valid to drive RGBAmber at 100% across all channels, but RGB could never do that, as to drive amber at 100% you would effectively zero out all of your red channel. 例如,在所有通道上以100%驱动RGBAmber是完全有效的,但是RGB永远不会这样做,因为以100%驱动琥珀色将有效地将所有红色通道归零。

Amber is #FFBF00 or (RGB: 255, 191, 0) 琥珀色为#FFBF00或(RGB:255,191,0)

char amber = (floor(255.0f*(R*1.0f+G*.749f)/446.0f))

this part of the calculation performs the amber scaling: 这部分计算执行琥珀色缩放:

(R*1.0f+G*.749f)/446.0f)  and results in a value range 0.0f...1.0f

this part of the calculation performs the scaling to 0...255 这部分计算会将比例缩放为0 ... 255

255.0f*

this part of the calculation eliminates the fraction 这部分计算消除了分数

(floor(....)

in all probability the range produced will be 0...254, but that should be close enough to keep it simple and usable 产生的范围极有可能是0 ... 254,但这应该足够接近以使其简单易用

Amber LEDs have different spectra from red, green, blue, and white LEDs. 琥珀色LED具有与红色,绿色,蓝色和白色LED不同的光谱。 There is no RGB --> RGBA conversion, because you will end up with a different spectrum of lighting than if you had used RGB LEDs alone. 没有RGB-> RGBA转换,因为与单独使用RGB LED相比,最终将获得不同的照明光谱。

Side note: amber LEDs are typically quite dim in comparison to red and green, so if you're just trying to produce light that "looks" yellow to our eyes, you can just ignore the amber channel of your DMX light without sacrificing much on total brightness. 旁注:与红色和绿色相比,琥珀色LED通常非常暗,因此,如果您只是尝试产生对我们的眼睛“看起来”为黄色的光,则可以忽略DMX灯的琥珀色通道而无需牺牲太多总亮度。

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

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