问题
Recently I have been trying to understand code that converts between the RGB color space and the CIE-XYZ color space, but it seems like every different calculator I try gives me radically different results. For example, trying to convert (255, 100, 70) to XYZ yields the following result, even when explicitly using d50 for everything:
- EasyRGB gives (46.903, 30.817, 9.270)
- Wolfram Alpha gives (0.7493, 0.7245, 0.6308)
- Bruce Lindbloom.com gives (0.493910, 0.317574, 0.070047)
- Java gives (0.95880127, 0.99554443, 0.8227539)
I don't see how these could possibly give such different answers. Which one is correct (if any)? Is there some sort of parameter that I am missing that differs between these websites?
回答1:
Because there are different RGB spaces, not just one.
On this page there is the general formula:
http://brucelindbloom.com/index.html?Eqn_RGB_to_XYZ.html
but the general formula depends on some parameters e.g. matrix M, which is different for each individual RGB space.
回答2:
If you go through this Calculator you will realize that there are lot of parameters that needs to be defined before converting those values to XYZ. So its not a direct calculation which will hold true in any given condition. There are lot of variables that you have to consider while doing so (Also knowing which variables will not affect your calculation).
The calculation will also depend on the application you are trying to develop. The approach for sensing the colour would be different from reproducing the same on screen.
来源:https://stackoverflow.com/questions/17764744/why-is-there-such-a-difference-between-rgb-to-xyz-color-conversions