Why do pure green and pure blue yield different grayscale values?
The default RGB-to-L conversion uses a weighted sum in which green carries more weight than blue.
Pixel experiment and interpretation
Two lamps can each saturate one channel yet give different grayscale readings. Measuring radiometric intensity also requires color-space and sensor calibration.
from PIL import Image
[Image.new('RGB',(1,1),c).convert('L').getpixel((0,0)) for c in ('lime','blue')]Result [150, 29]
中文
为什么纯绿和纯蓝转灰度后亮度不同?
RGB 转 L 时 Pillow 默认按不同权重混合红绿蓝,绿色的权重较大。
像素实验与适用边界
两盏灯各把一个通道调到最大,灰度读数仍不同。需要物理辐射强度时,应先确认色彩空间及传感器标定。
from PIL import Image
[Image.new('RGB',(1,1),c).convert('L').getpixel((0,0)) for c in ('lime','blue')]结果 [150, 29]