Back to Image Processing

Reinhard Color Transfer in CIE-Lab Space

Statistical Recolouring · Per-Channel Mean and Standard Deviation

Abstract

Reinhard et al. (2001) showed that a surprisingly broad class of image-recolouring effects can be produced by transferring just two statistics, the per-channel mean and the per-channel standard deviation, from a reference image to a target image, in the perceptually-uniform CIE-Lab colour space. The implementation here applies that algorithm to nine public-domain test images, using Lenna as the reference palette.

Why CIE-Lab

RGB is a device colour space: the three channels are correlated (R, G, B all rise together for "brighter"), so transferring statistics in RGB couples luminance to chromaticity in ways that hurt the result. CIE-Lab decorrelates: L* carries luminance, a* and b* carry chromaticity. Per-channel statistics in Lab move colour without dragging brightness, and move brightness without dragging colour.

Algorithm

For each Lab channel c ∈ {L*, a*, b*}, with reference image S and target image T, compute the recoloured target pixel:

c'_T(x, y)  =  (σ_S^c / σ_T^c) · ( c_T(x, y)  −  μ_T^c )  +  μ_S^c

That is: subtract the target's per-channel mean, rescale by the ratio of standard deviations, then add the reference's per-channel mean. The result is converted back from Lab to BGR and clipped to [0, 255].

Two statistics per channel × three channels = six numbers carry the entire colour transfer. The whole pipeline is two colour-space conversions, six cv2.meanStdDev calls, and per-pixel arithmetic, which is why it runs in milliseconds on a CPU and why it sits inside compositing tools that need real-time recolour.

When the method works, when it doesn't

  • Works when the reference and the target share rough scene composition: similar foreground/background ratios, similar brightness range. The transfer adjusts a globally-consistent palette without needing per-pixel correspondence.
  • Fails gracefully when ratios diverge: an image with a small bright object on a large dark background, recoloured against a reference with the opposite distribution, ends up with the bright object getting most of the colour shift even when it shouldn't.
  • Fails badly when the assumption of unimodal per-channel statistics breaks. A target with bimodal a* (e.g., split between two strongly different hues) loses the bimodality after the linear remap.
  • Not the same as colorization. True colorization takes a grayscale input and assigns chrominance from learned priors (Welsh et al. 2002, Levin et al. 2004, modern CNN/GAN methods). Reinhard transfer requires colour input on both sides.

Selected Results

Reference palette is taken from Lenna throughout. Three of the nine targets are shown.

Cameraman test image after Reinhard colour transfer using Lenna's Lab statistics as the reference palette

Target: Cameraman. The originally near-grayscale target picks up a warm, low-saturation cast from the reference.

Sailboat test image after Reinhard colour transfer using Lenna's Lab statistics

Target: Sailboat. The blue-dominant target shifts toward the warmer reference distribution while preserving the structural luminance.

Yacht test image after Reinhard colour transfer using Lenna's Lab statistics

Target: Yacht. Per-channel statistics move chromaticity without crushing the high-contrast hull/sail/water structure.

Reference

Reinhard, E., Adhikhmin, M., Gooch, B., & Shirley, P. (2001). Color Transfer between Images. IEEE Computer Graphics and Applications, 21(5), 34–41.