colorsrgbcolor-spacesrgbgamut

xyY color locus does not look correct


I just finished the task of converting an xyY color to RGB. I am using the sRGB color space.

When I loop through x and y coordinates, this is the output I get: enter image description here

The whitepoint (D65) is marked with a black pixel.

However, this is what I should be getting: enter image description here

I tried my best to clip the gamut (I generated bounding lines and then used Photoshop to delete outside those bounds) but it is obvious the white area is too large, the red area is too small, and more.

I tested several different XYZ colors and converted them to RGB with my program and this website and they matched, within margin of error (<0.1).

Any ideas on what could cause these problems?

EDIT

It appears my output is exactly the same as How to tell if an xyY color lies within the CIE 1931 gamut?.

(If I do not clip it)

This leads me to believe maybe I didn't do anything wrong, but it is still not explained why Wikipedia's gamut is different.


Solution

  • You should show the code, but probably I can guess.

    Colours are tri-dimentional. With CIE xy figure, one put just some colours on the figures. Often they are not just projections, but stranger surfaces.

    Often you see two kinds, according on how to add the primaries: additive and subtractive. And sometime there is your case, which is wrong.

    On subractive colour, you just multiply the numbers (colors normed from 0 to 1). Additive (as you would like to do): you add the components, but then you norm the value to Y=1 (possibly only if Y>1), and then further scaling. So you will maintain the hue, but the colour will be no clipped (Note: when scaling, you should take into account different weight of R,G,B in Y).

    You case seems the wrong one: you add the colour, and just you clip R or G or B not to be over the maximum (1, 100 or 255). But this: change the hue, make the colour dull. (maybe you just did the subtractive colour, so multiplication, but there is something not right, visually).