问题描述
我一直在试图获得一个可视化几天。
我产生一个衍射图像,并希望根据光的波长对其进行着色。
获得正确颜色的最简单的方法是使用HSV空间,H随波长变化和S,V设置为1.0
唉,我找不到公式/算法/方式在HSV空间中混合不同的颜色。
I've been trying to get a visualisation going for a few days.I'm generating a diffraction image and want to color it depending on the wavelength of light.
The easiest way to get the right color was by using the HSV space with H varying with the wavelength and S,V set to 1.0
Alas, I can't find a formula/algorithm/way to mix different colors in the HSV space.
推荐答案
老实说,我会将RGB转换为平均值该组件并转换回HSV。
Honestly, I'd convert the RGB, average the components and convert back to HSV.
这不是最有效的方式,但是您可能具有或需要RGB&HSV代码,并且RGB计算可能更简单。
It's not the most efficient way, but you'll presumably have or need RGB<->HSV code and the RGB calculation is likely to be much simpler.
这篇关于在HSV空间中添加/混合颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!