## 2. 算法描述

• $RGB$空间$\rightarrow$ $XYZ$空间
$$\begin{pmatrix} X\\Y\\Z \end{pmatrix}= \begin{pmatrix} 0.5141&0.3239&0.1604\\ 0.2651&0.6702&0.0641\\ 0.0241&0.1228&0.8444 \end{pmatrix} \begin{pmatrix} R\\G\\B \end{pmatrix}$$

• $XYZ$空间$\rightarrow$ $LMS$空间
$$\begin{pmatrix} L\\M\\S \end{pmatrix}= \begin{pmatrix} 0.3897&0.6890&-0.0787\\ -0.2298&1.1834&0.0464\\ 0.0000&0.0000&1.0000 \end{pmatrix} \begin{pmatrix} X\\Y\\Z \end{pmatrix}$$

• 变换到对数空间
\begin{aligned} \pmb L&=\lg L\\ \pmb M&=\lg M\\ \pmb S&=\lg S \end{aligned}

• $\pmb{LMS}$空间$\rightarrow$ $l\alpha\beta$空间
$$\begin{pmatrix} l\\\alpha\\\beta \end{pmatrix}= \begin{pmatrix} \frac{1}{\sqrt{3}}&0&0\\ 0&\frac{1}{\sqrt{6}}&0\\ 0&0&\frac{1}{\sqrt{2}} \end{pmatrix} \begin{pmatrix} 1&1&1\\ 1&1&-2\\ 1&-1&0 \end{pmatrix} \begin{pmatrix} \pmb L\\\pmb M\\\pmb S \end{pmatrix}$$

\begin{aligned} l’&=\frac{\sigma_t^l}{\sigma_s^l}(l-\mu^l_s)+\mu^l_t\\ \alpha’&=\frac{\sigma_t^\alpha}{\sigma_s^\alpha}(\alpha-mu^\alpha_s)+\mu^\alpha_t\\ \beta’&=\frac{\sigma_t^\beta}{\sigma_s^\beta}(\beta-\mu^\beta_s)+\mu^\beta_t\ \end{aligned}

## 参考文献

[1] E. Reinhard, M. Adhikhmin, B. Gooch, and P. Shirley. Color transfer between images. IEEE Computer graphics and applications, 21(5):34–41, 2001.10