Perceptual Color Spaces: CIELAB and Delta E
Why RGB Distance Lies
Take two color pairs: one shifting from dark green to slightly brighter green, the other from pale yellow to pale orange. In RGB space, both shifts might have the same Euclidean distance. But to the human eye, the yellow-to-orange change is far more noticeable. RGB distance isn't wrong — it's measuring the wrong thing.
The problem is that RGB is a device space, designed for cathode-ray tubes and LCD pixels, not for human perception. The relationship between RGB values and perceived color is non-linear, non-uniform, and device-dependent.
Enter CIELAB
In 1976, the International Commission on Illumination (CIE) defined the L*a*b* color space with a specific goal: make Euclidean distance correspond to perceived color difference. The three axes are L* (lightness, 0=black to 100=white), a* (green-to-red), and b* (blue-to-yellow).
The conversion from RGB to CIELAB is a multi-step process: first to linear RGB (removing gamma), then to CIE XYZ (device-independent), then to L*a*b* using cube-root compression. Each step peels away a layer of device dependency and aligns the numbers with human vision.
Delta E: The Distance Formula
With colors expressed in CIELAB, the simplest measure of difference is ΔE*₇₆ — just the Euclidean distance in L*a*b* space. A ΔE of 1.0 is approximately the smallest difference a trained observer can detect under controlled conditions. But this was only the beginning.
ΔE94 (1994) introduced weighting factors that account for the eye's varying sensitivity across the color space — we're more forgiving of chroma differences in saturated colors than in neutral grays. CIEDE2000 refined this further with rotation terms for the problematic blue region and improved handling of near-neutral colors.
Why This Matters for Art
When an algorithm selects a color palette, it needs to know which pairs of colors are "close enough" to merge. When a viewer compares two prints, they need to know if the color shift is perceptible. When a dithering algorithm distributes error, it needs to weight the error by perceptual importance.
All of these tasks require a distance metric that respects human vision. RGB Euclidean distance will tell you that a shift in blue and a shift in green are equivalent. ΔE will correctly tell you that the green shift is more noticeable, because the L* channel — luminance — dominates human color perception.
The Just Noticeable Difference
The concept of JND (Just Noticeable Difference) is foundational. A ΔE of ~1 represents one JND. Below that, differences are imperceptible. Between 1 and 3, they're subtle but detectable. Above 5, they're obvious. This gives us a rigorous, measurable scale for color accuracy.
Understanding JND transforms color decisions from subjective ("does this look right?") to objective ("is this within 2 ΔE of the target?"). It's the difference between art by instinct and art by measurement — and in algorithmic art, we can have both.
From Theory to Practice
The Color Theory Lab lets you pick any two colors and compute their ΔE using multiple formulas. Watch how RGB distance and CIELAB distance diverge, especially in the greens and blues. You'll quickly develop an intuition for where RGB lies the most — and why perceptual color spaces exist.
Gerelateerde concepten
Gerelateerde artikelen
Probeer in het Lab
Verken Gerelateerde Secties
Gebruik deze secties om kunstwerken te ontdekken, technische context te lezen en het volledige ecosysteem van algoritmische kunst te verkennen.
