4

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?

  • This post gives one more: http://stackoverflow.com/questions/6629798/whats-wrong-with-this-rgb-to-xyz-color-space-conversion-algorithm – Ted Jul 20 '13 at 18:21
  • Also, make sure you convert 255 to 255.0f etc or else it might be rounding your answers, with different impacts depending on how much normalization is taking place. – Ted Jul 20 '13 at 18:22

2 Answers2

2

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.

boscarol
  • 1,901
  • 2
  • 15
  • 29
0

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.

Colour calculator

Mayank
  • 353
  • 6
  • 20