I'm trying to get a grey linear-RGB-triple that is equally bright as another (colorful) RGB-triple.
I have to admit, that there is great confusion for me with all the color stuff, even though I read a lot of wikipedia articles, but I don't really get the big picture. I'm kind of lost and need help.
Wikipedia seems to mention a formula to receive the perceived brightness of a linear RGB color.
So I can measure the brightness of my color and do something like this I suppose:
public Vector3d get_equally_bright_grey(Vector3d color) {
for (double c = 0.0; c <= 1.0; c += 0.001) {
Vector3d grey = new Vector3d(c, c, c);
if (brightness(color) == brightness(grey)){
return grey;
}
}
}
But there has to be something other :)
Some context:
My input colors were spectral distributions that I converted to XYZ values (after Bruce Lindbloom). Then I have converted those XYZ values to linear RGB (again with Bruce). And here comes my question.
I know that the Y component of my XYZ triples is also something like the luminance, but I don't know how I generate a grey color XYZ color from this either..
R' G' B'in the equation which corespond to "gamma-compressed" values. So wouldn't give me this wrong numbers because I'm using linear RGB? 2) Could you explain why you've chosen this formula from the article? I'm confused why this does apply to my case and not the one with0.2126 ...– PeteParly Nov 01 '16 at 20:58Using it is a bit more involved, though. To get just the gray color, you'd have to convert your RGB color to Lab, then set the a and b components to 0, effectively removing chrominance, and then convert it back to the RGB space of your choice.
– Quinchilion Nov 01 '16 at 21:44