我正在尝试使用Kloss和Kloss在“使用NumPy进行N维线性向量场回归”(2010,Python论文源代码2)中给出的解决方案,给出给定两点的二维仿射变换。
他们提供了一种方法来查找连接两组点y和x的仿射变换, 其中该变换由矩阵A和向量b表示(即矩阵方程y = Ax + b)。
在二维中,您有6个未知数,其中四个定义2x2 A矩阵,另外2个定义b。
但是,在示例脚本和描述它的论文中,它们具有未知数t = n ^ 2 + n,其中n是点的数量,这意味着您需要六个点,对于2D情况,它实际上是12个已知值(即x和图像上每个点的y值)。
他们通过以下方式对此进行了测试:
def solve(point_list):
"""
This function solves the linear equation system involved in the n
dimensional linear extrapolation of a vector field to an arbitrary point.
f(x) = x * A + b
with:
A - The "slope" of the affine function in an n …Run Code Online (Sandbox Code Playgroud)