相机参数矩阵计算(内外矩阵)以及光束法平差

               


单应性矩阵由配对的内点计算出来

 

u,v是原始图片左边,对应得到变换后的图片坐标x,y,其中

变换矩阵可以拆成4部分,表示线性变换,比如scaling,shearing和ratotion。用于平移,产生透视变换。

重写之前的变换公式可以得到:

OpenCV 代码实现是getPerspectiveTransform()和findHomography()

 

/* Calculates coefficients of perspectivetransformation

 *which maps (xi,yi) to (ui,vi), (i=1,2,3,4):

 *

 *     c00*xi + c01*yi + c02

 * ui= ---------------------

 *     c20*xi + c21*yi + c22

 *

 *      c10*xi + c11*yi + c12

 * vi= ---------------------

 *     c20*xi + c21*yi + c22

 *

 *Coefficients are calculated by solving linear system:

 * /x0 y0  1 0  0  0 -x0*u0 -y0*u0 \  /c00\ /u0\

 * |x1 y1  1 0  0  0 -x1*u1 -y1*u1 | |c01| |u1|

 * |x2 y2  1 0  0  0 -x2*u2 -y2*u2 | |c02| |u2|

 * |x3 y3  1 0  0  0 -x3*u3 -y3*u3 |.|c10|=|u3|,

 *|  0 0  0 x0 y0  1 -x0*v0 -y0*v0 | |c11| |v0|

 *|  0 0  0 x1 y1  1 -x1*v1 -y1*v1 | |c12| |v1|

 *|  0 0  0 x2 y2  1 -x2*v2 -y2*v2 | |c20| |v2|

 *\  0 0  0 x3 y3  1 -x3*v3 -y3*v3 /  \c21/ \v3/

 *

 *where:

 *   cij- matrix coefficients, c22 = 1

 */

cv::Mat cv::getPerspectiveTransform( constPoint2f src[], const Point2f dst[] )

{

}

更完善的函数是findHomography()

pairwise_matches_ contains the matching relation.  BestOf2NearestMatcher.BestOf2NearestMatcher::match() which is derived from FeaturesMatcher which hasone operator(), the () below will invoke BestOf2NearestMatcher::match() whichwill calculate H matrix. 单应性矩阵计算从匹配的内点

matches_info.H = findHomography(src_points,dst_points, matches_info.inliers_mask, RANSAC);

 

都用于计算单应矩阵,即解一个线性方程组。由于单应矩阵有8个未知数(3*3,其中第9个数为1),所以至少需要4个点(每个点-x,y,提供2个约束方程)。

发现getPerspectiveTra

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值