Documentation – Current v2020.1

PRIVATE DOCPAGE PIECES WORKSPACE

Internal WordPress docpage materials to keep around until used elsewhere




 

Calibration Background

The Geometric Calibrator software in Imatest is based on the projective camera model. The parameters of this model are often broken out into two main aspects: intrinsics (device properties) and extrinsics (positioning in the world). 

 

Intrinsics

The properties of a camera which relate pixel array locations to rays emanating from the camera center are called its intrinsics. These are properties of the device and thus are not affected by its position in the world.

The intrinsics of a projective camera typically include its focal length, the principle point where the optical axis intersects the sensor array, and any geometric distortion caused by the optics which deviates from a rectilinear, projective model. 

 

Extrinsics

The extrinsics of a devices are the spatial positioning and orientation of the camera(s) in the 3-dimensional world.

For a single camera, the extrinsics are simply its position and rotation in some world coordinate system. Very often, the camera center is chosen as the center of the world coordinate system and points in the scene are described relative to it. 

For a multi-camera system, one camera is chosen as the reference device. The extrinsics of the whole system then include not only the reference device’s position and orientation, but the position and orientation of the other cameras relative to it. 

 

 




Determining geometry from multiple views (either from multiple cameras or multiple frames from one) is the at the heart of classical computer vision. and is useful for many purposes, from autonomous vehicle navigation to computational defocus (used for “portrait mode”) in mobile devices.

 

 



Rotations and Translations in 3D

 

Axis-Angle Rotations

A rotation of \(\theta\) radians about an arbitrary unit-axis \(\mathbf{k}=\begin{bmatrix}k_x&k_y&k_z\end{bmatrix}^{\top}\), where \(k_x^2+k_y^2+k_z^2=1\) is given by the Rodrigues formula:

\(\mathbf{R}=\cos\theta\mathbf{I}+\sin\theta\mathbf{K}+(1-\cos\theta)\mathbf{K}^2\)

where \(\mathbf{I}\) is a \(3\times3\) identity matrix, \(\mathbf{K}\) is a cross-product matrix, 

\(\mathbf{K}=[\mathbf{k}]_{\times}=\begin{bmatrix}0&-k_z&k_y\\k_z&0&-k_x\\-k_y&k_x&0\end{bmatrix}\).

For this form, a positive rotation (\(\theta\)) corresponds to a counter-clockwise (right-handed) rotation.

Quaternion Rotations

A quaternion is an extension on the complex numbers where there are 3 unique and imaginary components \(i\), \(j\), and \(k\):

\(\mathbf{i}^2=\mathbf{j}^2=\mathbf{k}^2=\mathbf{ijk}=-1\)

A quaternion is the set of four real-valued coefficients

\(\mathbf{q}=q_r+q_i\cdot\mathbf{i}+q_j\cdot\mathbf{j} +q_k\cdot\mathbf{k}\)

A rotation matrix can be defined from these coefficients:

\(\mathbf{R}=\displaystyle\frac{1}{||\mathbf{q}||^2}\begin{bmatrix}||\mathbf{q}||^2-2\cdot(q_j^2+q_k^2)&2\cdot(q_i\cdot q_j-q_k\cdot q_r)&2\cdot(q_i\cdot q_k+q_j\cdot q_r)\\2\cdot(q_i\cdot q_j+q_k\cdot q_r)&||\mathbf{q}||^2-2\cdot(q_i^2+q_k^2)&2\cdot(q_j\cdot q_k-q_i\cdot q_r)\\2\cdot(q_i\cdot q_k-q_j\cdot q_r)&2\cdot(q_j\cdot q_k+q_i\cdot q_r)&||\mathbf{q}||^2-2\cdot(q_i^2+q_j^2)\end{bmatrix}\)

where

 

\(||\mathbf{q}||^2=q_r^2+q_i^2+q_j^2+q_k^2\)

Euler and Tait-Bryan Rotations

Euler and Tait-Bryan rotations are three successive basic rotations. The forms of the two sets of rotations are different and are sometimes all lumbed under the Euler rotation heading.

Euler Rotations

Euler rotations are a rotation have a form of \(\mathbf{R}_a\mathbf{R}_b\mathbf{R}_a\), where \(a\) and \(b\) are substitutes for \(x\), \(y\), and \(z\) such that \(a \ne b\).

\(\begin{array}{l}\mathbf{R}_{xyx} = \mathbf{R}_x(\theta_3)\mathbf{R}_y(\theta_2)\mathbf{R}_x(\theta_1) = \begin{bmatrix}\cos(\theta_2)&\sin(\theta_2)\cdot \sin(\theta_1)&\sin(\theta_2)\cdot \cos(\theta_1)\\\sin(\theta_3)\cdot \sin(\theta_2)&\cos(\theta_3)\cdot \cos(\theta_1)-\sin(\theta_3)\cdot \cos(\theta_2)\cdot \sin(\theta_1)&-\cos(\theta_3)\cdot \sin(\theta_1)-\sin(\theta_3)\cdot \cos(\theta_2)\cdot \cos(\theta_1)\\-\cos(\theta_3)\cdot \sin(\theta_2)&\sin(\theta_3)\cdot \cos(\theta_1)+\cos(\theta_3)\cdot \cos(\theta_2)\cdot \sin(\theta_1)&-\sin(\theta_3)\cdot \sin(\theta_1)+\cos(\theta_3)\cdot \cos(\theta_2)\cdot \cos(\theta_1)\end{bmatrix}\\\mathbf{R}_{xzx} = \mathbf{R}_x(\theta_3)\mathbf{R}_z(\theta_2)\mathbf{R}_x(\theta_1) = \begin{bmatrix}\cos(\theta_2)&-\sin(\theta_2)\cdot \cos(\theta_1)&\sin(\theta_2)\cdot \sin(\theta_1)\\\cos(\theta_3)\cdot \sin(\theta_2)&\cos(\theta_3)\cdot \cos(\theta_2)\cdot \cos(\theta_1)-\sin(\theta_3)\cdot \sin(\theta_1)&-\cos(\theta_3)\cdot \cos(\theta_2)\cdot \sin(\theta_1)-\sin(\theta_3)\cdot \cos(\theta_1)\\\sin(\theta_3)\cdot \sin(\theta_2)&\sin(\theta_3)\cdot \cos(\theta_2)\cdot \cos(\theta_1)+\cos(\theta_3)\cdot \sin(\theta_1)&-\sin(\theta_3)\cdot \cos(\theta_2)\cdot \sin(\theta_1)+\cos(\theta_3)\cdot \cos(\theta_1)\end{bmatrix}\\\mathbf{R}_{yxy} = \mathbf{R}_y(\theta_3)\mathbf{R}_x(\theta_2)\mathbf{R}_y(\theta_1) = \begin{bmatrix}\cos(\theta_3)\cdot \cos(\theta_1)-\sin(\theta_3)\cdot \cos(\theta_2)\cdot \sin(\theta_1)&\sin(\theta_3)\cdot \sin(\theta_2)&\cos(\theta_3)\cdot \sin(\theta_1)+\sin(\theta_3)\cdot \cos(\theta_2)\cdot \cos(\theta_1)\\\sin(\theta_2)\cdot \sin(\theta_1)&\cos(\theta_2)&-\sin(\theta_2)\cdot \cos(\theta_1)\\-\sin(\theta_3)\cdot \cos(\theta_1)-\cos(\theta_3)\cdot \cos(\theta_2)\cdot \sin(\theta_1)&\cos(\theta_3)\cdot \sin(\theta_2)&-\sin(\theta_3)\cdot \sin(\theta_1)+\cos(\theta_3)\cdot \cos(\theta_2)\cdot \cos(\theta_1)\end{bmatrix}\\\mathbf{R}_{yzy} = \mathbf{R}_y(\theta_3)\mathbf{R}_z(\theta_2)\mathbf{R}_y(\theta_1) = \begin{bmatrix}\cos(\theta_3)\cdot \cos(\theta_2)\cdot \cos(\theta_1)-\sin(\theta_3)\cdot \sin(\theta_1)&-\cos(\theta_3)\cdot \sin(\theta_2)&\cos(\theta_3)\cdot \cos(\theta_2)\cdot \sin(\theta_1)+\sin(\theta_3)\cdot \cos(\theta_1)\\\sin(\theta_2)\cdot \cos(\theta_1)&\cos(\theta_2)&\sin(\theta_2)\cdot \sin(\theta_1)\\-\sin(\theta_3)\cdot \cos(\theta_2)\cdot \cos(\theta_1)-\cos(\theta_3)\cdot \sin(\theta_1)&\sin(\theta_3)\cdot \sin(\theta_2)&-\sin(\theta_3)\cdot \cos(\theta_2)\cdot \sin(\theta_1)+\cos(\theta_3)\cdot \cos(\theta_1)\end{bmatrix}\\\mathbf{R}_{zxz} = \mathbf{R}_z(\theta_3)\mathbf{R}_x(\theta_2)\mathbf{R}_z(\theta_1) = \begin{bmatrix}\cos(\theta_3)\cdot \cos(\theta_1)-\sin(\theta_3)\cdot \cos(\theta_2)\cdot \sin(\theta_1)&-\cos(\theta_3)\cdot \sin(\theta_1)-\sin(\theta_3)\cdot \cos(\theta_2)\cdot \cos(\theta_1)&\sin(\theta_3)\cdot \sin(\theta_2)\\\sin(\theta_3)\cdot \cos(\theta_1)+\cos(\theta_3)\cdot \cos(\theta_2)\cdot \sin(\theta_1)&-\sin(\theta_3)\cdot \sin(\theta_1)+\cos(\theta_3)\cdot \cos(\theta_2)\cdot \cos(\theta_1)&-\cos(\theta_3)\cdot \sin(\theta_2)\\\sin(\theta_2)\cdot \sin(\theta_1)&\sin(\theta_2)\cdot \cos(\theta_1)&\cos(\theta_2)\end{bmatrix}\\\mathbf{R}_{zyz} = \mathbf{R}_z(\theta_3)\mathbf{R}_y(\theta_2)\mathbf{R}_z(\theta_1) = \begin{bmatrix}\cos(\theta_3)\cdot \cos(\theta_2)\cdot \cos(\theta_1)-\sin(\theta_3)\cdot \sin(\theta_1)&-\cos(\theta_3)\cdot \cos(\theta_2)\cdot \sin(\theta_1)-\sin(\theta_3)\cdot \cos(\theta_1)&\cos(\theta_3)\cdot \sin(\theta_2)\\\sin(\theta_3)\cdot \cos(\theta_2)\cdot \cos(\theta_1)+\cos(\theta_3)\cdot \sin(\theta_1)&-\sin(\theta_3)\cdot \cos(\theta_2)\cdot \sin(\theta_1)+\cos(\theta_3)\cdot \cos(\theta_1)&\sin(\theta_3)\cdot \sin(\theta_2)\\-\sin(\theta_2)\cdot \cos(\theta_1)&\sin(\theta_2)\cdot \sin(\theta_1)&\cos(\theta_2)\end{bmatrix}\\\end{array}\)

Tait-Bryan Rotations

Tait-Bryan rotations are a rotation have a form of \(\mathbf{R}_a\mathbf{R}_b\mathbf{R}_c\), where \(a\), \(b\) and \(c\) are unique substitutes for \(x\), \(y\), and \(z\). Tait-Bryan angles are often referred to as roll, pitch, and yaw for rotations about the \(x\), \(y\), and \(z\) axes respectively.

\(\begin{array}{l}\mathbf{R}_{xyz} = \mathbf{R}_z(\theta_3)\mathbf{R}_y(\theta_2)\mathbf{R}_x(\theta_1) = \begin{bmatrix}\cos(\theta_3)\cdot \cos(\theta_2)&-\sin(\theta_3)\cdot \cos(\theta_1)+\cos(\theta_3)\cdot \sin(\theta_2)\cdot \sin(\theta_1)&\sin(\theta_3)\cdot \sin(\theta_1)+\cos(\theta_3)\cdot \sin(\theta_2)\cdot \cos(\theta_1)\\\sin(\theta_3)\cdot \cos(\theta_2)&\cos(\theta_3)\cdot \cos(\theta_1)+\sin(\theta_3)\cdot \sin(\theta_2)\cdot \sin(\theta_1)&-\cos(\theta_3)\cdot \sin(\theta_1)+\sin(\theta_3)\cdot \sin(\theta_2)\cdot \cos(\theta_1)\\-\sin(\theta_2)&\cos(\theta_2)\cdot \sin(\theta_1)&\cos(\theta_2)\cdot \cos(\theta_1)\end{bmatrix}\\\mathbf{R}_{xzy} = \mathbf{R}_y(\theta_3)\mathbf{R}_z(\theta_2)\mathbf{R}_x(\theta_1) = \begin{bmatrix}\cos(\theta_3)\cdot \cos(\theta_2)&-\cos(\theta_3)\cdot \sin(\theta_2)\cdot \cos(\theta_1)+\sin(\theta_3)\cdot \sin(\theta_1)&\cos(\theta_3)\cdot \sin(\theta_2)\cdot \sin(\theta_1)+\sin(\theta_3)\cdot \cos(\theta_1)\\\sin(\theta_2)&\cos(\theta_2)\cdot \cos(\theta_1)&-\cos(\theta_2)\cdot \sin(\theta_1)\\-\sin(\theta_3)\cdot \cos(\theta_2)&\sin(\theta_3)\cdot \sin(\theta_2)\cdot \cos(\theta_1)+\cos(\theta_3)\cdot \sin(\theta_1)&-\sin(\theta_3)\cdot \sin(\theta_2)\cdot \sin(\theta_1)+\cos(\theta_3)\cdot \cos(\theta_1)\end{bmatrix}\\\mathbf{R}_{yxz} = \mathbf{R}_z(\theta_3)\mathbf{R}_x(\theta_2)\mathbf{R}_y(\theta_1) = \begin{bmatrix}\cos(\theta_3)\cdot \cos(\theta_1)-\sin(\theta_3)\cdot \sin(\theta_2)\cdot \sin(\theta_1)&-\sin(\theta_3)\cdot \cos(\theta_2)&\cos(\theta_3)\cdot \sin(\theta_1)+\sin(\theta_3)\cdot \sin(\theta_2)\cdot \cos(\theta_1)\\\sin(\theta_3)\cdot \cos(\theta_1)+\cos(\theta_3)\cdot \sin(\theta_2)\cdot \sin(\theta_1)&\cos(\theta_3)\cdot \cos(\theta_2)&\sin(\theta_3)\cdot \sin(\theta_1)-\cos(\theta_3)\cdot \sin(\theta_2)\cdot \cos(\theta_1)\\-\cos(\theta_2)\cdot \sin(\theta_1)&\sin(\theta_2)&\cos(\theta_2)\cdot \cos(\theta_1)\end{bmatrix}\\\mathbf{R}_{yzx} = \mathbf{R}_x(\theta_3)\mathbf{R}_z(\theta_2)\mathbf{R}_y(\theta_1) = \begin{bmatrix}\cos(\theta_2)\cdot \cos(\theta_1)&-\sin(\theta_2)&\cos(\theta_2)\cdot \sin(\theta_1)\\\cos(\theta_3)\cdot \sin(\theta_2)\cdot \cos(\theta_1)+\sin(\theta_3)\cdot \sin(\theta_1)&\cos(\theta_3)\cdot \cos(\theta_2)&\cos(\theta_3)\cdot \sin(\theta_2)\cdot \sin(\theta_1)-\sin(\theta_3)\cdot \cos(\theta_1)\\\sin(\theta_3)\cdot \sin(\theta_2)\cdot \cos(\theta_1)-\cos(\theta_3)\cdot \sin(\theta_1)&\sin(\theta_3)\cdot \cos(\theta_2)&\sin(\theta_3)\cdot \sin(\theta_2)\cdot \sin(\theta_1)+\cos(\theta_3)\cdot \cos(\theta_1)\end{bmatrix}\\\mathbf{R}_{zxy} = \mathbf{R}_y(\theta_3)\mathbf{R}_x(\theta_2)\mathbf{R}_z(\theta_1) = \begin{bmatrix}\cos(\theta_3)\cdot \cos(\theta_1)+\sin(\theta_3)\cdot \sin(\theta_2)\cdot \sin(\theta_1)&-\cos(\theta_3)\cdot \sin(\theta_1)+\sin(\theta_3)\cdot \sin(\theta_2)\cdot \cos(\theta_1)&\sin(\theta_3)\cdot \cos(\theta_2)\\\cos(\theta_2)\cdot \sin(\theta_1)&\cos(\theta_2)\cdot \cos(\theta_1)&-\sin(\theta_2)\\-\sin(\theta_3)\cdot \cos(\theta_1)+\cos(\theta_3)\cdot \sin(\theta_2)\cdot \sin(\theta_1)&\sin(\theta_3)\cdot \sin(\theta_1)+\cos(\theta_3)\cdot \sin(\theta_2)\cdot \cos(\theta_1)&\cos(\theta_3)\cdot \cos(\theta_2)\end{bmatrix}\\\mathbf{R}_{zyx} = \mathbf{R}_x(\theta_3)\mathbf{R}_y(\theta_2)\mathbf{R}_z(\theta_1) = \begin{bmatrix}\cos(\theta_2)\cdot \cos(\theta_1)&-\cos(\theta_2)\cdot \sin(\theta_1)&\sin(\theta_2)\\\sin(\theta_3)\cdot \sin(\theta_2)\cdot \cos(\theta_1)+\cos(\theta_3)\cdot \sin(\theta_1)&-\sin(\theta_3)\cdot \sin(\theta_2)\cdot \sin(\theta_1)+\cos(\theta_3)\cdot \cos(\theta_1)&-\sin(\theta_3)\cdot \cos(\theta_2)\\-\cos(\theta_3)\cdot \sin(\theta_2)\cdot \cos(\theta_1)+\sin(\theta_3)\cdot \sin(\theta_1)&\cos(\theta_3)\cdot \sin(\theta_2)\cdot \sin(\theta_1)+\sin(\theta_3)\cdot \cos(\theta_1)&\cos(\theta_3)\cdot \cos(\theta_2)\end{bmatrix}\\\end{array}\)

Notes

When using Euler or Tait-Bryan angles, it is necessary to also specify the rotation order. As can be observed from the above equations, except under edge cases, the rotation matrix will be different for a different choice of rotation order.