How does a grayscale transmission map attenuate an image?

multiply multiplies corresponding channels and normalizes by full scale; white leaves the input intact.

Pixel experiment and interpretation

Make half a filter partially transmissive and the other half clear. This illustrates attenuation; quantitative optics also needs linear-light values.

from PIL import Image, ImageChops

def row(values):
    return Image.frombytes('L', (len(values), 1), bytes(values))

list(ImageChops.multiply(row([200,200]),row([128,255])).tobytes())

Result [100, 200]

中文

如何用灰度透射率图衰减图像?

multiply 把两个通道值相乘再按满量程归一化,白色作为不衰减的因子。

像素实验与适用边界

让一段滤片透光一半,另一段全透。结果适合展示衰减;定量光学计算还需在线性光空间进行。

from PIL import Image, ImageChops

def row(values):
    return Image.frombytes('L', (len(values), 1), bytes(values))

list(ImageChops.multiply(row([200,200]),row([128,255])).tobytes())

结果 [100, 200]

References / 参考来源

Keep reading / 继续阅读