三维扫描仪[5]——标定·Matlab双目标定

原文请参考相机校准:Toolbox for Matlab


此示例显示如何使用工具箱校准立体图像系统,并用其结果进行立体图像校正和3D立体三角测量。
下载stereo_example.zip(853Kb),它由14对相应的左右图像组成。图像被命名为left01.jpg,…,left14.jpg和right01.jpg,…,right14.jpg。这个压缩包包含单独的校准结果文件:Calib_Results_left.mat和Calib_Results_right.mat,使用上一篇博客中描述的程序,单独校准两个摄像机后生成。唯一的区别是,每个校准后,校准结果文件Calib_Results.mat已更名为任何Calib_Results_left.mat左相机或Calib_Results_right.mat为右相机。
在主matlab窗口中 输入stereo_gui运行主立体声校准工具箱。
这里写图片描述
单击工具箱的第一个按钮加载左右相机的校准文件
这里写图片描述
为左侧相机校准结果文件名 输入Calib_Results_left.mat:
这里写图片描述
输入Calib_Results_right.mat以获取正确的摄像机校准结果文件名称:
这里写图片描述


原文
The initial values for the intrinsic camera parameters are shown in addition to an estimate for the extrinsic parameters om and T characterizing the relative location of the right camera with respect to the left camera. The intrinsic parameters fc_left, cc_left, alpha_c_left, kc_left, fc_right, cc_right, alpha_c_right and kc_right are equivalent to the traditional parameters fc, cc, alpha_c and kc defined on the parameter description page. The two pose parameters om and T are defined such that if we consider a point P in 3D space, its two coordinate vectors XL and XR in the left and right camera reference frames respectively are related to each other through the rigid motion transformation XR = R * XL + T, where R is the 3x3 rotation matrix corresponding to the rotation vector om. The relation between om and R is given by the rodrigues formula R = rodrigues(om).


译文
除了用于表征右摄像机相对于左摄像机的相对位置的外在参数om和T的估计之外,还显示了内在摄像机参数的初始值。固有参数fc_left,cc_left,alpha_c_left,kc_left,fc_right,cc_right,alpha_c_right和kc_right等效于参数描述页面上定义的传统参数fc,cc,alpha_c和kc。定义两个姿态参数om和T,使得如果我们考虑3D空间中的点P,则左右相机参考帧中的两个坐标向量X L和X R分别通过刚体运动变换X相互关联R = R * X L + T,其中R是对应于旋转矢量om的3×3旋转矩阵。om和R之间的关系由rodrigues公式R = rodrigues(om)给出。

这里写图片描述


原文
Observe that all intrinsic and extrinsic parameters have been recomputed, together with all the uncertainties so as to minimize the reprojection errors on both camera for all calibration grid locations. You may observe that the uncertainties on the intrinsic parameters (especially that of the focal values) for both cameras are smaller after stereo calibration. This is due to the fact that the global stereo optimization is performed over a minimal set of unknown parameters. In particular, only one pose unknown (6 DOF) is considered for the location of the calibration grid for each stereo pair. This insures global rigidity of the structure going from left view to right view.
By default, the stereo optimization will recompute the intrinsic parameters for both left and right cameras. However, it may sometime be desirable to not re-optimize over the left and/or right camera intrinsic parameters and keep those previously estimated. In this case, the user may set recompute_intrinsic_left and/or recompute_intrinsic_right to zero prior to running stereo calibration. For more information type in your main matlab window help go_calib_stereo.


译文
观察所有内在参数和外部参数已被重新计算,连同所有不确定因素,以便最小化所有校准网格位置的摄像机上的再投影误差。您可能会观察到立体校准后两台摄像机的内在参数(特别是焦点值)的不确定性较小。这是由于全局立体优化是通过一组最小的未知参数进行的。特别地,对于每对立体系统,校准网格的位置仅考虑一个姿势未知(6自由度)。这确保了从左视图到右视图的结构的全局刚性。
默认情况下,立体优化将重新计算左右相机的内在参数。然而,有时可能不希望通过左和/或右照相机固有参数重新优化并保持先前​​估计的那些。在这种情况下,用户可以在运行立体校准之前将recompute_intrinsic_left和/或recompute_intrinsic_right设置为零。有关更多信息,请输入您的主要matlab窗口帮助go_calib_stereo。
这里写图片描述
可以通过点击工具箱中的“ 显示外观 ”按钮,以3D图形的形式显示两个摄像机和校准平面的空间配置。
这里写图片描述
最后,点击Rectify the calibration images,然后立即校正left_rectified01.bmp,right_rectified01.bmp,…,left_rectified14.bmp,right_rectified14.bmp所有14对图像。
这里写图片描述

这里写图片描述


The toolbox also includes a function stereo_triangulation.m that computes the 3D location of a set of points given their left and right image projections. This process is known as stereo triangulation. To learn about the syntax of the function type help stereo_triangulation in the main Matlab window. As an exercise, let’s apply the triangulation function on a simple example: let’s re-compute the 3D location of the grids points extracted on the first image pair {left01.jpg, right01.jpg}. After running through the complete stereo calibration example, the image projections of the grid points on the right and left images are available in the variables x_left_1 and x_right_1. In order to triangulate those points in space, invoke stereo_triangulation.m by inputting x_left_1,x_right_1, the extrinsic stereo parameters om and T and the left and right camera intrinsic parameters:

[Xc_1_left,Xc_1_right] = stereo_triangulation(x_left_1,x_right_1,om,T,fc_left,cc_left,kc_left,alpha_c_left,fc_right,cc_right,kc_right,alpha_c_right);

The output variables Xc_1_left and Xc_1_right are the 3D coordinates of the points in the left and right camera reference frames respectively (observe that Xc_1_left and Xc_1_right are related to each other through the rigid motion equation Xc_1_right = R * Xc_1_left + T ). It may be interesting to see that one can then re-compute the “intrinsic” geometry of the calibration grid from the triangulated structure Xc_1_left by undoing the left camera location encoded by Rc_left_1 and Tc_left_1:

X_left_approx_1 = Rc_left_1’ * (Xc_1_left - repmat(Tc_left_1,[1 size(Xc_1_left,2)]));

The output variable X_left_approx_1 is then an approximation of the original 3D structure of the calibration grid stored in X_left_1.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值