MATLAB: Greenness of an RGB image

Image Processing Toolboxrgb

Hi,
in an other thread I found this equation to compute the "greenness" of an RGB image:
greenDifference = abs(greenChannel – (redChannel + blueChannel)/2);
Can anybody name a literature source for this equation? I desperately need a source for my master thesis.
Thanks for your help.

Best Answer

As Image Analyst has said, it is just something well known and logical. Thus a high green component makes for a greenish color. A low value for (red + blue) also makes for green-ness. Is this exact? Not really, merely a good measure that will correlate with perceived green-ness.
I would suggest that someone made a rather large mistake when they formulated that expression. (Assuming RGB is scaled over the range [0,255].) The color [0 255 0] is a green. However, this formula, because of the abs, would also call [255 0 255] a greenish color, when clearly that is not at all green, in fact, a deep purple, so anti-green.
A better expression would arguably be to remove the abs:
greenDifference = greenChannel - (redChannel + blueChannel)/2;
Here green-ness can go negative, in fact we could have a green-ness measure that varies over the range [-255,255], with 255 as the maximum green-ness, and -255 as a maximal anti-green.
(If your image is scaled [0,1], then the green-ness measure here would vary from -1 to 1.)
If you preferred a measure that is scaled on the interval [0,255], then a good measure would be to transform it as:
greenDifference = (255 + greenChannel - (redChannel + blueChannel)/2)/2;
A similar version would work for images scaled over [0,1].
And finally, if your numbers are uint8, then you need to beware overflows and underflows. So you might convert first to int16 (or even a floating point representation) to avoid those failures.
Related Question