我有两张图片:
使用cv2.findTransformECC (im1,im2,warp_matrix, warp_mode, criteria)
我得到了这个转换矩阵:
[[ 0.70637488 0.70783788 -86.60842133]
[ -0.70783788 0.70637488 137.01171875]]
如何使用该矩阵找到图像转向的点?
以下是矩阵代表的内容:
我知道我可以使用X,Y平移的斜边以及旋转角来计算等腰三角形。但是我怎样才能使用等腰三角形(红色)来找到翻译中心的X和Y(绿色)?三角法是否是找到轴心点的唯一方法?
答案 0 :(得分:4)
So you have a transformation matrix
/ a b tx \
\ c d ty /
And you want to convert this to a representation of a rotation about some pivot. A rotation about a pivot (px, py)
can be expressed as
T = T(p) R T(-p)
If you expand this, you get
/ a b tx \ = / a b px-apx-bpy \
\ c d ty / \ c d py-cpx-dpy /
The first 2x2 matrix is already equal if you choose the same rotation. The last column gives you a linear system of equations. The general solution of this is (disregarding special cases):
px = (tx - d tx + b ty) / (a + b c + d - a d - 1)
py = (ty + c tx - a ty) / (a + b c + d - a d - 1)
For your matrix, this gives:
px = 121.842
py = 172.899