Second calibration example - Calibration using Zhengyou Zhang's data

The previous example showed you how to run calibration from raw images. It is worth noticing that our toolbox may also be used in case where some calibration data have been previously computed. As an illustration, let us use our calibration engine onZhengyou Zhang's calibration data that he made available on hiscalibration page at Microsoft Research. Do not bother downloading the data from there, we have it all ready for you right here just one mouse click away:zhang_data.zip (621Kb zipped). After download, retrieve all the files present in the package in a directory calledzhang_data (this should be automatic). This directory contains the original calibration images (five of them) used by Zhang (intif format), together with the planar calibration rig model and the extracted corner coordinate files that Zhengyou Zhang distributes on hisweb page. In addition, you will find a small matlab script file calleddemo_script.m.

前面的例子教你怎样用原始deep图片来校正。工具箱同样能够用以前的校正数据来进行校正。作为演示,我们校正引擎采用Zhengyou Zhang的校正数据(来自他在微软研究院的网页上)。不需要去他网页下载,可以直接右键在这里下载。下载完成后,得到的数据在一个叫zhang_data的目录中。该目录含有原始校正图片(5张,格式是tif),同时还有刚体校正模型和角点坐标文件。你还会找到一个matlab的脚本程序叫做demo_script.m。

Under Matlab, run that script file demo_script.m. This script converts all Zhang's data into my calibration format, reads in the images, runs through the main calibration engine, shows the results (intrinsic + extrinsic), and saves them under a file called Calib_Results.mat. This small script demonstrates that our calibration toolbox may easily be used in cases where some data have already been extracted (in this case, the corner coordinates). Observe that setting the variable dont_ask to one lets you use the main toolbox functions (optimization + graphical display) in script mode without being prompted. This is also quite useful for including calibration calls in your own matlab script files. In this present example, compare our calibration results (fc, cc, kc, Rc_1, Tc_1, Rc_2,Tc_2, ... ,Rc_5, Tc_5) with Zhang's. Quite similar no? (observe that our distortion model includes two additional terms accounting for tangential distortion. The other terms are defined in the exact same way. For more information, visit thepage describing the calibration parameters.

运行demo_script.m。该脚本将zhang的数据转换成自己的校正格式,读入图片,运行校正步骤,显示结果(内部参数+外部参数),并将结果保存在一个叫做Calib_Results.mat的文件中。这个小脚本显示了我们的校正工具箱可以很简单的应用,当一些数据已经被提取出来的话(这里指角点坐标)。注意到可以设置变量dont_ask为1来使你应用工具箱时(优化+图形显示)没有提示过程。这个对你自己写matlab脚本来计算校正很有用。本例子中,我们校正结果(fc, cc, kc, Rc_1, Tc_1, Rc_2,Tc_2, ... ,Rc_5, Tc_5)和zhang比较。是不是很相似?(注意到我们的校正包含两个二维的切向失真)。

Once the script is finished running, we may want to try to include the skew coefficient alpha_c in the optimization. For that purpose, set the binary variable est_alpha to1 (est_alpha = 1), and click on Calibration. Observe that the final computed skew coefficient alpha_c is very close to zero (i.e. pixels are rectangular). For more information, visit thepage describing the calibration parameters.

脚本运行完成后,我们可能需要将斜交系数在优化过程中考虑在内。这样,可以将变量est_alpha设为1,点击Calibration按钮。可以观察到alpha_c十分接近于0(也就是说像素是按矩形排列的)。

As a final ultimate comparison, you may want to run the estimation is the exact same configuration as Zhang. For that, disable the tangential distortion part of the model and limit the radial distortion model up to the 4th degree (est_dist = [1;1;0;0;0]), and activate the skew estimation (est_alpha = 1). After calibration, you should observe that our results are exactly the same asZhang's. To compare skew estimation, look at the camera matrix KK. Zhang's skew coefficient is defined as fc(1)*alpha_c, which is the (1,2) entry of the camera matrixKK. For more information, visit thepage describing the calibration parameters.

作为最后的终极比较,你可能希望运行和zhang同样的配置。那么,可以使切向失真无效,将径向失真模型设置为第四(est_dist=[1;1;0;0;0]),激活斜交系数估计(est_alpha=1)。完成校正后,可以看到我们的结果和zhang的一模一样。比较斜交系数,查看矩阵KK。zhang的斜交系数定义为fc(1)*alpha_c,就是矩阵KK的(1,2)。

You may also try to re-extract the square corners on the calibration images, by clicking onRecomp. corners. Select all the images, the window size of your choice (for example wintx = 6,winty = 6), and the automatic mode (required here). Then run calibration again, and compare the results. As a general advice, we recommend NOT to use such a pattern for calibration (disjoint squares generating asymmetric corner features) . It is better to use symmetric corner features such as the corners of a checkerboard pattern (the pattern used in thefirst example). To retrieve that pattern, visit that link.

你可能也试试重新提取角点,可以点击Recomp.corners。选择所有图片,设置窗口大小(比如wintx=6,winty=6),设置成自动模式。然后重新运行校正步骤,比较结果。作为一个建议,我们不推荐这种校正模式(从不对称的特征中提取角点)。最好是采用对称的角点特征,如棋盘格(我们前面用到的)。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值