# Determine transformation from set of points

I have unknown perspective transformation matrix and unknown coordinates of the points in xy-space, but have coordinates of the points in uv-space and know that some points have the same distance dx,dy in xy-space.

for example I have 5 same quadrangle

before transformation

and after transformation

I have uv-coordinates of apexes and I want to determine the transformation.

is it possible?

is it possible if I have more complicated transform: perspective transform + barrel/pincushion distortion or transfrom that I don't know.

what I already tried to do.

Code in Mathematica with numeric unput.

u1 = 60.5 ; u2 = 71; u3 = 172; u4 = 178; u5 = 21.5; u6 = 35.9; u7 =
130; u8 = 139; u9 = 148; u10 = 157;
v1 = 102; v2 = 62.9; v3 = 80.4; v4 = 37.1; v5 = 250; v6 = 197; v7 =
186; v8 = 133; v9 = 243; v10 = 183;
NSolve[u1 == (m13 + m11 x1 + m12 y1)/(1 + m31 x1 + m32 y1) &&
v1 == (m23 + m21 x1 + m22 y1)/(1 + m31 x1 + m32 y1) &&
u2 == (m13 + m11 x2 + m12 y2)/(1 + m31 x2 + m32 y2) &&
v2 == (m23 + m21 x2 + m22 y2)/(1 + m31 x2 + m32 y2) &&
u3 == (m13 + m11 x3 + m12 y3)/(1 + m31 x3 + m32 y3) &&
v3 == (m23 + m21 x3 + m22 y3)/(1 + m31 x3 + m32 y3) &&
u4 == (m13 + m11 x4 + m12 y4)/(1 + m31 x4 + m32 y4) &&
v4 == (m23 + m21 x4 + m22 y4)/(1 + m31 x4 + m32 y4) &&
u5 == (m13 + m11 x5 + m12 y5)/(1 + m31 x5 + m32 y5) &&
v5 == (m23 + m21 x5 + m22 y5)/(1 + m31 x5 + m32 y5) &&
u6 == (m13 + m11 x6 + m12 y6)/(1 + m31 x6 + m32 y6) &&
v6 == (m23 + m21 x6 + m22 y6)/(1 + m31 x6 + m32 y6) &&
u7 == (m13 + m11 x7 + m12 y7)/(1 + m31 x7 + m32 y7) &&
v7 == (m23 + m21 x7 + m22 y7)/(1 + m31 x7 + m32 y7) &&
u8 == (m13 + m11 x8 + m12 y8)/(1 + m31 x8 + m32 y8) &&
v8 == (m23 + m21 x8 + m22 y8)/(1 + m31 x8 + m32 y8) &&
u9 == (m13 + m11 x9 + m12 y9)/(1 + m31 x9 + m32 y9) &&
v9 == (m23 + m21 x9 + m22 y9)/(1 + m31 x9 + m32 y9) &&
u10 == (m13 + m11 x10 + m12 y10)/(1 + m31 x10 + m32 y10) &&
v10 == (m23 + m21 x10 + m22 y10)/(1 + m31 x10 + m32 y10) &&
dx == x2 - x1 && dx == x4 - x3 && dx == x6 - x5 && dx == x8 - x7 &&
dx == x10 - x9 && dy == y2 - y1 && dy == y4 - y3 && dy == y6 - y5 &&
dy == y8 - y7 && dy == y10 - y9
, {dx, dy, m11, m12, m13, m21, m22, m23, m31, m32,
x1, x2, x3, x4, x5, x6, x7, x8, x9, x10,
y1, y2, y3, y4, y5, y6, y7, y8, y9, y10}]


but I can't get answer. maybe there is more advanced or specified numeric method exist?

UPDATE:

I understand that if we have Affine transform, we can't get transfromation matrix, but for Perspective transform I still not sure.

-