Obtain Rotation Axis from Rotation Matrix and translation vector in OpenCV

折月煮酒 提交于 2020-05-13 02:05:00

问题


I have a chessboard in two images with some angle of rotation. Lets find the rotation angle of second image with reference of first image.

For that I found the Rotation Matrix (3x3) and translation matrix (3x1) of those objects.

How can I find the Rotation Angle and Rotation Axis of object using those matrices?


回答1:


For every type of conversion between rotation representations you have this website euclidean space.

You will find theory and code samples of:

  • Rotation matrix to quaternion: link

  • Quaternion to axis angle: link

  • Rotations in general and all representations: link

And in relation to your question you have Axis Angle. If you have the rotation matrix R (3x3), you can obtain the angle and axis this way (see Matrix to Axis Angle):

  • angle = acos(( R00 + R11 + R22 - 1)/2);

  • Axis x,y,x:

    x = (R21 - R12)/sqrt((R21 - R12)^2+(R02 - R20)^2+(R10 - R01)^2);

    y = (R02 - R20)/sqrt((R21 - R12)^2+(R02 - R20)^2+(R10 - R01)^2);

    z = (R10 - R01)/sqrt((R21 - R12)^2+(R02 - R20)^2+(R10 - R01)^2);




回答2:


Already working wih openCV I would rcommend using the Rodrigues method: cv::Rodrigues(src, dst, jacobian), that computes the rotation vector if you have a rotation matrix for an argument and vice versa.



来源:https://stackoverflow.com/questions/12463487/obtain-rotation-axis-from-rotation-matrix-and-translation-vector-in-opencv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!