惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
博客园 - 【当耐特】
M
MIT News - Artificial intelligence
月光博客
月光博客
博客园_首页
博客园 - 叶小钗
T
Tailwind CSS Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
InfoQ
量子位
小众软件
小众软件
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
IT之家
IT之家
Jina AI
Jina AI
阮一峰的网络日志
阮一峰的网络日志
G
Google Developers Blog
WordPress大学
WordPress大学
人人都是产品经理
人人都是产品经理
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
J
Java Code Geeks
云风的 BLOG
云风的 BLOG
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报

Yi's Blog

三年LLM:过去和未来 《死亡搁浅》玩后感及艺术评论思考 Review on ASUS Zenbook S14 Laptop (LNL) with Linux LLM will NEVER be AGI: The Proof
Color Recreation from First Principles
Yi Cao · 2025-12-08 · via Yi's Blog

Abstract: This article provides a gentle derivation showing the existence of a simple, measurable linear relationship between the LMS color model as in human vision and RAW camera sensor data and the RGB values as in displays and jpg/png/etc. images.

Real world colors are continuous spectra, such as the sunlight spectrum. We can describe it as a continuous function $J(\lambda)$ where $\lambda$ is the wavelength and $J(\lambda)$ is the intensity at that wavelength.

Human eyes have three types of color receptors (cone cells) that are sensitive to different ranges of wavelengths, named L, M, S for long, medium and short wavelengths respectively, loosely corresponding to red, green and blue colors. Represent the responsiveness of these three types of cells as functions $s(\lambda)$ at wavelength $\lambda$, then the perceived intensity of a type of cone cell can be expressed as (take L as an example):

\[L = \int_{-\infty}^\infty J(\lambda) s_L(\lambda) d\lambda\]

and same goes for M and S cells. As long as $\begin{bmatrix} L & M & S \end{bmatrix}$ are the same, the perception will be the same. It is significant not only because it is the basis of human color vision, but also because camera sensors, utilizing Bayer filter or similar technologies, mimic this mechanism to capture colors.

It can be noted that for the same perceived color (fixed $\begin{bmatrix} L_0 & M_0 & S_0 \end{bmatrix}$), there are infinite possible spectra $J(\lambda)$ that can produce the same perception. This is called metamerism which enables modern displays to reproduce or approximate colors with a spectra different from the real world ones. It is also, in fact, true that modern displays (such as LCD, OLED, etc.) work by exploiting this method, namely, they have three kinds of primary color lights red, green and blue that have artificial but fixed spectra, and the ability to adjust the intensity of each primary color. Namely, let $r$, $g$ and $b$ be the intensities of the RGB lights respectively (which happens to be the RGB values we usually read in digital images) and let $J_R(\lambda)$, $J_G(\lambda)$ and $J_B(\lambda)$ be the fixed, artificial spectra of the RGB lights, the overall spectrum emitted by the display can be expressed as:

\[J_\text{display}(\lambda) = r J_R(\lambda) + g J_G(\lambda) + b J_B(\lambda)\]

Consider one kind of cone cell, say L, to recreate $L_0$, we have:

\[\begin{align*} L_0 &= \int_{-\infty}^\infty J_\text{display}(\lambda) s_L(\lambda) d\lambda \\ L_0 &= \int_{-\infty}^\infty \left( r J_R(\lambda) + g J_G(\lambda) + b J_B(\lambda) \right) s_L(\lambda) d\lambda \\ L_0 &= r \int_{-\infty}^\infty J_R(\lambda) s_L(\lambda) d\lambda + g \int_{-\infty}^\infty J_G(\lambda) s_L(\lambda) d\lambda + b \int_{-\infty}^\infty J_B(\lambda) s_L(\lambda) d\lambda \end{align*}\]

Notice how $L_0$ is a linear combination of $\int_{-\infty}^\infty J_R(\lambda) s_L(\lambda) d\lambda$, $\int_{-\infty}^\infty J_G(\lambda) s_L(\lambda) d\lambda$ and $\int_{-\infty}^\infty J_B(\lambda) s_L(\lambda) d\lambda$ with coefficients $r$, $g$ and $b$. These integrals are named as sensitivities of the display primaries to the L cone cell, denoted as $S_{L,R}$, $S_{L,G}$ and $S_{L,B}$ respectively so that $L = r S_{L,R} + g S_{L,G} + b S_{L,B}$. Thus, we can represent the color perception for L, M and S cone cells caused by RGB light intensities in matrix form regarding the sensitivities $\mathbf{S}$:

\[\begin{bmatrix} L \\ M \\ S \end{bmatrix} = \begin{bmatrix} S_{L,R} & S_{L,G} & S_{L,B} \\ S_{M,R} & S_{M,G} & S_{M,B} \\ S_{S,R} & S_{S,G} & S_{S,B} \end{bmatrix} \begin{bmatrix} r \\ g \\ b \end{bmatrix}\]

so that to recreate color perceptions, we only need to calculate:

\[\begin{bmatrix} r \\ g \\ b \end{bmatrix} = \mathbf{S}^{-1} \begin{bmatrix} L \\ M \\ S \end{bmatrix}\]

which is trivial now. And sometimes, the values of $r$, $g$ and $b$ may exceed the display’s capability (for example, negative values or values larger than the maximum intensity), in which case we need to go creative with color management techniques such as tone mapping and gamut mapping to find the best visually-pleasing color that the display can produce.