We can use a function \( ax+by+c = 0 \) to describe a line and \((x,y)\) is a point in the line. so the three parameters a,b,c are enough to describe a line. \( l = \left(\begin{array}{l} a \\ b \\ c \end{array}\right) \) but the scalar fator play a not important role in the function. It means \( l^\prime = fl \) . If we ignore the scalar, we can see that \( l = \left(\begin{array}{l} x \\ y \\ 1 \end{array}\right) \), which mean that the line will be not changed by multiplying a factor except 0 . We can see that \( x = \lambda y \), x and y are equivilent as the script. We can easliy add an array to construct a homogeneous vector. \( \left(\begin{array}{l} x \\ y\end{array}\right) \Rightarrow \left(\begin{array}{l} x \\ y \\ 1 \end{array}\right) \)
A significant advantage of homogenous coordinates is that we cannot operate translation by a matrix multiplication without homogenous coordinates. e.g. \( \begin{pmatrix} 1 & 0 & 0\\ 0 & 2 & 0\\ 0 & 0 &3\end{pmatrix} \begin{pmatrix}x \\ y\\ z\end{pmatrix} = \begin{pmatrix}x \\ 2y \\ 3z \end{pmatrix} \) The result can never be such as \( \begin{pmatrix} x \\ y+2 \\ z \end{pmatrix} \). If we use homogenous coordinates \( \mathbb {R}^3 \Rightarrow \mathbb{R}^4 \) the scalar and translation transform can be realized by using matrix multiplication. \(\begin{pmatrix}1 & 0 & 0 & 0 \\0 & 1 & 0 & 2 \\0 & 0 & 0 & 1 \\ 0 & 0&0&1\end{pmatrix} \begin{pmatrix} x\\y\\z \\ 1 \end{pmatrix} = \begin{pmatrix}x \\ y+2 \\ z \\ 1 \end{pmatrix} \)
Any movement of a point in the euclidean space can be expressed by a rotation and a translation as in figure1.
(a) (b)
(c)
Figure 1 (a) pure translation of a polygon (b) pure Rotation of a polygon.
(c) an Affine transformation contains a translation and a rotation
The rotation matrix R should be an orthogonal matrix and \( R^TR = I \) \( det(R) = 1 \) For example a commonly used rotation in \( \mathbb{R^2} \) is \( \begin{pmatrix} cos\theta & sin\theta \\ -sin\theta & cos\theta \end{pmatrix} \) and any rotation in \( \mathbb{R^2} \) can be realized by modifying this matrix. such as multiply a scalar.
An Euclidean Movement in homogeous coordinates is \( P = RP+T \). It can be expressed by a matrix \( \begin{bmatrix} R & t \\ 1 & 0 \end{bmatrix} \) and a movement in euclidean space is \(P_2 = MP_1\)。
Cross product is a widely used calculation in computer vision. The difference from dot product is that, cross product brings a new vector which perpendicular to the original vectors. A 3D corrdinates can be produced by cross product.
The procedure of conversion from a 3D point to a 2D point can be divided into 3 steps.
First of all, in homogenous coordinates, the point is from \( \mathbb P^4 \) to\( \mathbb P^3 \) (in euclidean space is \( \mathbb R^3 \) to \( \mathbb R^2 \) ), it is a linear transform. we need a matrix like \( \begin{pmatrix} 1 & 0 & 0 & 0\\ 0 &1 & 0 & 0\\ 0 & 0 & 1 &0 \end{pmatrix} \)
Second step, the 3D point can be transformed into 2D point by using the pinhole camera model regard to \(f\) focal length. As the previous script, \( \begin{bmatrix} x\\ y \end{bmatrix} = \frac{f}{Z}\begin{bmatrix}X \\ Y \end{bmatrix} \) \( Z\begin{bmatrix} x\\ y\\1 \end{bmatrix} = \begin{bmatrix} X\\Y\\Z \end{bmatrix} \)The matrix is \( \begin{pmatrix}f & 0 & 0\\0 & f & 0 \\0 & 0 & 1\end{pmatrix} \)
Third step, In the 3D space the unit of a coordinates is mm. butthe coordinates of a point in a image is in pixel . We should multiply a scalar in pixels/mm and a skew parameter because there exist a angel between thef two coordinates, the correction matrix is \( \begin{pmatrix} s_{x} & s_{\theta} & o_{x} \0 & s_{y} & o_{y} \0 & 0 & 1 \end{pmatrix} \)
The final projection should be \( \underbrace{\left[\begin{array}{ccc} s_{x} & s_{\theta} & o_{x} \0 & s_{y} & o_{y} \0 & 0 & 1 \end{array}\right]\left[\begin{array}{ccc} f & 0 & 0 \0 & f & 0 \0 & 0 & 1 \end{array}\right]}_{:=K} \underbrace{\left[\begin{array}{cccc} 1 & 0 & 0 & 0 \0 & 1 & 0 & 0 \0 & 0 & 1 & 0 \end{array}\right]}_{\Pi_{0}}\left[\begin{array}{c} X \Y \Z \1 \end{array}\right] \)
原文:https://www.cnblogs.com/deuchen/p/13035062.html