Which eight perspective coefficients encode an identity warp?

A perspective warp divides two linear numerators by the same coordinate-dependent denominator. A constant unit denominator permits an affine mapping.

Pixel experiment and interpretation

Start with an identity warp to check that the sampling pipeline retains source values before substituting calibration coefficients. Pillow needs an output-to-input mapping.

from PIL import Image

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

im=row([3,6,9])
out=im.transform(im.size,Image.Transform.PERSPECTIVE,(1,0,0,0,1,0,0,0))
list(out.tobytes())

Result [3, 6, 9]

中文

透视变换的八个系数怎样表达恒等映射?

透视映射对两个线性分子共用一个坐标相关的分母;分母恒为一时可退化为仿射映射。

像素实验与适用边界

先用单位映射检查采样链能否保留原像素,再换上标定系数。Pillow 需要从输出回到输入的映射。

from PIL import Image

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

im=row([3,6,9])
out=im.transform(im.size,Image.Transform.PERSPECTIVE,(1,0,0,0,1,0,0,0))
list(out.tobytes())

结果 [3, 6, 9]

References / 参考来源

Keep reading / 继续阅读