相机标定矩阵如何?
使用这个工具箱我正在对我的相机进行校准。
然而,工具箱以矩阵形式输出结果,作为一个菜鸟,我并不真正理解数学的东西。
该矩阵具有以下形式。
其中 R 是旋转矩阵,T 是平移向量。
这些是我从工具箱中得到的结果。它输出以像素为单位的值。
-0.980755 -0.136184 -0.139905 217.653207
0.148552 -0.055504 -0.987346 995.948880
0.126695 -0.989128 0.074666 371.963957
0.000000 0.000000 0.000000 1.000000
使用这些数据我可以知道我的相机旋转了多少以及它与校准物体的距离吗?
With this toolbox I was performing calibration of my camera.
However the toolbox outputs results in matrix form, and being a noob I don't really understand mathy stuff.
The matrix is in the following form.
Where R is a rotation matrix, T is a translation vector.
And these are the results I got from the toolbox. It outputs values in pixels.
-0.980755 -0.136184 -0.139905 217.653207
0.148552 -0.055504 -0.987346 995.948880
0.126695 -0.989128 0.074666 371.963957
0.000000 0.000000 0.000000 1.000000
Using this data can I know how much my camera is rotated and distance of it from the calibration object?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
距离部分很简单。来自原点的翻译由最右列中的前三个数字给出。这分别表示 x、y 和 z 方向上的平移。在您的示例中,相机的位置 p = (px, py, pz) = (217.653207, 995.948880, 371.963957)。您可以获取相机位置和校准对象位置之间的欧几里德距离(cx、cy、cz)。也就是说,它只是 sqrt( (px-cx)2 + (py-c y)2 + (pz-cz)2 )
更多困难的部分涉及矩阵左上角 3x3 元素中捕获的旋转。如果不确切知道他们是如何得出这个结论的,你就有点运气不好了。也就是说,如果您想要的话,将其转换回欧拉角并不容易。但是,您可以将这些元素转换为四元数旋转,这将为您提供独特的单位向量和角度将相机旋转到该方向。 此处提供了计算的具体细节。一旦有了四元数旋转,您就可以轻松地将其应用于向量 n = (0, 0, 1)、up = (0, 1, 0) 和 right = (1, 0, 0) 以获得法线(方向相机指向),向上和向右向量。仅当您有兴趣将相机从当前位置向左或向右旋转时,右矢量才有用。
The distance part is easy. The translation from the origin is given by the first three numbers in the rightmost column. This represents the translation in the x, y, and z directions respectively. In your example, the camera's position p = (px, py, pz) = (217.653207, 995.948880, 371.963957). You can take the Euclidean distance between the camera's location and the location of the calibration object (cx, cy, cz). That is it would just be sqrt( (px-cx)2 + (py-cy)2 + (pz-cz)2 )
The more difficult part regards the rotation which is captured in the upper left 3x3 elements of the matrix. Without knowing exactly how they arrived at this, you're somewhat out of luck. That is, it's not easy to convert that back to Euler Angles, if that's what you want. However, you can transform those elements into a Quaternion Rotation which will give you the unique unit vector and angle to rotate the camera to that orientation. The specifics of the computation are provided here. Once you have the Quaternion rotation, you can easily apply it to the vectors n = (0, 0, 1), up = (0, 1, 0) and right = (1, 0, 0) to get the normal (direction the camera is pointed), up and right vectors. The right vector is only useful if you are interested in slewing the camera left or right from its current position.
我猜代码使用 '标准' 格式 - 那么你将在 opencv 库文档 或其书中找到更多详细信息。
I'm guessing the code uses the 'standard' formation - then you will find more details in the opencv library docs or their book.