4
$\begingroup$

The following points are Lab values (CIELAB color space)

points={{46.76, 34.51, 17.08}, {43.51, 34.83, 15.7}, {45.49, 32.92, 15.24}}

what I would like to do is a) represent them in 3D b) give each point the color it represents and c) label each point with a text, let us say {"one","two","three"}. My starting point is an adaptation from the documentation:

Graphics3D[{LABColor[#], Sphere[#, .2]} & /@ points, Axes -> True, AxesLabel -> {"L", "a", "b"}, BoxRatios -> Automatic]

However, I do not get the colors right. thanks for the help.

$\endgroup$
  • $\begingroup$ Don't you need divide points by 255? $\endgroup$ – OkkesDulgerci Aug 17 '18 at 11:47
  • $\begingroup$ @OkkesDulgerci where does 255 come from? Shouldn't it be 100? (I am not sure but that is what documentation suggests). $\endgroup$ – Kuba Aug 17 '18 at 12:24
  • $\begingroup$ @Kuba 255 for RGBColor After I posted my answer I started reading documentation it seems you are right. $\endgroup$ – OkkesDulgerci Aug 17 '18 at 12:32
1
$\begingroup$

According to documentation here you need to divide values by 100

points = {{46.76, 34.51, 17.08}, {43.51, 34.83, 15.7}, {45.49, 32.92, 
        15.24}};
    Graphics3D[{LABColor[#/100], Sphere[#, 0.2]} & /@ points, 
     Axes -> True, AxesLabel -> {"L", "a", "b"}]

enter image description here

According to here formula for converting to color is

points ={{46.76, 34.51, 17.08}, {43.51, 34.83, 15.7}, {45.49, 32.92, 15.24}};
    {L, a, b} = Transpose@points;
{L = L/100, a = (a + 86.185)/184.439, b = (b + 107.863)/202.345};
pts = Transpose@{L, a, b};
Graphics3D[{LABColor[#], Sphere[#, 0.005]} & /@ pts, Axes -> True, 
 AxesLabel -> {"L", "a", "b"}]

enter image description here

Or this kind of converting

{L, a, b} = Transpose@points;
{L = L/100, a = (a + 128)/255, b = (b + 128)/255};
pts = Transpose@{L, a, b};
Graphics3D[{LABColor[#], Sphere[#, 0.005]} & /@ pts, Axes -> True, 
 AxesLabel -> {"L", "a", "b"}]

enter image description here

$\endgroup$
  • $\begingroup$ indeed points contain CIELab values, so one should only divide by 100 for LABColor. Right? Why 100 for L and 255 for a and b? $\endgroup$ – Luigi Aug 17 '18 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.