Color to grayscale algorithm

RGB in Processing already is gamma-corrected, so simply taking average of the 3 RGB components gives the Gleam metric.

If we linearly interpolate over a range of values in Processing (say black-to-white, 0-255), we get an even change in the perceived brightness of each colour: a black-to-white gradient with grey at the midpoint, even though the physical light intensity is non-linear. This is the expected behavior under gamma correction.

6 Likes