문제

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.

alt text

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?

도움이 되었습니까?

해결책

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.

다른 팁

I'm guessing the code uses the 'standard' formation - then you will find more details in the opencv library docs or their book.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top