njsmith / colorspacious

A powerful, accurate, and easy-to-use Python library for doing colorspace conversions
MIT License
169 stars 16 forks source link

Should CVD matrices be applied to linear RGB or gamma-encoded RGB? #24

Closed mpetroff closed 3 years ago

mpetroff commented 3 years ago

Machado et al. (2009) does not specify exactly how its CVD simulation matrices should be applied to RGB. As pointed out by USAARL Report No. 2020-10, Machado et al. apply the transforms to gamma-encoded RGB values (I was also able to confirm this by trying to replicate the figures). The authors of the technical report apply the matrices to linear RGB values, as is done in Colorspacious. Applying a linear transform to gamma-encoded values doesn't make much sense to me, so I feel that Colorspacious's current approach is correct, but I wanted to see if anyone else had thoughts on this.

mpetroff commented 3 years ago

The following comment about this from Manuel M. Oliveira was forwarded to me:

According to our experience, applying the matrices to either linear or gamma-encoded RGB did not appear to make any significant difference. Thus, in our paper, we showed results directly on gamma-encoded RGB.

The fact that it didn't make a difference makes sense, since the experiments done in the paper did not use extremely dark colors, where the difference between linear and gamma-encoded RGB values is the largest.

However, as the CVD simulations matrices were derived from the LMS color space, the use of linear RGB values makes the most sense, since a linear transformation can be used to translate LMS values into linear RGB values, unlike the transformation to gamma-encoded RGB, which is non-linear.