公式确定RGB颜色的亮度 [英] Formula to determine brightness of RGB color
本文介绍了公式确定RGB颜色的亮度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找一些公式或算法来确定给定RGB值的颜色的亮度。我知道它不能像添加RGB值在一起那么简单,有更高的总和更明亮,但我有点失去了,从哪里开始。
I'm looking for some kind of formula or algorithm to determine the brightness of a color given the RGB values. I know it can't be as simple as adding the RGB values together and having higher sums be brighter, but I'm kind of at a loss as to where to start.
推荐答案
你的意思是亮度吗?感知亮度?亮度
Do you mean brightness? Perceived brightness? Luminance?
- 亮度(某些颜色空间的标准):
(0.2126 * R + 0.7152 * G + 0.0722 * B)
[1] - 亮度(感知选项1):
(0.299 * R + 0.587 * G + 0.114 * B)
[2] - 亮度(感知选项2,计算较慢) strike>
sqrt(0.299 * R ^ 2 + 0.691 * G ^ 2 + 0.068 * B ^ 2)
(感谢 @MatthewHerbst ) [3]
- Luminance (standard for certain colour spaces):
(0.2126*R + 0.7152*G + 0.0722*B)
[1] - Luminance (perceived option 1):
(0.299*R + 0.587*G + 0.114*B)
[2] - Luminance (perceived option 2, slower to calculate):
→sqrt( 0.241*R^2 + 0.691*G^2 + 0.068*B^2 )
sqrt( 0.299*R^2 + 0.587*G^2 + 0.114*B^2 )
(thanks to @MatthewHerbst) [3]
这篇关于公式确定RGB颜色的亮度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文