zoukankan      html  css  js  c++  java
  • Computer Vision 基础学习(3)

     

    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(egin{array}{l} a \ b \ c end{array} ight) ) 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(egin{array}{l} x \ y \ 1 end{array} ight) ), 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(egin{array}{l} x \ yend{array} ight) Rightarrow left(egin{array}{l} x \ y \ 1 end{array} ight) )

    A significant advantage of homogenous coordinates is that we cannot operate translation by a matrix multiplication without homogenous coordinates. e.g. ( egin{pmatrix} 1 & 0 & 0\ 0 & 2 & 0\ 0 & 0 &3end{pmatrix} egin{pmatrix}x \ y\ zend{pmatrix} = egin{pmatrix}x \ 2y \ 3z end{pmatrix} ) The result can never be such as ( egin{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. (egin{pmatrix}1 & 0 & 0 & 0 \0 & 1 & 0 & 2 \0 & 0 & 0 & 1 \ 0 & 0&0&1end{pmatrix} egin{pmatrix} x\y\z \ 1 end{pmatrix} = egin{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 ( egin{pmatrix} cos heta & sin heta \ -sin heta & cos heta 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 ( egin{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 ( egin{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, ( egin{bmatrix} x\ y end{bmatrix} = frac{f}{Z}egin{bmatrix}X \ Y end{bmatrix} )  ( Zegin{bmatrix} x\ y\1 end{bmatrix} = egin{bmatrix} X\Y\Z end{bmatrix} )The matrix is ( egin{pmatrix}f & 0 & 0\0 & f & 0 \0 & 0 & 1end{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 ( egin{pmatrix} s_{x} & s_{ heta} & o_{x} \ 0 & s_{y} & o_{y} \ 0 & 0 & 1 end{pmatrix} )

    The final projection should be ( underbrace{left[egin{array}{ccc} s_{x} & s_{ heta} & o_{x} \ 0 & s_{y} & o_{y} \ 0 & 0 & 1 end{array} ight]left[egin{array}{ccc} f & 0 & 0 \ 0 & f & 0 \ 0 & 0 & 1 end{array} ight]}_{:=K} underbrace{left[egin{array}{cccc} 1 & 0 & 0 & 0 \ 0 & 1 & 0 & 0 \ 0 & 0 & 1 & 0 end{array} ight]}_{Pi_{0}}left[egin{array}{c} X \ Y \ Z \ 1 end{array} ight] )

     

  • 相关阅读:
    BOS13——quartz定时任务,Highcharts前端图表的使用
    BOS12——多对多添加方法,多对多页面需要字段问题(不多的话直接提供get方法),修改Realm中授权方法(查询数据库),缓存Java对象的方法,加载左侧菜单(ztree提供pId)
    BOS10——权限控制的实现,apache shiro权限管理框架的使用,参数同名问题,EasyUI的combotree的使用
    BOS08——Web工程中的CXF客户端,加载select框中的内容,select框移动,提交时将select全部选中,CRM中更新的方法,别名的用于不用
    CXF——WebService简介,CXF框架的使用
    BOS06——带有过滤条件的查询(解决form表单提交时,分页携带过滤条件困难的问题)and连表查询返回数据不标准问题,文件导出,BaseDao扩展一个离线Criteria查询,前端字段名重复问题(不知道对应那个字段了),多张表保存问题
    Python基础之文件处理
    Python基础之字符编码
    Python基础之数据类型
    Python安装
  • 原文地址:https://www.cnblogs.com/deuchen/p/13035062.html
Copyright © 2011-2022 走看看