四元数的理解与应用

Last updated on：a year ago

定义

$$q = a + b\mathbf{i} + c\mathbf{j} + d\mathbf{k}, a,b,c,d \in R$$

$$\mathbf{i}^2 = \mathbf{j}^2 = \mathbf{k}^2 = -1$$

$$\mathbf{i}\mathbf{j} = -\mathbf{j}\mathbf{i} = \mathbf{k}, \mathbf{j}\mathbf{k} = -\mathbf{k}\mathbf{j} = \mathbf{i}, \mathbf{k}\mathbf{i} = -\mathbf{k}\mathbf{i} = \mathbf{j}$$

$$Q = {a + b\mathbf{i} + c\mathbf{j} + d\mathbf{k} | a,b,c,d \in R}$$

特性

• 四元数相加：

$$(a_{1}+b_{1},\mathbf {i} +c_{1},\mathbf {j} +d_{1},\mathbf {k} )+(a_{2}+b_{2},\mathbf {i} +c_{2},\mathbf {j} +d_{2},\mathbf {k} ) =$$

$$(a_{1}+a_{2})+(b_{1}+b_{2}),\mathbf {i} +(c_{1}+c_{2}),\mathbf {j} +(d_{1}+d_{2}),\mathbf {k}$$

• 乘以一个系数：

$$\lambda (a+b,\mathbf {i} +c,\mathbf {j} +d,\mathbf {k} )=\lambda a+ \lambda b ,\mathbf {i} + \lambda c,\mathbf {j} + \lambda d ,\mathbf {k}$$

• 倒数：

$$(a+b,\mathbf {i} +c,\mathbf {j} +d,\mathbf {k} )^{-1} = {\frac{1}{a^{2} + b^{2} + c^{2} + d^{2}}}, (a-b,\mathbf {i} -c,\mathbf {j} -d,\mathbf {k} )$$

• 方向向量为单位向量，两两正交。
• 两个四元数的乘积（哈密尔顿乘积 Hamilton product）:

$$q_1 q_2 = ( a 1 + b 1\mathbf{i} + c 1\mathbf{j} + d 1\mathbf{k}) ( a 2 + b 2\mathbf{i} + c 2\mathbf{j} + d 2\mathbf{k})$$

$$q_1 q_2 = -(q_1 \dot q_2) + (q_1 \times q_2)$$

• 绝对值：

$$|q| = \sqrt{q q^{*}} = \sqrt {q^* q} = \sqrt{ a^{2} + b^{2} + c^{2} + d^{2} }$$

• 共轭：

$$q^* = a - b\mathbf{i} - c\mathbf{j} - d\mathbf{k}$$

应用

刚体位姿描述

$$\mathbf{Q} =\eta + \varepsilon_x \mathbf{i} + \varepsilon_y \mathbf{j} + \varepsilon_z \mathbf{k} = [\eta , \mathbf{\varepsilon}]= [\eta\ \varepsilon_x\ \varepsilon_y\ \varepsilon_z]^T$$

RGB坐标系

$$\mathbf{p} = \mathbf{\omega}\mathbf{q}\mathbf{\omega} ^*$$

$$\mathbf{\omega} = cos\frac{\theta}{2} + sin\frac{\theta}{2}(\omega_1 \mathbf{i} + omega_2 \mathbf{j} + omega_3 \mathbf{k})$$

参考资料

[1] Quaternion

[2] 李文亮，四元数矩阵，国防科技大学出版社

[3] Pervin, E. and Webb, J.A., 1982. Quaternions in computer vision and robotics. CARNEGIE-MELLON UNIV PITTSBURGH PA DEPT OF COMPUTER SCIENCE.

[4] Zhu, X., Xu, Y., Xu, H. and Chen, C., 2018. Quaternion convolutional neural networks. In Proceedings of the European Conference on Computer Vision (ECCV) (pp. 631-647).