【问题标题】:Adjust temperature to LAB color space将温度调整到 LAB 色彩空间
【发布时间】:2016-12-03 07:00:25
【问题描述】:

我正在尝试在 javascript(HTML5 画布)中实现色温更改功能。根据我的研究,我得出的结论是,最好的方法是将 RGB 转换为 LAB,然后从 LAB 调整 B 分量(A -> Tint & B -> Temperature)

不过,我还实现了一个转换度数的代码 Kelvin to an RGB value 。所以我有两个我需要的组件;图像数据和我的体温。

我的方法是将每个像素转换为 LAB,并将温度 RGB 也转换为 LAB,并在这些值之间进行插值。我只是不知道这是否是正确的方法。

或者有没有更好的方法根据一定的开尔文度数对图像应用温度?

【问题讨论】:

  • 我会想办法在 RGB 中进行调整。即使进行实际调整有点复杂,避免所有转换只是为了使调整更简单一点...

标签: javascript image-processing colors html5-canvas


【解决方案1】:

在进行更多研究后,我发现了这种无需进行任何颜色转换即可进行温度调节的算法。

//code from http://www.tannerhelland.com/5675/simple-algorithms-adjusting-image-temperature-tint/
//Given a temperature adjustment on the range -100 to 100,
//apply the following adjustment to each pixel in the image:

r = r + adjustmentValue
g = g
b = b - adjustmentValue
//Given a tint adjustment on the range -100 to 100, 
//apply the following adjustment to each pixel in the image:

r = r 
g = g + adjustmentValue
b = b 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-08-19
    • 2018-01-17
    • 2020-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-27
    • 2016-01-25
    相关资源
    最近更新 更多