## 色坐标的由来

• chromaticity 色度
• Gamut 色域
• hue
• saturation
• lightness
• brightness

### LMS Color Space

LMS color space存在的问题：由于三色cone cell响应曲线存在重叠，所以想得到$$(0,1,0)$$坐标的颜色是不可能的。A problematic side effect of this fact is that it's really difficult to increase stimulation of only one of the cones. This, in particular, would make it not a great candidate for building display hardware. Another historical, pragmatic problem was that the cone sensitivities weren’t accurately known until the 1990's, and a need to develop a mathematically precise model of color significantly predates that. The first significant progress on that front came about in the late 1920's.

### RGB Color Space

Wright & Guild’s color matching experiments：上面的三个灯是单色的，blue和green灯来自Na灯，700 nm来源不知道，应该也是单色的。调节这三个灯的功率使得混合后的颜色和目标波长(下面的灯，应该也是单色的)的颜色匹配。不断变换下面灯的波长，分别测出对应的三色灯的成分比例，于是可以构建color matching functions(CMFs)，即$$\bar{r}(\lambda), \bar{g}(\lambda)$$, and $$\bar{b}(\lambda)$$。

Wright & Guild’s color matching experiments的实验是针对单色光，对于一个宽带光谱而言，也可以得到rgb数值，只需要将光谱和CMFs相乘，然后求积分面积即可。用这种方法处理我们之前的柠檬色，如下图：

### Visualizing color spaces & chromaticity

x

rg chromaticity图可以有不同的intensities (lightness)，比如下图，相同的位置在两个图中代表的颜色是相同的，决定颜色的只是三个数值的比例。

Chromaticity is a useful property of a color to consider because it stays constant as the intensity of a light source changes, so long as the light source retains the same spectral distribution (此处不那么严谨). As you change the brightness of your screen, chromaticity is the thing that stays constant!

### CIE XYZ Color Space

If we take our color matching functions $$\bar{r}(\lambda), \bar{g}(\lambda)$$, and $$\bar{b}(\lambda)$$ and use them to plot the rg chromaticities of the spectral colors, we end up with a plot like this:

The black curve with the colorful dots on it shows the chromaticities of all the pure spectral colors. The curve is called the spectral locus(光谱轨迹). 光谱轨迹内的区域代表了人类可见的所有色度。The stars mark the wavelengths of the variable power test lamps used in the color matching experiments.

In 1931, the International Comission on Illumination convened and created two color spaces. 一个是我们之前讨论过的RGB Color Space，一个就是XYZ Color Space。采用XYZ Color Space的一个好处就是have positive values for all human visible colors, and therefore have all chromaticities fit in the range [0, 1] on both axes. To achieve this, a linear transformation of RGB space was carefully selected. $$\left[\begin{array}{l} X \\ Y \\ Z \end{array}\right]=\frac{1}{b_{21}}\left[\begin{array}{lll} b_{11} & b_{12} & b_{13} \\ b_{21} & b_{22} & b_{23} \\ b_{31} & b_{32} & b_{33} \end{array}\right]\left[\begin{array}{l} R \\ G \\ B \end{array}\right]=\frac{1}{0.17697}\left[\begin{array}{ccc} 0.49 & 0.31 & 0.20 \\ 0.17697 & 0.81240 & 0.01063 \\ 0.00 & 0.01 & 0.99 \end{array}\right]\left[\begin{array}{l} R \\ G \\ B \end{array}\right]$$

### Gamma Correction

XXX

Gamma 校正的幂函数曲线来自于心理学上的韦伯-费希纳定律(Weber-Fechner Law)或斯蒂文思幂定律(stevens'power law)，关于这两个定律，我们在讨论dB分贝的时候已经拓展过，这里不赘述。

Color seems objective at the strat but the way we decribe color might end up needing a little bit brainlike than we might think.

Gamma校正与线性工作流入门讲解-B站

## 图像类型

(1) RGB 也就是传统的每个点由(x, y, z)组成，三个数的取值都在0到255之间。
(2) RGBA是一种色彩空间的模型，由RGB色彩空间和Alpha通道(透明度，从完全透明的0%到完全不透明的100%)组成，如下图所示。

(3) CMYK，印刷四色模式是彩色印刷时采用的一种套色模式，利用色料的三原色混色原理，加上黑色油墨，共计四种颜色混合叠加，形成所谓“全彩印刷”。四种标准颜色是：C：Cyan = 青色，又称为‘天蓝色’或是‘湛蓝’；M：Magenta = 品红色，又称为‘洋红色’；Y：Yellow = 黄色；K：blacK=黑色。
(4) YCbCr
(5) 其他的还有像素1位的图(白和纯黑)，灰度图(不同程度的黑)等等。

(1) 位图

(1) PIL库中图像的mode参数
(2) 加色模式、减色模式与色相环的关系是什么？
(3) 位图和矢量图你分的清么？

## PIL库的常用操作

(1) Python PIL库进行图像处理
(2) PIL/Pillow的安装
(3) Pillow官方文档

Python PIL图像处理