Better than Lab?
Gamut reduction: CIE Lab & OKLab
Chris Lilley, W3C
CIE XYZ
Linear-light. Great for physical color mixing
Not perceptually uniform.
CIE Lab & LCH
Not linear-light.
Opponent colors, central neutral axis
Perceptually uniform ... mostly
CIE Luminance
CIE Lightness
CIE Chroma, Hue
Out of gamut colors
- Colors that cannot be displayed by a given output device
- color(display-p3 0.40 0.95 0.16) is
color(srgb -0.21 0.965 -0.24)
- color(rec2020 0.2 1 1) is
color(display-p3 -0.56 1.027 0.999) or
color(srgb -0.78 1.05 1.007)
- Simple clip to [0.0, 1.0] changes proportion of primaries
Gamut Mapping Aims (gamut reduction)
- Mapped color “looks similar”
- Avoid hue shifts
- Reduce chroma as little as possible
Gamut mapping (LC plane) [Morovic 2008]
Shallow or concave gamut boundaries
- To avoid excessive chroma reduction:
- non-horizontal chroma reduction for v. light, v. dark colors
- Snap (clip) to closest gamut boundary if imperceptible
Display P3 yellow to sRGB: Strict gamut intersection
Out of P3 gamut in red; out of sRGB gamut in salmon.
Display P3 yellow to sRGB: Clip if deltaE < 2
Out of P3 gamut in red; out of sRGB gamut in salmon.
Color difference (ΔE)
- 1976
- delta E is Euclidean distance in Lab
- 1984
- CMC formula, used in fabric dyeing industry
- 1994
- delta E 94, based on LCH, corrects for errors
- 2000
- deltaE 2000 corrects for many errors
deltaE 1976
deltaE 1994
deltaE 2000
ΔE 2000
reveals
CIE Lab
non-
uniformity
[Lissner 2010]
Limitations of CIE Lab and LCH
- Over-estimating color differences at high chroma
- Axis asymmetry near zero
- Hue curvature, especially near blue
- [Hung & Berns 1995] [Zhao & Luo 2020]
CIE Lab mostly works well
CIE Lab blue curvature
A better way?
Instead of compensating for the non-uniformity
with a complex distance metric,
use a better, more uniform space.
Improved Uniform Color Space?
- IPT [Ebner 1998]
- (hue linear, not hue uniform)
- LAB2000 [Lissner 2010]
- (complex, L and ab lookup tables)
ΔE 2000
IPT
[Ebner 1998]
[Lissner 2010]
ΔE 2000
LAB2000
ΔE 2000
LAB2000
optimized
Color appearance models
- Depend on knowing surround and adapting field luminance
- LLAB(l:c) [Luo 1996]
- CAM16-UCS [Schlömer 2018]
- very complex
- numerically unstable, non-invertible!
OKLab [Ottosson 2020]
- Opponent space (like CIE Lab)
- Predicts lightness, chroma and hue well
- Perceptually orthogonal coordinates
- Hue uniform and hue linear
- Well-lit viewing condition
- Numerically simple, invertible
- OKLCH as well, of course
Recap: chromatic adaptation in LMS
Bradford chromatic adaptation involves:
conversion to LMS cone-like space,
transformation to new white point,
and conversion back.
OKLab 2
- XYZ → LMS → cube root non-linearity → OKLab
- Color pairs (limited to surface colors) in CAM16
- Numerical optimisation of ΔE 2000 for swapped color pairs
- L and ab then scaled for same ΔE 2000 (at mid grey)
Suspense
Ok but is it okay?
Show me the blue! Is there purple?
OKLab blue linearity
compare CIE Lab blue curvature
sRGB blue to neutral: OKLab
sRGB blue to neutral: CIE Lab
Display P3 yellow to sRGB OKLCH: intersection
Out of P3 gamut in red; out of sRGB gamut in salmon.
Display P3 yellow to sRGB OKLCH: Clip if ΔE < .02
Out of P3 gamut in red; out of sRGB gamut in salmon.
Bonus
OKLab ΔE is simple Euclidean distance (so, fast)
Bonus 2
OKLab hue linearity aids gamut mapping
and
OKLab hue uniformity aids gradients [Levien 2021]
Next steps
- Verify BT.2020 to Display-P3 mapping in OKLCH
- Examine analytical vs. recursive gamut boundary location
- Add oklab() and oklch() to CSS Color 4
- Recommend OKLCH for gamut mapping in CSS Color 4
- Investigate applicability of OKLCH mapping for HDR
References 2
- J. Morovič “Color Gamut Mapping”. Wiley (2008)
- M. R. Luo, M.-C. Lo, and W.-G. Kuo “The LLAB(ℓ:c) Colour Model”
Color Research & Applications 21:6 412-429 (1996)
- B. Ottosson, “A perceptual color space for image processing”
(2020). https://bottosson.github.io/posts/oklab/
- N. Schlömer “Algorithmic improvements for the CIECAM02
and CAM16 color appearance models”
- B. Zhao and M. R. Luo, “Hue linearity of color spaces for wide color gamut
and high dynamic range media”
Journal of the Optical Society of America
37, 865-875 (2020)