How to draw colors on CIE 1931 Color Space in Matlab?

I am trying to plot multiple color values ​​(coordinates) on an already plotted CIE 1931 color space. I got the XYZ color values ​​that I want to plot indicated as [X, Y, Z]

-

[50, 57, 10]

[36, 43, 15]

[28, 36, 8]

[25, 32, 14]

I am using this function which renders the whole CIE color space - http://www.mathworks.com/matlabcentral/fileexchange/40640-computational-colour-science-using-matlab-2e/content//cieplot.m

 cieplot();
 hold on
 x=[0.42 0.58]
 y=[0.48 0.45];
 scatter(x,y);
 hold off

      

I have used the below two formulas to calculate the values x

and y

used in the above code to plot 2 colors as an example and generate the picture / graph shown. One of the two colors is outside the desired color spectrum. I am confused as to how to plot a coordinate z

that can be calculated as z=1-x-y

in the shown CIE color space so that all colors fit the spectrum.

Formula to calculate x

Formula to calculate y

Generated Plot / Figure

+3


source to share


1 answer


As pointed out by horchler , the error was in my color conversion (RGB to XYZ to xyY) which I made external to MATLAB. While fixing the error, the following code gave the desired result.

cieplot();
hold on
x=[0.42 0.38 0.388 0.352 0.344 0.281]
y=[0.48 0.45 0.5 0.45 0.452 0.352];
scatter(x,y,10,'filled');
i=1;
a=[1 2 3 4 5 6];
strValues = strtrim(cellstr(num2str(a(:),'(%d)')));
text(x,y,strValues,'VerticalAlignment','bottom');
hold off

      



The graph shows six colors plotted in the CIE 1931 color space according to their values x

and y

. The resultant graph

0


source







All Articles