混合两个RGB颜色向量以获得结果 [英] Mixing two RGB color vectors to get resultant

查看:309
本文介绍了混合两个RGB颜色向量以获得结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想混合两个源RGB向量来创建第三个合成向量,这是前两个直观的混合。



理想情况下,我可以模拟真正的油漆混合特性,但为了简单起见,我试图找到一种方法,



这些特征:

红色+黑色=深红色

RED + WHITE = LIGHT RED



最佳,还具有真实的油漆特性:

RED + BLUE = PURPLE

RED + YELLOW = ORANGE

(etc)



-



我目前通过添加两个源RGB向量/ 255,然后归一化(并乘以255)来做这个延迟方式。
所以,使用此:[Red =< 1,0,0> * 255] + [Blue =< 0,0,1> * 255]给出Magenta =< 1,0,1& sqrt(2)* 255,虽然其他颜色不太直观,甚至可见...我需要一个更好的方法!请帮助: - )

解决方案

您建议的加权平均值是否相同?

平均R = w1 * R1 + w2 * R2 + w3 * R3 + ... + wn * Rn 

平均值G = w1 * G1 + w2 * G2 + w3 * G3 + ... + wn * Gn

平均B = w1 * B1 + w2 * B2 + w3 * B3 + ... + wn * Bn

w是加权分数,它们的总和是1。



R1是第一个



<$>

因此,如果您想平均混合两种颜色, p $ p>平均R = 0.5 * R1 + 0.5 * R2

平均G = 0.5 * G1 + 0.5 * G2

平均B = 0.5 * B1 + 0.5 * B2

对于将结果颜色映射到命名颜色(深红色),可能只是做一个查找表并选择最近的一个?


I am trying to mix two source RGB vectors to create a third "resultant vector" that is an intuitive mix of the first two.

Ideally, I would be able to emulate "real paint mixing characteristics", but for simplicity, I am trying to find a method where the resultant looks intuitively like what you'd get from combining the two source rgb's.

minimally, these characteristics:
RED + BLACK = DARK RED
RED + WHITE = LIGHT RED

optimally, also with real paint characteristics:
RED + BLUE = PURPLE
RED + YELLOW = ORANGE
(etc)

--

I am currently doing this the "lazy way" by adding the two source RGB vectors/255, then normalizing (and multiplying by 255). So, using this: [Red = <1,0,0> * 255] + [Blue = <0,0,1> * 255] gives Magenta=<1,0,1>/sqrt(2) * 255, though the other colors are less intuitive or even visible... I need a better method! Please help :-)

解决方案

Is what you suggested the same as a weighted average?

Average R = w1*R1 + w2*R2 + w3*R3 + ... + wn*Rn

Average G = w1*G1 + w2*G2 + w3*G3 + ... + wn*Gn

Average B = w1*B1 + w2*B2 + w3*B3 + ... + wn*Bn

The w's are the weighting fractions and the sum of them is 1.

R1 is the red component of the first color to mix, for example.

So if you wanted to mix two colors evenly, it would be:

Average R = 0.5*R1 + 0.5*R2

Average G = 0.5*G1 + 0.5*G2

Average B = 0.5*B1 + 0.5*B2

As for mapping the resultant color to a named color ("dark red") maybe just do a lookup table and pick the closest one?

这篇关于混合两个RGB颜色向量以获得结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆