【7参数转换】三维空间坐标相似变换

一、最小二乘法旋转参数确定

1.模型-空间相似变换

X = X 0 + m ⋅ R ⋅ x → [ X Y Z ] = [ X 0 Y 0 Z 0 ] + m ⋅ [ r 11 r 12 r 13 r 21 r 22 r 23 r 31 r 32 r 33 ] ⋅ [ x y z ] X=X_0+m· R· x \\ \rightarrow \left[ \begin{matrix} X\\Y\\Z \end{matrix} \right] = \left[ \begin{matrix} X_0\\Y_0\\Z_0 \end{matrix} \right]+m · \left[ \begin{matrix} r_{11} \quad r_{12} \quad r_{13} \\ r_{21} \quad r_{22} \quad r_{23} \\ r_{31} \quad r_{32} \quad r_{33} \end{matrix} \right]·\left[ \begin{matrix} x\\y\\z \end{matrix} \right] X=X0+mRx XYZ = X0Y0Z0 +m r11r12r13r21r22r23r31r32r33 xyz

其中 R R R为旋转矩阵, m m m为尺度参数, [ X 0 , Y 0 , Z 0 ] ′ [X_0,Y_0,Z_0]' [X0,Y0,Z0]是平移参数,一共有7个。

2.旋转矩阵 R R R

旋转矩阵的确定有两种方式,一种是利用旋转角进行确定,另一种是通过4参数附加一个约束进行确定。

2.1 旋转角确定Rotation matrix using trigonometric functions

R = R ω ⋅ R φ ⋅ R κ = [ c o s κ − s i n κ 0 s i n κ − c o s κ 0 0 0 1 ] ⋅ [ c o s φ 0 − s i n φ 0 1 0 − s i n φ 0 c o s φ ] ⋅ [ 1 0 0 0 c o s ω − s i n ω 0 s i n ω c o s ω ] = [ r 11 r 12 r 13 r 21 r 22 r 23 r 31 r 32 r 33 ] = [ c o s φ c o s κ − c o s φ s i n κ s i n φ c o s ω s i n κ + s i n ω s i n φ c o s κ c o s ω c o s κ − s i n ω s i n φ s i n κ − s i n ω cos ⁡ φ s i n ω s i n κ − c o s ω sin ⁡ φ cos ⁡ κ s i n ω cos ⁡ κ + cos ⁡ ω sin ⁡ φ sin ⁡ κ c o s ω cos ⁡ φ ] R = R_\omega · R_\varphi · R_\kappa \\ =\left[ \begin{matrix} cos\kappa\quad -sin\kappa\quad 0 \\ sin\kappa\quad -cos\kappa\quad 0 \\ 0\quad\qquad 0 \quad\qquad 1 \end{matrix} \right] · \left[ \begin{matrix} cos\varphi\quad 0 \quad -sin\varphi \\ 0 \quad\qquad 1\quad\qquad 0 \\ -sin\varphi\quad\qquad 0 \quad\qquad cos\varphi \end{matrix} \right] ·\left[ \begin{matrix} 1 \qquad\quad 0\qquad\quad 0 \\ 0\quad cos\omega\quad -sin\omega \\ 0\quad sin\omega \quad cos\omega \end{matrix} \right] \\ = \left[ \begin{matrix} r_{11} \quad r_{12} \quad r_{13} \\ r_{21} \quad r_{22} \quad r_{23} \\ r_{31} \quad r_{32} \quad r_{33} \end{matrix} \right]\\= \left[ \begin{matrix} cos\varphi cos\kappa \quad -cos\varphi sin\kappa \quad sin\varphi \\ cos\omega sin\kappa + sin\omega sin\varphi cos\kappa \quad cos\omega cos\kappa-sin\omega sin\varphi sin\kappa \quad -sin\omega\cos\varphi \\ sin\omega sin\kappa-cos\omega\sin\varphi\cos\kappa \quad sin\omega\cos\kappa+\cos\omega\sin\varphi\sin\kappa \quad cos\omega\cos\varphi \end{matrix} \right] R=RωRφRκ= cosκsinκ0sinκcosκ0001 cosφ0sinφ010sinφ0cosφ 1000cosωsinω0sinωcosω = r11r12r13r21r22r23r31r32r33 = cosφcosκcosφsinκsinφcosωsinκ+sinωsinφcosκcosωcosκsinωsinφsinκsinωcosφsinωsinκcosωsinφcosκsinωcosκ+cosωsinφsinκcosωcosφ

其中 κ \kappa κ是绕Z轴逆时针旋转的角度, φ \varphi φ是绕Y轴逆时针旋转的角度,中 ω \omega ω是绕X轴逆时针旋转的角度。

2.2代数参数确定Rotation matrix using algebraic functions

四参数的方法:
R = [ d 2 + a 2 − b 2 − c 2 2 ( a b − c d ) 2 ( a c + b d ) 2 ( a b + c d ) d 2 − a 2 + b 2 − c 2 2 ( b c − a d ) 2 ( a c − b d ) 2 ( b c + a d ) d 2 − a 2 − b 2 + c 2 ] R=\left[ \begin{matrix} d^2+a^2-b^2-c^2 \quad 2(ab-cd)\quad 2(ac+bd)\\2(ab+cd) \quad d^2-a^2+b^2-c^2 \quad 2(bc-ad)\\2(ac-bd)\quad2(bc+ad)\quad d^2-a^2-b^2+c^2 \end{matrix} \right] R= d2+a2b2c22(abcd)2(ac+bd)2(ab+cd)d2a2+b2c22(bcad)2(acbd)2(bc+ad)d2a2b2+c2
其中有一个约束条件 m = a 2 + b 2 + c 2 + d 2 = 1 m=a^2+b^2+c^2+d^2=1 m=a2+b2+c2+d2=1

在四参数与几何旋转角 κ 、 φ 、 ω \kappa、\varphi、\omega κφω之间的转换可以根据旋转矩阵 R R R唯一,从而一一对应出结果:
c o s φ ⋅ s i n κ = 2 ( d c − a b ) c o s φ ⋅ c o s κ = d 2 + a 2 − b 2 − c 2 c o s φ ⋅ s i n ω = 2 ( d a − b c ) c o s φ ⋅ c o s ω = d 2 − a 2 − b 2 + c 2 s i n φ = 2 ( a c + b d ) cos\varphi · sin\kappa = 2(dc-ab) \\ cos\varphi · cos\kappa = d^2+a^2-b^2-c^2 \\ cos\varphi · sin\omega = 2(da-bc) \\ cos\varphi · cos\omega = d^2 -a^2-b^2+c^2 \\ sin\varphi = 2(ac+bd) cosφsinκ=2(dcab)cosφcosκ=d2+a2b2c2cosφsinω=2(dabc)cosφcosω=d2a2b2+c2sinφ=2(ac+bd)
四参数转换的优势在于无需使用三角函数、简化了计算过程和并且 具有较快的收敛,无奇异点。In summary, a rotation matrix with algebraic functions offers the following benefits: 1. no use of trigonometric functions, 2. simplified computation of the design matrix and faster convergence in adjustment systems, 3.no singularities, 4.faster computation by avoiding power series for internal trigonometric calculations.

3.平差模型

在进行某一坐标系点位 ( x , y , z ) (x,y,z) (x,y,z)到另一坐标系点位 ( X , Y , Z ) (X,Y,Z) (X,Y,Z)的转换过程中,由于只需要7个参数,所以对应点位数目只需要 3个就可实现。本次编程实现,采用四参数模型作为旋转矩阵的确定方式,参与最小二乘确定最终的参数,因为四个参数之间存在约束,所以平差模型选用附有约束条件的间接平差方法。原理为:
观测量误差方程: A ⋅ x ^ − l = v 约束条件方程: B ⋅ x ^ + w = 0 G a u s s − M a r k o v 模型的条件: v T ⋅ P ⋅ v + 2 k ⋅ ( B ⋅ x ^ + w ) → m i n 结果: [ A T ⋅ P ⋅ A B T B 0 ] ⋅ [ x ^ k ] + [ − A T ⋅ P ⋅ l w ] = 0 观测量误差方程:A·\hat x-l = v \\ 约束条件方程:B·\hat x + w =0 \\ Gauss-Markov模型的条件:v^T · P ·v + 2k·(B·\hat x + w) \rightarrow min \\ 结果:\left[\begin{matrix}A^T· P ·A \qquad B^T\\B \qquad\qquad 0 \end{matrix}\right]·\left[\begin{matrix}\hat x \\ k \end{matrix}\right] + \left[\begin{matrix} -A^T· P ·l\\w \end{matrix}\right]=0 观测量误差方程:Ax^l=v约束条件方程:Bx^+w=0GaussMarkov模型的条件:vTPv+2k(Bx^+w)min结果:[ATPABTB0][x^k]+[ATPlw]=0
所以 x ^ \hat x x^的计算只需要对系数矩阵求逆乘上后一个矩阵进而取前8个参数( X 0 , Y 0 , Z 0 , m , a , b , c , d X_0,Y_0,Z_0,m,a,b,c,d X0,Y0,Z0,m,a,b,c,d)即可。

其中
A i = [ 1 0 0 y ( 2 a b − 2 c d ) + z ( 2 a c + 2 b d ) + x ( a 2 − b 2 − c 2 + d 2 ) m ( 2 a x + 2 b y + 2 c z ) m ( 2 a y − 2 b x + 2 d z ) − m ( 2 c x − 2 a z + 2 d y ) m ( 2 b z − 2 c y + 2 d x ) 0 1 0 x ( 2 a c − 2 b d ) − z ( 2 a d − 2 b c ) − y ( a 2 − b 2 + c 2 − d 2 ) − m ( 2 a y − 2 c x + 2 d z ) m ( 2 b y − 2 d x + 2 c z ) m ( 2 a x + 2 b z − 2 c y ) − m ( 2 b x + 2 a z − 2 d y ) 0 0 1 x ( 2 a c − 2 b d ) + y ( 2 a d + 2 b c ) − z ( a 2 + b 2 − c 2 − d 2 ) m ( 2 c x − 2 a z + 2 d y ) − m ( 2 b z − 2 c y + 2 d x ) m ( 2 a x + 2 b y + 2 c z ) m ( 2 a y − 2 b x + 2 d z ) ] A_i = \left[\begin{matrix} 1 \quad 0 \quad 0 \quad y(2ab - 2cd) + z(2ac + 2bd) + x(a^2 - b^2 - c^2 + d^2) \quad m(2ax + 2by + 2cz)\quad m(2ay - 2bx + 2dz)\quad -m(2cx - 2az + 2dy) \quad m(2bz - 2cy + 2dx) \\ 0 \quad 1 \quad 0 \quad x(2ac - 2bd) - z(2ad - 2bc) - y(a^2 - b^2 + c^2 - d^2) \quad -m(2ay - 2cx + 2dz) \quad m(2by - 2dx + 2cz) \quad m(2ax + 2bz - 2cy) \quad -m(2bx + 2az - 2dy) \\ 0 \quad 0 \quad 1 \quad x(2ac - 2bd) + y(2ad + 2bc) - z(a^2 + b^2 - c^2 - d^2) \quad m(2cx - 2az + 2dy) \quad -m(2bz - 2cy + 2dx) \quad m(2ax + 2by + 2cz) \quad m(2ay - 2bx + 2dz) \end{matrix}\right] Ai= 100y(2ab2cd)+z(2ac+2bd)+x(a2b2c2+d2)m(2ax+2by+2cz)m(2ay2bx+2dz)m(2cx2az+2dy)m(2bz2cy+2dx)010x(2ac2bd)z(2ad2bc)y(a2b2+c2d2)m(2ay2cx+2dz)m(2by2dx+2cz)m(2ax+2bz2cy)m(2bx+2az2dy)001x(2ac2bd)+y(2ad+2bc)z(a2+b2c2d2)m(2cx2az+2dy)m(2bz2cy+2dx)m(2ax+2by+2cz)m(2ay2bx+2dz)

B = [ 0 0 0 0 2 a 2 b 2 c 2 d ] B=\left[0 \quad 0 \quad 0 \quad 0 \quad 2a \quad 2b \quad 2c \quad 2d \quad \right] B=[00002a2b2c2d]

w = a ~ 2 + b ~ 2 + c ~ 2 + d ~ 2 − 1 w=\tilde a^2 + \tilde b^2 + \tilde c^2 + \tilde d^2-1 w=a~2+b~2+c~2+d~21

l = [ X Y Z ] − m ~ ⋅ R ~ ⋅ [ x y z ] − [ X ~ 0 Y ~ 0 Z ~ 0 ] l=\left[ \begin{matrix} X\\Y\\Z \end{matrix} \right] - \tilde m · \tilde R · \left[ \begin{matrix} x\\y\\z \end{matrix} \right] - \left[ \begin{matrix} \tilde X_0\\\tilde Y_0\\\tilde Z_0 \end{matrix} \right] l= XYZ m~R~ xyz X~0Y~0Z~0

其中参数上方的波浪线表示参数的近似值。通过不断迭代,当参数的改正数小于某个阈值时停止迭代即可。

4.参数近似值的计算

由于存在平差模型是否收敛的问题,所以参数的近似值不能够随意选取,需要尽可能接近真实值,所以需要对参数的初始近似值进行获取。此处获取需要才用到中间坐标系,但总的来说,可以通过3个对应点组通过计算获取。在这里插入图片描述
旋转矩阵的获取需要用到计算正交矩阵:在这里插入图片描述
在这里插入图片描述在这里插入图片描述
通过以上方法,可以获取到旋转矩阵的近似值和其他四个参数的近似值,于是可以计算出 l l l矩阵,收敛性质较好。

5.算例

在这里插入图片描述

6.其他基础知识

6.1叉乘公式在这里插入图片描述
6.2由旋转矩阵 R R R推四元数

在这里插入图片描述
对应 d d d x x x对应 a a a y y y对应 b b b z z z对应 c c c

7.程序实现。

【7参数转换】三维空间坐标相似变换
程序结果呈现。
在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

狮子的心脏

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值