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

推荐订阅源

V
Vulnerabilities – Threatpost
U
Unit 42
F
Fortinet All Blogs
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
F
Full Disclosure
月光博客
月光博客
Engineering at Meta
Engineering at Meta
博客园_首页
The Register - Security
The Register - Security
G
Google Developers Blog
The Cloudflare Blog
博客园 - Franky
K
Kaspersky official blog
A
Arctic Wolf
Scott Helme
Scott Helme
C
Cisco Blogs
Hugging Face - Blog
Hugging Face - Blog
C
Check Point Blog
NISL@THU
NISL@THU
AI
AI
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Stack Overflow Blog
Stack Overflow Blog
Project Zero
Project Zero
The GitHub Blog
The GitHub Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
Vercel News
Vercel News
T
Tor Project blog
P
Privacy International News Feed
D
Docker
I
Intezer
L
LangChain Blog
P
Proofpoint News Feed
Security Latest
Security Latest
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
博客园 - 聂微东
AWS News Blog
AWS News Blog
Martin Fowler
Martin Fowler
P
Privacy & Cybersecurity Law Blog
V
V2EX
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
The Hacker News
The Hacker News
T
Tenable Blog
Blog — PlanetScale
Blog — PlanetScale
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog

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.