增加RGB强度 [英] Increasing intensity of RGB

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

问题描述

我陷入了一个问题,不知道去哪里看. 我需要增加图像中特定颜色的强度,例如R,G或Blue. 当我这样做时,某些颜色无法正确呈现.

I am stuck in a problem and dont know where to look at. I need to increase intensity of particular color in image, like R, G, or Blue. When I am doing that, certain colors are not rendering properly.

下面是我测试的图像:

Below is the image that I took for testing:

现在当我像绿色一样增加时:

Now when I increase like Green color:

A = Color.alpha(p);
R = Color.red(p);
G = (int)(Color.green(p)*1.2);
B = Color.blue(p);

这是我得到的:

解决这些粉红色补丁的解决方案是什么?

What can be the solution to fix those Pink patches.

谢谢

推荐答案

请对值进行钳位,以使其不会超过255.

Ty clamping the values so that they don't go over 255. Like this:

A = Color.alpha(p);
R = Color.red(p);
G = Math.min((int)(Color.green(p)*1.2), 255);
B = Color.blue(p);

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

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