What range of RGB is considered “blue”?

后端 未结 1 598
滥情空心
滥情空心 2021-01-28 21:26

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];

Sorry for th

相关标签:
1条回答
  • 2021-01-28 21:30

    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.

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

    0 讨论(0)
提交回复
热议问题