2

Hello i am trying to write my own HSL Colorspace in Java but i ran into an problem with the CIEXYZ conversion...

I have already writen a from/toRGB Method but java requires to write a from/toCIEXYZ method too. I thought i could use the pre-implemented CIEXYZ Colorspace for that...

@Override
public float[] fromCIEXYZ(float[] colorvalue) {
    return fromRGB(CIEXYZ.toRGB(colorvalue));
}

but this doesn't work and after some time i figured out that the CIEXYZ colorspace java provides doesnt works like i expected it...

ColorSpace cieXYZ = ColorSpace.getInstance(ColorSpace.CS_CIEXYZ);
    System.out.println(Arrays.toString(cieXYZ.toRGB(cieXYZ.fromRGB(new float[]{1,0.5f,0}))));

the result of this small code is [0.9820706, 0.49709317, 0.122087434] and not [1 , 0.5, 0]...

can anybody explain me why? and how can i fix this?

Kaspars Ozols
  • 6,967
  • 1
  • 20
  • 33
MZuenni
  • 63
  • 5
  • Why? Because in colorimetry, every color conversion seems to become arbitrary and meaningless. [Related](http://stackoverflow.com/questions/17764744/why-is-there-such-a-difference-between-rgb-to-xyz-color-conversions). Nobody ever gets this right. +1 because I'm curious about the answer, though. I'd guess that it is related to some Whitepoint issue and maybe some clamping or missing normalization.... – Marco13 Sep 21 '15 at 22:52

0 Answers0