Introduction to CAT16
When two colours appear the same under two different illuminants, they are called corresponding colours. A chromatic adaptation transform (CAT) can predict the tristimulus values of a corresponding colour under one illuminant given the other illuminant and the tristimulus values of a colour under it. CAT16 is the latest chromatic adaptation transform model.
Its basic structure is similar to the von Kries hypothesis: first convert the tristimulus values to a special cone response space, then apply independent gains to each channel in that space, and finally convert back to tristimulus values. These three steps can all be expressed by matrices.
The matrix that converts from tristimulus values to cone space is called $\mathrm{M}_{16}$, and its inverse $\mathrm{M}_{16}^{-1}$ converts from cone space back to tristimulus values. The independent channel gains are described by a diagonal matrix $\Lambda$, that is:
$$ \Phi_{r,t} = \mathrm{M}_{16}^{-1} \cdot \Lambda_{r,t} \cdot \mathrm{M}_{16} $$In use, we call the two illuminants Test and Reference. The subscripts in the equation indicate a transform from Test to Reference (r,t means from t to r). When a known colour sample is on the Test side, this is the forward transform, denoted by $\Phi$.
If the known colour is on the Reference side, it is the inverse transform, denoted by $\Psi$. For example, to predict the corresponding colour of a known Reference-side colour, use the following matrix.
$$ \Psi_{t,r} = \Phi_{r,t}^{-1} = \mathrm{M}_{16}^{-1} \cdot \Lambda_{r,t}^{-1} \cdot \mathrm{M}_{16} $$Since many symbols will follow, for clarity please first understand: “In CAT16, forward and inverse transforms are not the same as swapping illuminants”:
$$ \Psi_{t,r} = \Phi_{r,t}^{-1} \ne \Phi_{t,r} $$In this article, we ignore luminance adaptation in the model and set $Y_w=Y_{wr}$.
Why one-step CAT16 is not reversible
Reversible means: after a forward transform from A to B, followed by another forward transform from B back to A, do we get the original values? Or, is a forward transform A to B followed by B to C equivalent to a direct forward transform A to C?
The one-step method does not satisfy reversibility or transitivity. The culprit is the degree of adaptation D, a factor between 0 and 1 that describes adaptation level. It can be directly specified or computed from field luminance, etc. Let’s look closely at the structure of the diagonal gain.
$$ \text{Gain} = D \cdot \frac{\text{RGB}_{\textit{Ref}}}{\text{RGB}_{\textit{Test}}} + (1 - D) $$This diagonal matrix is actually a linear combination of the identity matrix and a diagonal matrix related to the white point transform, weighted by the adaptation degree D.
Consider a forward transform from A to B, then a forward transform from B back to A. Let $\text{RGB}_{B}/\text{RGB}_{A} = x$.
$$ (Dx+(1-D))\cdot(D\frac{1}{x}+(1-D)) $$Multiplying these two linear combinations produces quadratic terms, so it only equals the direct transform when D is 0 or 1.
Why two-step CAT16 is reversible
Because it consists of one forward step followed by one inverse step, with an equal-energy white as the intermediate illuminant.
$$ \Pi_{r,t} = \Psi_{r,e} \cdot \Phi_{e,t} = \mathrm{M}_{16}^{-1} \cdot \Lambda_{e,r}^{-1} \cdot \Lambda_{e,t} \cdot \mathrm{M}_{16} $$When you need transitivity or reversibility, what actually happens is “forward then inverse, then forward then inverse,” and the two middle steps are inverses of each other.
For example, for A to B to C, what happens is: A forward to E, E inverse to B, B forward to E, E inverse to C. The two middle steps cancel out as inverses, which is equivalent to the two-step A to C.
$$ \Pi_{C,A} = \mathrm{M}_{16}^{-1} \cdot \Lambda_{E,C}^{-1} \cdot \Lambda_{E,B} \cdot \Lambda_{E,B}^{-1} \cdot \Lambda_{E,A} \cdot \mathrm{M}_{16} $$Therefore, two forward steps or two inverse steps still do not yield a reversible two-step method (even with equal-energy white). You must have one forward and one inverse so the middle parts cancel during chaining.
Note that the intermediate illuminant can be arbitrary mathematically; it does not have to be equal-energy white.
Why this matters
The one-step CAT16 directly links the test and reference fields, but due to the adaptation degree it is neither transitive nor symmetric, so under incomplete adaptation it is “incorrect.” The two-step version introduces an intermediate illuminant, making it mathematically transitive and reversible.
Symmetry and transitivity are often considered desirable properties for chromatic adaptation models, though some research argues otherwise.
The one-step and two-step methods perform very similarly on various visual datasets. In practice, it is recommended to use the two-step CAT16 adaptation. This also matches the behavior of CIECAM16: its first step adapts the colour stimulus to an equal-energy white field, and using forward plus inverse CIECAM16 is equivalent to the two-step CAT16.
In practice, some applications that use CATs need transitivity and symmetry to avoid error accumulation, such as colour management systems and display pipelines.
Some issues in the paper
Li, C.; Li, Z.; Wang, Z.; Xu, Y.; Luo, M. R.; Cui, G.; Melgosa, M.; Brill, M. H.; Pointer, M. Comprehensive colour Solutions: CAM16, CAT16, and CAM16-UCS. colour Research & Application 2017, 42 (6), 703–718. https://doi.org/10.1002/col.22131.
In Equation (5), Y_w should be RGB_wr, otherwise it contradicts the part later stating Y_w=Y_wr=100.
Equation (24) and Equation (23) are not equivalent. The two-step CAT16 in Equation (23) is reversible; the one in (24) is not.
A supplementary paper discussing CAT16 mentions this issue: among the four permutations of forward/inverse in the two-step method, only two are transitive and reversible. One of those was adopted—forward first, then inverse—which is the Equation (23) above.
Li, C.; Xu, Y.; Wang, Z.; Luo, M. R.; Cui, G.; Melgosa, M.; Brill, M. H.; Pointer, M. Comparing Two‐step and One‐step Chromatic Adaptation Transforms Using the CAT16 Model. colour Research & Application 2018, 43 (5), 633–642. https://doi.org/10.1002/col.22226.
Here comes the code
I previously said I would open-source some code examples I used, but as I kept writing, it turned into a draft notebook. Now I’ve opened a new repository specifically for storing the code examples used in the blog. This is the first post with attached code.
There are two files:
cat16_comparison.py
: compares the reversibility of one-step and two-step methods.cat16_paper_implementation.py
: the two-step implementation and test case from the paper’s appendix (done by Gemini)
Open-source address: JacksBlog Examples: 01