10

According to two sources I found, in the CIELAB LAB colorspace a value of L*=0 corresponds to black. Quoting Wikipedia:

The three coordinates of CIELAB represent the lightness of the color (L* = 0 yields black and L* = 100 indicates diffuse white ...)

and quoting Phil Cruse:

The L* axis represents Lightness. This is vertical; from 0, which has no lightness (i.e. absolute black) ...

However, this appears to not be the case. For example, using L*=0,a*=127,b*=0 one obtains in Mathematica:

FullForm[ColorConvert[LABColor[0, 1.27, 0], "RGB"]]

(*RGBColor[0.46364605275068677, 0., 0.052627307663056185]*)

...which is not black.

This does not appear to be a Mathematica bug, as it is also reproduced (to a couple sig figs, at least) in Julia using the Color.jl package:

convert(RGB, LAB(0,127,0))

# RGB{Float64}(0.46778684693714695,0.0,0.04112312700274846)

Likewise, visualizing the color cube of the LAB Colorspace is in the Neat Examples section of the Mathematica documentation page for LABColor. Here it is, with the L*=0 face of the surface pointing towards the camera:

enter image description here

With the exception of the cube at the corner, the majority of the cubes are decidedly not black. So my question is:

  • Why does an L*=0 setting not necessarily correspond to black in the CIELAB color space? Isn't L* supposed to correspond to perceived luminosity? If so, then why do some portions of the L*=0 subspace appear considerably brighter than black?
5
  • For what it's worth, I checked and there are three CIELAB questions on Mathematica.SE and 45 on StackOverflow.
    – hardmath
    Dec 17, 2014 at 16:05
  • 2
    When you should get negative linear RGB values, then the formula won't work properly unless that possibility has been taken into account explicitly. If you check the conversion to XYZ, you see that Y does become zero for L equal to zero and you can also see that when R G and B are not all zero, you can only get Y equal to zero if some of the RGB values are negative. Dec 17, 2014 at 18:07
  • @CountIblis: Thanks, but I'm still a little confused; are you saying that the reason the non-blackness occurs is that the color LAB(0,127,0) does not exist in the RGB space, and so conversion results in numerical errors which cause it to appear non-black? Dec 17, 2014 at 18:48
  • 1
    Yes, that's what it boils down to. It's best to read about the conversion from Lab to XYZ, and then from XYZ to linear RGB, the transform from linear RGB to sRGB is just a modified gamma transform. You'll see that from Lab to XYZ there are no problems, Y will be zero when L is zero. But from XYZ when you set Y = 0 while X and or Z are nonzero will yieled negative values for one or more RGB components, obviously if the total brigness is supposed to be zero when not all RGB components are zero, some must be negative. Most of this is explained here en.wikipedia.org/wiki/Lab_color_space Dec 17, 2014 at 19:04
  • Maybe easier to see: Manipulate[ ArrayPlot@ Table[LABColor[l, a, b], {a, -1, 1, .05}, {b, -1, 1, .05}], {{l, 0}, -1, 2} ]
    – Szabolcs
    Dec 17, 2014 at 21:23

2 Answers 2

6

Whatever is the "RGB" color space (sRGB?) that you entered as destination in Mathematica, it has limited range of colors that are described by the R, G and B values, usually similar to what a monitor can produce, printer can print etc and way smaller than Lab. Since there is only limited number of values (256 per color channel in 8-bit), the RGB color spaces try not to waste any values on colors that can't be reproduced to avoid nasty side effects.

The conversion from Lab to RGB ends up with out of gamut colors and the program is then trying to map the Lab color to the closest color that exists in the target RGB color space, usually by trimming any values < 0 or > 1 to 0 and 1.

If you are inclined to play with it, here is a great tool on the web, CIE Color Calculator by Bruce Lindbloom, that can be used for quick interactive conversions

4

The answer is quite simple: The color you specified is invalid (it does not exist). Be aware that it's possible in many color models to specify "colors" that do not exist.

Specifically you specify L*=0 (no light), but you also specify a*=1.27. How can there be any color component if there's no light?

If you examine the following table (from some unpublished work of mine), you'll see that for values below L*=3.14 the maximum saturation is zero (as is for L*=100). Maximum Chroma Values for LCh(ab)

The table shows the maximum perceivable saturation for colors h (vertical) at different intensity L (horizontal). The maximums are printed in bold.

Source of the table is: [Int10] International Color Consortium. Specification ICC.1:2010 (Profile version 4.3.0.0), 12 2010. [Online: http://www.color.org/ specification/ICC1v43_2010-12.pdf; Stand 15. November 2011].

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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