哪个RGB范围被视为“蓝色”? [英] What range of RGB is considered "blue"?

查看:729
本文介绍了哪个RGB范围被视为“蓝色”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在获取这样的图像像素数据:

I'm getting image pixel data like this:

var p = c.getImageData(x, y, 1, 1).data;
var red = p[0];
var green = p[1];
var blue p[2];

对此很抱歉,但是我的问题不是关于代码的问题,rgb的范围被认为是蓝色的颜色? (例如,红色也可能由蓝色组成,但是我们将其称为红色,如何确定它?)

Sorry for this but my question is not much about code, what range of rgb is considered to be blue color? (for example red color may consist of blue color too, but we call it red, how to determine it?)

推荐答案

任何从180到300的色调范围内的颜色可以视为蓝色,因为这是主要颜色。但是,如果您也要考虑二次色,则范围是210到270。然后您必须考虑它看起来仍然是青色(因为绿色在感知上比蓝色要明亮得多)之类的东西,

Any colour in the hue range from 180 to 300 can be considered blue, since that's the primary colour that is dominant. However, if you want to consider secondary colours too, then your range is 210 to 270. Then you have to factor in things like "it still looks cyan" (since green is far more perceptually bright than blue) and stuff like that, there's really no hard-and-fast definition.

所以您可以做的就是说 if(max(red(green,red,green,blue)== blue)then blue)没有人会为此而责备你。

So what you could do is say "if( max( red, green, blue) == blue) then it's blue" and nobody can fault you for it.

这篇关于哪个RGB范围被视为“蓝色”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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