相同SVD处理不同精度点集得到迥异刚体变换矩阵的问题求助
刚体配准SVD求解旋转矩阵的精度相关异常问题
我正在Python中执行刚体变换,将源点集配准到目标点集,要求源点集仅能绕两者共有的第二个点旋转。实现步骤为:减去用户定义的旋转中心(而非质心)对源点集和目标点集进行平移,随后使用np.linalg.svd求解rotation_matrix。
但使用精度不同但本质相同的源点集与目标点集时,得到了完全不同的结果:
第一组点集(低精度)
source_points = np.array([[29.930, 65.059, -692.872], [20.588, 38.868, -675.454], [18.266, 57.316, -682.061]]) target_points = np.array([[27.474, 61.970, -689.958], [20.588, 38.868, -675.454], [15.340, 60.875, -681.762]])
得到的旋转矩阵能实现良好配准:
array([[ 0.99795083, -0.05814411, 0.02670959], [ 0.05909811, 0.99758699, -0.03643628], [-0.02452659, 0.0379401 , 0.99897898]])
第二组点集(高精度,与第一组本质相同)
source_points = np.array([[29.92973456, 65.05863408, -692.87207321], [20.58772087,38.86774826, -675.45440674],[18.2662661, 57.31554544, -682.06144071]]) target_points = np.array([[27.47413063, 61.97033691, -689.95812988], [20.58772087, 38.86774826, -675.45440674], [15.33987617, 60.87537766, -681.76153564]])
得到的旋转矩阵完全不同,且构造的齐次变换矩阵会使源点集发生形变(刚体变换不应出现形变):
array([[ 0.49127036, -0.40722086, -0.76995104], [-0.2900711 , 0.75702601, -0.58546595], [-0.82128691, -0.51096261, -0.25378144]])
齐次变换矩阵构造代码
# translation t = rotation_center.T - np.dot(rotation_matrix, rotation_center.T) # homogeneous transform matrix T = np.identity(4) T[:3, :3] = rotation_matrix T[:3, 3] = t
两组点集仅精度不同,理论上应得到相近结果,恳请帮忙排查错误原因或给出建议。
内容的提问来源于stack exchange,提问作者Chi Zhang
相关产品推荐
相关产品推荐

