The mathematical foundation of visual slam the second four-dollar what is four-dollar number
Compared to Euler's angle, the four-tuple (quaternion) is a compact, easy-to-iterate representation that does not present singular values. It is widely used in programs, such as Ros and several well-known slam public datasets, G2O, and other programs that use four of millions of dollars to record a robot's posture. Therefore, understanding the meaning and usage of the four-dollar number is necessary for learning slam. We'll talk about four dollars in this section.
First of all, readers should not have any mysterious feeling about the four-dollar number. Four Yuan is only a representation of the 3D gesture, we use a unit of four yuan to express the original rotation matrix represented by the three-dimensional rotation. A direct benefit of doing so is to save space. A rotating array has 9 components, but only three degrees of freedom. So, can you describe it in three numbers? can be possible, but there is inevitably a singular situation, Euler angle is an example. And four yuan, more than three-dimensional vector more than a component, so that can not be singular to represent a variety of posture. Let's talk about the four-dollar number in detail.
The four-dollar number is an extended plural found by Hamilton. A four-dollar number has a real part and three imaginary parts (the story said he had been looking for a long time with two imaginary parts, the results can not find, finally enlightened to find the three imaginary part of the four Yuan):
$$ \mathbf{q} = q_0 + q_1 i + q_2 j + q_3 K $$
Where $i,j,k$ is three imaginary parts with a four-dollar number. These three imaginary parts satisfy the relational formula:
\[\begin{equation}
\label{eq:quaternionvirtual}
\left\{\begin{array}{l}
{i^2} = {J^2} = {k^2} =-1\\
IJ = K,ji =-k\\
JK = I,KJ =-I\\
Ki = J,ik =-J
\end{array} \right.
\end{equation}\]
Because of its special representation, sometimes people also use a scalar and a vector to express four of dollars:
$$ \mathbf{q} = \left[s, \mathbf{v} \right], \quad s=q_0 \in \mathbb{r}, \mathbf{v} = [Q_1, q_2, Q_3] \in \mathbb{R}^3. $$
Here, the scalar $s$ is called the real part of the four-dollar number, and the vector $\mathbf{v}$ is called its imaginary part. If a four-dollar imaginary part is $\mathbf{0}$, it is called the real four-dollar number. Conversely, if its real part is $0$, it is called the virtual four-dollar number. The definition is similar to the plural.
A four-dollar number can represent any rotation in a three-dimensional space. Similar to the rotation matrix, we still assume that a rotation is around the unit vector $\mathbf{n}=\left[n_x, n_y, n_z \right]^t$ is rotated at an angle of $\theta$, then the rotation of the four-dollar form is:
\[\begin{equation}
\label{eq:ntheta2quaternion}
\MATHBF{Q} = \left[\cos \frac{\theta}{2}, n_x \sin \frac{\theta}{2}, n_y \sin \frac{\theta}{2}, n_z \sin \frac{\theta}{2} \right]^t
\end{equation}\]
In fact, this is still a modulus of 1 of four, called the unit of four yuan. Conversely, we can also calculate the corresponding rotation axis and angle by any of the four-dollar lengths of 1:
\[\begin{equation}
\begin{cases}
\theta = 2\arccos {q_0}\\
{\left[{{n_x},{n_y},{n_z}} \right]^t} = {{{\left[{{q_1},{q_2},{q_3}} \right]}^t}}/{\sin \frac{\theta}{2}}
\end{cases}
\end{equation}\]
If a four-dollar length is not 1, we can convert it to a four-tuple with a modulo length of 1 by normalization.
The $\theta$ of the $\ref{eq:ntheta2quaternion}$ plus $2\pi$, we get a similar rotation, but at this point the corresponding four-dollar number becomes the $-\mathbf{q}$. Therefore, in the four-dollar number, any rotation can be represented by two reciprocal four-dollar numbers. Similarly, take $\theta$ as $0$, then get a four-dollar number without any rotation:
\[\begin{equation}
\mathbf{q}_0 = \left[{\pm 1,0,0,0} \right]^t
\end{equation}\]
Operation of four-dollar number
The four-dollar number is the same as the usual plural, and can perform a series of operations. Common arithmetic, inner product, inverse, conjugate, index/logarithm and so on. When representing a gesture, it can also interpolate. Here we introduce separately.
Existing two four-$\mathbf{q}_a, \mathbf{q}_b$, whose vectors are expressed as $[s_a, \mathbf{v}_a], [S_b, \mathbf{v}_b]$, or original four-dollar representation: $ $s _a+x_ai+y_aj+ Z_ak, s_b+x_bi+y_bj+z_bk.$$ So, their operations can be expressed as follows.
Four $\mathbf{q}_a, the addition and subtraction operations of \mathbf{q}_b$ are:
\[\begin{equation}
\mathbf{q}_a \pm \mathbf{q}_b = \left[s_a \pm s_b, \mathbf{v}_a \pm \mathbf{v}_b \right].
\end{equation}\]
Multiplication is to multiply each item of the $\mathbf{q}_a$ with the $\mathbf{q}_b$, and finally add, the imaginary part to follow the formula ~\ref{eq:quaternionvirtual}~:
\[\begin{equation}
\BEGIN{ARRAY}{LLL}
\mathbf{q}_a \mathbf{q}_b &=& {s_a}{s_b}-{X_a}{x_b}-{Y_a}{y_b}-{z_a}{z_b}\\
&&+ \left ({{S_a}{x_b} + {X_a}{s_b} + {Y_a}{z_b}-{Z_a}{y_b}} \right) i\\
&&+ \left ({{S_a}{y_b}-{X_a}{z_b} + {Y_a}{s_b} + {Z_a}{b_b}} \right) j\\
&&+ \left ({{S_a}{z_b} + {X_a}{y_b}-{x_b}{y_a} + {Z_a}{s_b}} \right) K
\end{array}
\end{equation}\]
Though somewhat complicated, it is orderly in form. The expression is more concise if it is written in vector form and uses the inner and outer product operations:
\[\begin{equation}
\mathbf{q}_a \mathbf{q}_b = \left[s_a s_b-\mathbf{v}_a \cdot \mathbf{v}_b, S_a\mathbf{v}_b + s_b\mathbf{v}_a + \mathbf{ V}_a \times \mathbf{v}_b \right]
\end{equation}\]
Here we will not help the reader to review what is called the outside product. Under the multiplication definition, the product of the two real four-dollar number is still real, which is consistent with the plural. However, it is noted that due to the existence of the last outer product, the multiplication is usually non-exchangeable unless the $\mathbf{v}_a$ and $\mathbf{v}_b$ are in the $\mathbb{r}^3$ line.
The conjugate of the four-dollar number is:
\[\begin{equation}
\mathbf{q}_a^* = S_a-x_ai-y_aj-z_ak = [S_a,-\mathbf{v}_a]
\end{equation}\]
That is, the imaginary part is taken as the opposite number. Four meta-number conjugate is multiplied by itself and will get a real four-dollar number, in fact the square of the modulus length:
\[\begin{equation}
\mathbf{q}* \mathbf{q} = \mathbf{q} \mathbf{q}* = [S_a^2+\mathbf{v}^t \mathbf{v}, \mathbf{0}] = S_a^2+\mathbf{v}^T \MATHB F{V}
\end{equation}\]
The modulus length of the four-tuple is defined as:
\[\begin{equation}
\| \mathbf{q}_a \| = \sqrt{s_a^2 + x_a^2 + y_a^2 + z_a^2} = \sqrt{\mathbf{q}_a^{*t} \mathbf{q}_a}
\end{equation}\]
It can be verified that the modulus of the product of the two four-dollar number is the product of the modulus. This guarantees that the unit is four yuan multiplied after the unit is still four yuan.
\[\begin{equation}
\| \mathbf{q}_a \mathbf{q}_b \| = \|\mathbf{q}_a \| \| \mathbf{q}_b \|
\end{equation}\]
The inverse of a four-dollar number is:
\[\begin{equation}
\MATHBF{Q}^{-1} = \mathbf{q}^*/\| \MATHBF{Q} \| ^2
\end{equation}\]
By this definition, the product of the four-dollar number and its inverse is 1 of the real four-dollar number:
\[\begin{equation}
\MATHBF{Q} \mathbf{q}^{-1} = \mathbf{q}^{-1} \mathbf{q} = 1
\end{equation}\]
At the same time, the inverse of the product has the same properties as the matrix:
\[\begin{equation}
\left (\mathbf{q}_a \mathbf{q}_b \right) ^{-1} = \mathbf{q}_b^{-1} \mathbf{q}_a^{-1}
\end{equation}\]
For a unit of four yuan, that is, $\|\mathbf{q}\|=1$, its inverse is its conjugate four-dollar number.
- Multiplication and multiplication of points
Similar to vectors, four-dollar numbers can be multiplied with numbers:
\[\begin{equation}
K \mathbf{q} = \left[ks, k\mathbf{v} \right]
\end{equation}\]
A point multiplier is a number of two four-dollar values that are multiplied at each location:
\[\begin{equation}
\mathbf{q}_a \cdot \mathbf{q}_b = s_a s_b + x_a X_b i + y_a y_b j + z_a Z_b K
\end{equation}\]
Rotate with four-dollar number
In the complex field $\mathbb{c}$, we can use a complex $e^{i \theta}$ to represent the rotation of 2D, similar, 3D space can also be used in units of four yuan rotation. Suppose a spatial three-dimensional point $\mathbf{v} = [X,y,z]\in \mathbb{r}^3$, and a rotation by a rotation axis and an angle of $\mathbf{n}, \theta$ specified, the following discusses how to represent them in four-dollar numbers.
First, we describe the three-dimensional space point with a virtual four-dollar number: $$\mathbf{p} = [0, x, y, z] = [0, \mathbf{v}]. $$
Then, refer to \ref{eq:ntheta2quaternion}, with another four-tuple $\mathbf{q}$ to represent this rotation: $$ \mathbf{q} = [\cos \frac{\theta}{2}, \mathbf{n} \sin \ FRAC{\THETA}{2}]. $$
Then, the rotated point $\mathbf{p} ' $ can be expressed as such a product:
\[\begin{equation}
\mathbf{p} ' = \mathbf{q} \mathbf{p} \mathbf{q}^{-1}
\end{equation}\]
It can be verified that the real part of the result is $\mathbf{n}^t (\mathbf{n} \times \mathbf{v}) =0$, so the calculated result is pure virtual four. The three components of its imaginary part represent the coordinates of a 3D point after rotation.
Four meta-conversion to rotation matrix
Since any unit of four can be represented as a 3D rotation, that is, the element in $so (3) $, we can find a rotation matrix corresponding to it. The simplest way is to $\mathbf{q}$ the rotation angle $\theta$ and the rotation axis $\mathbf{n}$ by the four-dollar number, but it is expensive to calculate a $\arccos$ function. In fact, this calculation can be bypassed by certain computational techniques. To omit the space, we give a direct conversion of four to the rotation matrix.
Set four $\mathbf{q} = q_0+q_1i+q_2j+q_3k$, the corresponding rotation matrix $\mathbf{r}$ is:
\[\begin{equation}
\mathbf{r} = \left[{\begin{array}{*{20}{c}}
{1-2q_2^2-2q_3^2}&{2{q_1}{q_2} + 2{q_0}{q_3}}&{2{q_1}{q_3}-2{q_0}{q_2}}\\
{2{q_1}{q_2}-2{q_0}{q_3}}&{1-2q_1^2-2q_3^2}&{2{q_2}{q_3} + 2{q_0}{q_1}}\\
{2{q_1}{q_3} + 2{q_0}{q_2}}&{2{q_2}{q_3}-2{q_0}{q_1}}&{1-2q_1^2-2q_2^2}
\end{array}} \right]
\end{equation}\]
Conversely, the conversion from a rotation matrix to a four-dollar number is as follows. Suppose the matrix is $\mathbf{r}=\{m_{ij}\}, I, J \in \left[1, 2,3 \right] $, its corresponding four-dollar number $\mathbf{q}$ is given by the following formula:
\[\begin{equation}
{Q_0} = \frac{{\sqrt {tr (R) + 1}}}{2},{q_1} = \frac{{{m_{23}}-{m_{32}}}}{{4{q_0}}},{q_2} = \frac{{{m_{31}}-{m_{13}}} {{4{q_0}}},{q_3} = \frac{{{m_{12}}-{m_{21}}}}{{4{q_0}}}
\end{equation}\]
It is worth mentioning that, since $\mathbf{q} and \mathbf{-q}$ represent the same rotation, the fact that a $\mathbf{r}$ is not unique is the four-dollar representation. There are three other types of calculations that are similar to the above, and this book is omitted. In practical programming, when the $q_0$ is close to 0 o'clock, the remaining three components are very large, resulting in an unstable solution, which is considered to be calculated using the remaining several methods.
Several other transformations
Transformations in 3D space, in addition to Euclidean transformations, have several other transformations (in fact the Euclidean transformation is the simplest). They have a part to do with the measurement geometry, which we'll mention later in the tutorial, listed here first.
- Similarity transformations
The similarity transformation has a greater degree of freedom than the Euclidean transform, which allows the object to be scaled freely.
\[\begin{equation}
t_s = \left[{\begin{array}{*{20}{c}}
{s \mathbf{r}}& \mathbf{t}\\
{{\mathbf{0}^t}}&1
\end{array}} \right]
\end{equation}\]
Notice that the rotation section has a scaling factor of $s$, which forms a uniform scaling on the $x,y,z$ three coordinates. Similarly, the multiplication of similar transformations also constitutes a group, called $sim (3) $. Similar transformations no longer keep the area of the graph constant because of the scaling.
The matrix form of affine transformation is as follows:
\[\begin{equation}
T_a = \left[{\begin{array}{*{20}{c}}
\mathbf{a} & \mathbf{t}\\
{{\mathbf{0}^t}} & 1
\end{array}} \right]
\end{equation}\]
Unlike the Euclidean transformation, affine transformations only require that $\mathbf{a}$ be a invertible matrix, rather than an orthogonal matrix. Under affine transformation, the angle of the line changes, but the parallel property is unchanged. This means that the affine transformation transforms the parallelogram into a parallelogram.
- Projective transformations
The projective transformation is the most general transformation, and its matrix form is:
\[\begin{equation}
{\mathbf{t}_p} = \left[{\begin{array}{*{20}{c}}
\mathbf{a} & \mathbf{t}\\
{{\mathbf{a}^t}} & V
\end{array}} \right]
\end{equation}\]
Its upper-left corner is a reversible matrix $\mathbf{a}$, the top right is the translation $\mathbf{t}$, and the lower left is scaled $\mathbf{a}^t$. With the alignment coordinates, when $v \neq 0$, we can divide the entire matrix by $v$ to get a matrix with a lower-right corner of 1, otherwise the lower-right corner is the $0$ matrix. Thus, the matrix has 8 degrees of freedom in the 2D, while in 3D there is a total of 15 degrees of freedom, which is the most common in the transformation now mentioned.
The following table summarizes the properties of several transformations that are currently mentioned. Note that in "invariant nature", there is an inclusion relationship from top to bottom. For example, the Euclidean transformation, in addition to the volume, also has the nature of preserving parallelism and intersection.
If you think my blog is helpful, you can do a few bucks to help me write a blog better.
The mathematical basis of visual slam the second chapter four Yuan