单面相机校准 [英] camera calibration for single plane

查看:77
本文介绍了单面相机校准的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题陈述很简单。但是我无法为我完成opencv校准工作。我正在从这里使用代码:源代码
我必须以固定距离平行于相机拍摄图像。我尝试拍摄仅与相机平行以及在不同平面上的测试图像(大约20张)。我也改变了大小和正方形的数目。

My problem statement is very simple. But I am unable to get the opencv calibration work for me. I am using the code from here : source code. I have to take images parallel to the camera at a fixed distance. I tried taking test images (about 20 of them) only parallel to the camera as well as at different planes. Also I changed the size and the no of squares.

在这种情况下校准的最佳方法是什么?

What would be the best way to calibrate in this scenario?

稍后会裁剪未失真的图像,这就是为什么它看起来更小的原因。

The undistorted image is cropped later, that's why it looks smaller.

仔细查看图像后,枕形失真似乎已得到纠正。但是梯形失真仍然存在。由于相机安装在密闭的盒子中,因此我可以拍摄图像的平面受到限制。

After going through the images closely, the pincushion distortion seems to have been corrected. But the "trapezoidal" distortion still remains. Since the camera is mounted in a closed box, the planes at which I can take images is limited.

推荐答案

考虑校准问题如找到投影矩阵P:

think about calibration problem as finding a projection matrix P:

image_points = P * 3d_points,其中P =内在*外在

image_points = P * 3d_points, where P = intrinsic * extrinsic

现在只是忍受我:
您基本上对内在部分感兴趣,但是校准算法必须同时找到内在和外在部分。现在,如果您选择无穷远处的3D点,例如xInf = [1、0、0、0],则可以获得投影矩阵的每一列。这一点是无穷大的,因为当您将其从齐次坐标转换为笛卡尔坐标时,会得到
[1/0,0,0]。如果将投影矩阵与无穷远的点相乘,将得到其对应的列(Xinf为第一列,yInf为第二列,zInf为第三列,相机中心为第四列)。

Now just bear with me: You basically are interested in intrinsic part but the calibration algorithm has to find both intrinsic and extrinsic. Now, each column of projection matrix can be obtained if you select a 3D point at infinity, for example xInf = [1, 0, 0, 0]. This point is at infinity because when you transform it from homogeneous coordinates to Cartesian you get [1/0, 0, 0]. If you multiply a projection matrix with a point at infinity you will get its corresponding column (1st for Xinf, 2nd for yInf, 3rd for zInf and 4th for camera center).

因此,结论很简单-要获得投影矩阵(这是成功的校准),您必须清楚地看到无穷大的点或会聚的线扩展中的消失点在您的棋盘装备中(也就是地平线上的铁轨尽头)。由于您的图像不会倾斜棋盘,也不会旋转或向后缩放,因此无法轻松检测消失点。因此,您的校准将始终失败。

Thus the conclusion is simple - to get a projection matrix (that is a successful calibration) you have to clearly see points at infinity or vanishing points from the converging extensions of lines in your chessboard rig (aka end of the railroad tracks at the horizon). Your images don’t make it easy to detect vanishing points since you don’t slant your chessboard, nor rotate nor scale it by stepping back. Thus your calibration will always fail.

这篇关于单面相机校准的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆