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

推荐订阅源

Simon Willison's Weblog
Simon Willison's Weblog
Help Net Security
Help Net Security
P
Privacy International News Feed
T
Threat Research - Cisco Blogs
C
Cisco Blogs
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
L
LINUX DO - 热门话题
Security Latest
Security Latest
A
Arctic Wolf
G
GRAHAM CLULEY
月光博客
月光博客
S
Securelist
D
Docker
J
Java Code Geeks
T
Troy Hunt's Blog
T
Tenable Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
SecWiki News
SecWiki News
S
Security @ Cisco Blogs
量子位
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
L
LINUX DO - 最新话题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
aimingoo的专栏
aimingoo的专栏
博客园 - 【当耐特】
H
Heimdal Security Blog
The Hacker News
The Hacker News
博客园 - 三生石上(FineUI控件)
Application and Cybersecurity Blog
Application and Cybersecurity Blog
N
Netflix TechBlog - Medium
Vercel News
Vercel News
Forbes - Security
Forbes - Security
B
Blog RSS Feed
H
Hackread – Cybersecurity News, Data Breaches, AI and More
IT之家
IT之家
B
Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
S
Secure Thoughts
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
Check Point Blog
云风的 BLOG
云风的 BLOG
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
T
The Blog of Author Tim Ferriss
L
Lohrmann on Cybersecurity
F
Full Disclosure
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Proofpoint News Feed

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.