sba中非命令行参数的设置

来源:互联网 发布:s8新赛季符文 知乎 编辑:程序博客网 时间:2024/04/30 17:19

http://hi.baidu.com/lulyon/blog/item/a6b3ef2ddd1ceb3d359bf74f.html


在sba 工程中配置好传入的参数命令行参数为cams.txt pts.txt calib.txt,函数
sba_driver 中的几个变量的设置如下:
nconstframes=0;//nconstframe 表示前几幅图像的参数在平差过程中保持不变。这里我们
使所有图像都参与平差,因此设nconstframe 为0。
howto= BA_MOTSTRUCT;//howto 表示平差的方式,只对相机参数(motion)进行平差,只对
激光点坐标(structure)进行平差,还是一起平差?这里我们选择一起平差。
expert=1;//sba 过程提供两个接口,一个是专家版(运算过程复杂,时间长,结果更精
确),以及普通版。这里我们选择专家版。
analyticjac=1;//使用解析方法计算投影方程的雅可比矩阵,还是近似计算雅可比矩阵?
这里我们选择解析方法,因为更准确。
prnt = BA_MOTSTRUCT;//打印相机参数的估计值,还是激光点参数的估计值?这里我
们选择同时打印。


计算过程如下:将sba中两个重要的宏SBA_INIT_MU 和SBA_STOP_THRESH置为默认值,或输出的图像点误差仍然不够小,或显示的迭代停止的原因代号为4,则减小SBA_INIT_MU,并将迭代的结果作为初值代入重新平差,直到输出的图像点误差足够小并且迭代停止的原理代号为1或2。以下是一组计算实例:

首先,将宏SBA_INIT_MU的值置为1E-03,SBA_STOP_THRESH的值置为1E-18。运行sba,得到如下结果(将平差值写入文件中):
Starting BA with fixed intrinsic parameters
SBA using 19943 3D pts, 5 frames and 41563 image projections, 59859 variables
Method BA_MOTSTRUCT, expert driver, analytic Jacobian, fixed intrinsics, without covariances
SBA returned 6 in 6 iter, reason 2, error 827.631 [initial 2940.98], 6/6 func/fjac evals, 6 lin. systems
Elapsed time: 1.06 seconds, 1063.00 msecs

图像点误差为827.631,比较大。将宏SBA_INIT_MU的值置为1E-06,将运算结果作为初值,重新运行sba,得到如下结果:

Starting BA with fixed intrinsic parameters
LAPACK error: the leading minor of order 27 is not positive definite,
the factorization could not be completed for dpotf2/dpotrf in sba_Axb_Chol()
LAPACK error: the leading minor of order 27 is not positive definite,
the factorization could not be completed for dpotf2/dpotrf in sba_Axb_Chol()
LAPACK error: the leading minor of order 27 is not positive definite,
the factorization could not be completed for dpotf2/dpotrf in sba_Axb_Chol()
LAPACK error: the leading minor of order 27 is not positive definite,
the factorization could not be completed for dpotf2/dpotrf in sba_Axb_Chol()
LAPACK error: the leading minor of order 27 is not positive definite,
the factorization could not be completed for dpotf2/dpotrf in sba_Axb_Chol()
LAPACK error: the leading minor of order 27 is not positive definite,
the factorization could not be completed for dpotf2/dpotrf in sba_Axb_Chol()
LAPACK error: the leading minor of order 27 is not positive definite,
the factorization could not be completed for dpotf2/dpotrf in sba_Axb_Chol()
LAPACK error: the leading minor of order 27 is not positive definite,
the factorization could not be completed for dpotf2/dpotrf in sba_Axb_Chol()
SBA using 19943 3D pts, 5 frames and 41563 image projections, 59859 variables

Method BA_MOTSTRUCT, expert driver, analytic Jacobian, fixed intrinsics, without
covariances

SBA returned 1369 in 1369 iter, reason 4, error 0.300721 [initial 827.631], 1381
/1369 func/fjac evals, 1388 lin. systems
Elapsed time: 246.28 seconds, 246282.00 msecs
图像点误差为0.300721,已经足够小,但迭代停止的原因代号为4,所以将平差结果重新传入,重新运行sba,得到如下结果:
Starting BA with fixed intrinsic parameters
SBA using 19943 3D pts, 5 frames and 41563 image projections, 59859 variables

Method BA_MOTSTRUCT, expert driver, analytic Jacobian, fixed intrinsics, without
covariances

SBA returned 1 in 1 iter, reason 2, error 0.300721 [initial 0.300721], 1/1 func/
fjac evals, 1 lin. systems
Elapsed time: 0.19 seconds, 188.00 msecs

此时,图像点误差为0.300721,已经足够小,并且迭代停止的原因代号为2,所以平差值可以作为最后的结果,平差结束。得到三个文件“pts平差值.txt”、“cams平差值.txt”,“3DPoints平差值.txt”。