First calibration example - Corner extraction, calibration, additional tools (二)

来源:互联网 发布:money for mac 破解版 编辑:程序博客网 时间:2024/06/02 15:52
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

中间省略较为简单的一部分

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

In order to make a decision on the appropriate distortion model to use, it is sometimes very useful to visualize the effect of distortions on the pixel image, and the importance of the radial component versus the tangential component of distortion. For this purpose, run the script visualize_distortions at the matlab prompt (this function is not yet linked to any button in the GUI window). The three following images are then produced:
为了决定一个合适的失真模型,有时候使失真图像可视化非常有用,径向分量(radical component)和切向分量(tangential component)的重要性。为了这个目的,运行visualize_distortions(这个不在gui窗口上,要在命令行上输入)。将会生成以下三幅图像:

The first figure shows the impact of the complete distortion model (radial + tangential) on each pixel of the image. Each arrow represents the effective displacement of a pixel induced by the lens distortion. Observe that points at the corners of the image are displaced by as much as 25 pixels. The second figure shows the impact of the tangential component of distortion. On this plot, the maximum induced displacement is 0.14 pixel (at the upper left corner of the image). Finally, the third figure shows the impact of the radial component of distortion. This plot is very similar to the full distortion plot, showing the tangential component could very well be discarded in the complete distortion model. On the three figures, the cross indicates the center of the image, and the circle the location of the principal point. 
第一副图片显示了径向失真和切向失真的综合影响。每个箭头代表每个像素的移位方向(由失真引起的)。通过观察可以看出图像四角的移位在25个像素点左右。第二幅图片显示了切向失真。在这幅图中最大的移位是0.14个像素(在左上角位置)。最后,第三幅图片显示径向失真。这幅图片给第一副图片很相似,表示切向失真在整个失真模型中可以被合理地丢弃。在这三幅图片中,十字叉表示图片的中心,圆圈是光主中心点。

Now, just as an exercise (not really recommended in practice), let us run an optimization without the lens distortion model (by enforcingkc = [0;0;0;0;0]) and without aspect ratio (by enforcing both components offc to be equal). For that, set the binary variables est_dist to[0;0;0;0;0] andest_aspect_ratio to0 at the matlab prompt:
现在,作为一个练习(实际不是很推荐),让我们运行没有失真模型的最优化(强制校正系数kc=[0;0;0;0;0]),令est_dist=[0;0;0;0;0],est_aspect_radio=0。

Then, run a new optimization by clicking on Calibration:

点击Calibration来运行最优化:

As expected, the distortion coefficient vector kc is now zero, and both components of the focal vector are equal (fc(1)=fc(2)). In practice, this model for calibration is not recommended: for one thing, it makes little sense to estimate skew without aspect ratio. In general, unless required by a specific targeted application, it is recommended to always estimate the aspect ratio in the model (it is the 'easy part'). Regarding the distortion model, people often run optimization over a subset of the distortion coefficients. For example, setting est_distto[1;0;0;0] keeps estimating the first distortion coefficient kc(1) while enforcing the three others to zero. This model is also known as the second order symmetric radial distortion model. It is a very viable model, especially when using low distortion optical systems (expensive lenses), or when only a few images are used for calibration. Another very common distortion model is the 4th order symmetric radial distortion with no tangential component (est_kc = [1;1;0;0]). This model, used byZhang, is justified by the fact that most lenses currently manufactured do not have imperfection in centering (for more information, visit thispage). This model could have very well been used in this present example, recalling from the previous three figures that the tangential component of the distortion model is significantly smaller that the radial component.
就像期望的那样,现在校正系数矩阵kc现在是0,两个焦距相等。实际上,这种标定不推荐使用。第一,没有高宽比来讨论斜交没有意义。通常来说,除非是特定的应用,高宽比总是被估计的。对于失真模型来说,人们总是在失真系数的一个子集上运行最优化过程。比如,设est_dist为[1;0;0;0]来估计系数kc(1)而剩下的3个设为0。这个模型也被称为第二对称径向失真模型。这是个非常可行的模型,特别是当使用低失真系统时(好的镜头时),或者是图像个数较少时。另外一个常用的失真模型是第四对称径向失真模型(切向失真为0,est_kc=[1;1;0;0])。这个模型被张正友采用,是基于现在绝大多数的镜头没有中心缺陷的事实。这个模型在本例子中用的很好,可以回想一下上面的三幅图像中切向失真要远远小于径向失真。

Finally, let us run a calibration rejecting the aspect ratio fc(2)/fc(1), the principal point cc, the distortion coefficients kc, and the skew coefficient alpha_c from the optimization estimation. For that purpose, set the four binary variables est_aspect_ration, center_optimest_dist and est_alpha to the following values: 
最后,让我们运行高宽比fc(2)/fc(1),主中心点cc,校正系数kc和斜交系数alpha_c的最优化估计。为了这个目的,将设置一下值:

Generally, if the principal point is not estimated, the best guess for its location is the center of the image: 
通常来说,如果主中心点没有确定下来,那么最好的估计就是图片的中心:

Then, run a new optimization by clicking on Calibration
接下来,运行Calibration:

Observe that the principal point cc is still at the center of the image after optimization (since center_optim=0).
可以看到,主中心点依然是图像的中心。
Next, load the old calibration results previously saved in Calib_Results.mat by clicking on Load:

现在点击工具箱上的Load按钮可以加载以前保存的Calib_Results.mat数据。

 

0 0
原创粉丝点击