首页 > 其他 > 详细

Computer Vision 基础学习(3)

时间:2020-06-03 10:05:16      阅读:56      评论:0      收藏:0      [点我收藏+]

 

Knowledge and Thinking

Homogenous coordinates

     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} \)

Euclidean Movement

       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. 

calibration matrix of the pinhole camera

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] \)

 

Computer Vision 基础学习(3)

原文:https://www.cnblogs.com/deuchen/p/13035062.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!