首页 > 解决方案 > 转换一个刚性变换,使旋转中心不是原点

问题描述

给定一个旋转矩阵R,什么是等价变换,使得某个点c(新的旋转中心)在变换下不变y = R * c,即改变R,使得旋转中心在c原点而不是原点。一个限制是我不能对要使用的实际向量进行操作,只能编辑原始转换(这是因为该部分隐藏在外部库中,我无法更改它)。

我有一些可行的方法,但它违反了上述限制:

import numpy as np

# R is a given rotation matrix, v is an arbitrary vector and cen is the desired center

theta = np.pi / 2
cen = np.array([0.5, 0.5])
v = np.array([0, 0])
R = Rot(theta) # ordinary rotation matrix

y = R @ (v - center ) + cen 

# y = [0, 1] which is the expected result since we have a right angle triangle 
# with vertices at (0, 0) (0.5, 0.5) and (0, 1)

我也尝试实现类似于此处的计算,但我得到的结果不正确

我怎样才能获得相同的结果但保持形式y = R*v(或使用刚性变换y = R*v + t)但v不像我那样改变?

标签: pythonalgorithmimage-processingcomputer-vision

解决方案


在写这个问题时,我遇到了(明显的)解决方案,它只是扩展了我之前写的解决方案并重新排列。如果有人也需要这个,新的转换应该是:

y = R_new*v + t_new

其中R_new = R,是恒等式t_new = (I - R)*cenI


推荐阅读