增加RGB亮度的公式? [英] Formula to increase brightness of RGB?

查看:92
本文介绍了增加RGB亮度的公式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

快速提问!

我有一个R G B值,我想转换为50%的亮度.我找到了一个伽玛公式,但是不确定伽玛是否是正确的方法.

I have an R G B value and I want to convert to convert it to be 50% brighter. I found a gamma formula but I'm unsure if gamma is the correct way to go.

到目前为止,我正在使用:

So far, I'm using:

        r = 255*((R/255.0)^ (1/1.5));
        g = 255*((G/255.0)^ (1/1.5));
        b = 255*((B/255.0)^ (1/1.5));

我正在做的就是将伽玛乘以1.5.图像确实看起来更亮,但是我不确定它实际上是否更亮50%或我使用的公式是否错误.这是正确的吗?

All I'm doing is multiplying the gamma by 1.5. The image does look brighter, but I'm unsure if its actually 50% brighter or if the formula I'm using is wrong. Is this correct?

推荐答案

从字面上看,使其亮度提高50%"是这个

Literally "make it 50% brighter" is this

r = min(255, r*1.5)
g = min(255, g*1.5)
b = min(255, b*1.5)

您还可以将RGB转换为 HSV 贴图,增加V [值]并重新转换再次变为RGB.

You can also transform RGB to HSV map, increase the V [value] and reconvert it again to RGB.

这篇关于增加RGB亮度的公式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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