注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

hhfighting的博客

以责人之心责己,以恕己之心恕人

 
 
 

日志

 
 
 
 

【转载】How to compute a homography  

2014-10-18 12:27:35|  分类: 专业知识 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
本文转载自villager《How to compute a homography》

现在回过头来看,才发现这些章节都在Hartley的书中全部出现过了,所谓的homography不仅针对图像点,也可以是 针对平面,或者由projective 到 metric坐标点的转换,H可以是三维也可以是四维,都根据实际情况而定。而在计算的时候,对于x=Hx', 由于尺度因子的存在,所以不能直接解方程,而是转化为x*Hx=0的形式,此处的乘号不同于常用的矩阵乘法,而是外积或者叉积(cross product, wiki之后才发现只存在three or seven dimensional cross product),亦可将x写作skew-symmetric的形式,然后转换为普通的矩阵乘法进行计算。而在列方程的时候也要注意,由于各方程之间是相互依赖的,所以不能全部都用于计算,而只能根据实际情况选择最多的independent的方程组成A, 比如在下面求解二维对应点的过程中选择的就是2个independent方程,而在求解三维点时,则是三个独立方程。将方程转化为AH=0的形式后,求解H可以采用SVD(假定||H||=1)等方式求解A的nullspace.

"所谓的homography,单应性矩阵,是说对于空间中某一点在左右两幅图像中的像点m = [u,v,1]Tm' = [u',v',1]T(用齐次坐标表示时),能通过一个3*3的单应矩阵 H = [h1 , h2, h3]将左右对应的两点联系起来。这个同学的博客不仅给出了解释,还给出了他自己的实验结果:http://www.cs.adelaide.edu.au/~tonyscoleri/Research/Homog/MFNS_Homog.html


计算过程:

We are given 2D to 2D point correspondences $ {bf x_i} leftrightarrow {bf x_i'}$ (these are points in $ {cal P}^2$ and hence are homogeneous vectors of size $ 3 times 1$ ), and we have to find the homography $ {bf H}$ ( $ 3 times 3$ matrix) such that $ {bf x_i'} = {bf H}{bf x_i}$ .

Note that $ {bf x_i'}$ and $ {bf H}{bf x_i}$ are not numerically equal and they can differ by a scale factor. However, they have the same direction, and, hence $ {bf x_i'} times {bf H}{bf x_i} = {bf0}$ .

Writing the $ j^{th}$ row of $ {bf H}$ as $ {{bf h}^j}^T$ , we have

$displaystyle {bf H}{bf x_i} = left[ begin{array}{c} {{bf h}^1}^T {bf x_i}  {{bf h}^2}^T {bf x_i}  {{bf h}^3}^T {bf x_i}  end{array}right] $

Writing $ {bf x_i'}^T = (x_i',y_i',w_i')^T$ , the cross product becomes:

$displaystyle {bf x_i'} times {bf H}{bf x_i} = left[ begin{array}{c} y_i'... ...'{{bf h}^2}^T {bf x_i} - y_i' {{bf h}^1}^T {bf x_i}  end{array}right] $

Since $ {{bf h}^j}^T {bf x_i} = {bf x_i}^T {bf h}^j$ , the system of equations $ {bf x_i'} times {bf H}{bf x_i} = {bf0}$ can be written in terms of the unknowns (the entries of $ {bf H}$ ) as:

$displaystyle left[ begin{array}{ccc} {bf0}^T & -w_i' {bf x_i}^T & y_i' {b... ...rray}{c} {bf h}^1  {bf h}^2  {bf h}^3  end{array}right] = {bf0} $

These equations have the form $ {bf A_i}{bf h} = {bf0}$ where $ {bf A_i}$ is a $ 3 times 9$ matrix and $ {bf h}$ is a $ 9 times 1$ vector (the entries of $ {bf H}$ ). Note that $ {bf A_i}$ has rank of 2 (third row is obtained, up to a scale, by a sum of $ x_i'$ times the first row and $ y_i'$ times the second), and, consequently, for each point correspondence we have really only two equations. We may choose to work with only the first two, but it doesn't harm to keep all three. It may be useful to keep all three equations because if $ w_i' = 0$ (a point at infinity), then the first two collapse to a single equation.

Stacking up the equations for $ i = 1,2,3,4$ (four points) we have $ {bf A}{bf h} = {bf0}$ where $ {bf A}$ is a $ 12 times 9$ matrix whose rank is 8 (of-course, you will not choose four points such that any three are collinear). Consequently $ {bf A}$ has a 1-dimensional null space which provides a solution for $ {bf h}$ . Such a solution can only be determined up to a non-zero scale factor, which suits you fine because $ {bf H}$ is anyway defined only up to a scale! A scale may be arbitrarily chosen for $ {bf h}$ by insisting that $ Vert {bf h} Vert = 1$ .

One can, of-course, stack up more equations by taking more point correspondences. The resulting over-determined system $ {bf Ah} = {bf0}$ may not have a solution at all (inconsistent measurements?). We can still find a least-squares solution: minimize $ Vert{bf Ah} Vert$ subject to $ Vert {bf h} Vert = 1$ .

In either case $ {bf h}$ is given by the last column of $ {bf V}$ where $ {bf A} = {bf USigma V}^T$ is the singular value decomposition (SVD) of $ {bf A}$ .

te>te>
  评论这张
 
阅读(67)| 评论(1)
推荐 转载

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018