How can a 3D lookup table swap red and blue?

Color3DLUT maps a point in three-channel color space through an interpolated table, allowing cross-channel transforms.

Pixel experiment and interpretation

Treat color as an address inside a cube and swap red and blue at each vertex. A calibration LUT needs the same input color space as the footage.

from PIL import Image, ImageFilter

lut=ImageFilter.Color3DLUT.generate(2,lambda r,g,b:(b,g,r))
Image.new('RGB',(1,1),(10,50,200)).filter(lut).getpixel((0,0))

Result (200, 50, 10)

中文

三维查找表如何同时交换红蓝两个通道?

Color3DLUT 根据输入的三个颜色坐标查表并插值,可表达跨通道的颜色映射。

像素实验与适用边界

把输入颜色当作立方体中的地址,让每个顶点返回相反顺序的红蓝值。相机校色时,表格的输入色域必须与素材一致。

from PIL import Image, ImageFilter

lut=ImageFilter.Color3DLUT.generate(2,lambda r,g,b:(b,g,r))
Image.new('RGB',(1,1),(10,50,200)).filter(lut).getpixel((0,0))

结果 (200, 50, 10)

References / 参考来源

Keep reading / 继续阅读