OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Wed, 26 Apr 2017 01:29:46 -0500Need explaination about rvecs returned from SolvePnPhttp://answers.opencv.org/question/134017/need-explaination-about-rvecs-returned-from-solvepnp/I am using ArUco for pose estimation and i want to get the global world coordinates of my camera using say a single detected aruco marker. For this, I need to know the rotation of camera wrt marker along y axies (upward/downward axis). The output of ArUco /SolvePnP gives me rvecs which contains rotation vector. Now, I really don't understand how this rotation vector represents the angle of rotation. I can convert it to rotation matrix using Rodrigues but still i don't get the actual roll, yaw, pitch angles (or rotation along x,y and z axes) which i really need.
So, can anyone please explain how to manipulate rotation using the rotation vector in rvecs and also how to get simple rotation angles along the three axes from them. ThanksTue, 14 Mar 2017 08:48:04 -0500http://answers.opencv.org/question/134017/need-explaination-about-rvecs-returned-from-solvepnp/Comment by Tetragramm for <p>I am using ArUco for pose estimation and i want to get the global world coordinates of my camera using say a single detected aruco marker. For this, I need to know the rotation of camera wrt marker along y axies (upward/downward axis). The output of ArUco /SolvePnP gives me rvecs which contains rotation vector. Now, I really don't understand how this rotation vector represents the angle of rotation. I can convert it to rotation matrix using Rodrigues but still i don't get the actual roll, yaw, pitch angles (or rotation along x,y and z axes) which i really need.</p>
<p>So, can anyone please explain how to manipulate rotation using the rotation vector in rvecs and also how to get simple rotation angles along the three axes from them. Thanks</p>
http://answers.opencv.org/question/134017/need-explaination-about-rvecs-returned-from-solvepnp/?comment=134217#post-id-134217It looks like you don't really understand what's being represented by these angles. Check out [this page](http://www.euclideanspace.com/maths/geometry/rotations/euler/index.htm) and try to understand what that means, and how to reverse it. The [drawAxis](http://docs.opencv.org/master/d9/d6a/group__aruco.html#ga16fda651a4e6a8f5747a85cbb6b400a2) function from the ARUCO can be a useful tool.Wed, 15 Mar 2017 17:18:33 -0500http://answers.opencv.org/question/134017/need-explaination-about-rvecs-returned-from-solvepnp/?comment=134217#post-id-134217Comment by b2meer for <p>I am using ArUco for pose estimation and i want to get the global world coordinates of my camera using say a single detected aruco marker. For this, I need to know the rotation of camera wrt marker along y axies (upward/downward axis). The output of ArUco /SolvePnP gives me rvecs which contains rotation vector. Now, I really don't understand how this rotation vector represents the angle of rotation. I can convert it to rotation matrix using Rodrigues but still i don't get the actual roll, yaw, pitch angles (or rotation along x,y and z axes) which i really need.</p>
<p>So, can anyone please explain how to manipulate rotation using the rotation vector in rvecs and also how to get simple rotation angles along the three axes from them. Thanks</p>
http://answers.opencv.org/question/134017/need-explaination-about-rvecs-returned-from-solvepnp/?comment=134344#post-id-134344Yeah I'm a bit confused with these values as this is the first time I am doing pose estimation. My concept till now is that I need the rotation angle along y-axis to find the world coordinates of my camera. For this, I am trying to find the rotation along y-axis but I am getting the rotation angle along z-axis correctly. Please correct me if I am wrong in my concept or my approach for calculating camera's world coordinates.
Also, I have gone through the articles you advised and I am already using the drawAxis function of ArUco. ThanksThu, 16 Mar 2017 07:59:18 -0500http://answers.opencv.org/question/134017/need-explaination-about-rvecs-returned-from-solvepnp/?comment=134344#post-id-134344Comment by b2meer for <p>I am using ArUco for pose estimation and i want to get the global world coordinates of my camera using say a single detected aruco marker. For this, I need to know the rotation of camera wrt marker along y axies (upward/downward axis). The output of ArUco /SolvePnP gives me rvecs which contains rotation vector. Now, I really don't understand how this rotation vector represents the angle of rotation. I can convert it to rotation matrix using Rodrigues but still i don't get the actual roll, yaw, pitch angles (or rotation along x,y and z axes) which i really need.</p>
<p>So, can anyone please explain how to manipulate rotation using the rotation vector in rvecs and also how to get simple rotation angles along the three axes from them. Thanks</p>
http://answers.opencv.org/question/134017/need-explaination-about-rvecs-returned-from-solvepnp/?comment=134165#post-id-134165I tried with Matrix to Euler conversion as implemented in the link shared by @Eduardo. The attitude is giving angles fine which in my case is rotation along the z-axis (that is line between camera and marker). The other two angles' values are not making sense. I actually want the rotation angle along y-axis (that is the line going upwards or downwards). Any ideas where am I going wrong ?Wed, 15 Mar 2017 06:08:49 -0500http://answers.opencv.org/question/134017/need-explaination-about-rvecs-returned-from-solvepnp/?comment=134165#post-id-134165Comment by Eduardo for <p>I am using ArUco for pose estimation and i want to get the global world coordinates of my camera using say a single detected aruco marker. For this, I need to know the rotation of camera wrt marker along y axies (upward/downward axis). The output of ArUco /SolvePnP gives me rvecs which contains rotation vector. Now, I really don't understand how this rotation vector represents the angle of rotation. I can convert it to rotation matrix using Rodrigues but still i don't get the actual roll, yaw, pitch angles (or rotation along x,y and z axes) which i really need.</p>
<p>So, can anyone please explain how to manipulate rotation using the rotation vector in rvecs and also how to get simple rotation angles along the three axes from them. Thanks</p>
http://answers.opencv.org/question/134017/need-explaination-about-rvecs-returned-from-solvepnp/?comment=134024#post-id-134024- First, choose an [Euler convention](https://en.wikipedia.org/wiki/Euler_angles).
- Then convert the Rodrigues angle vector to a rotation matrix.
- FInally, [extract the Euler angles](http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToEuler/) from the rotation matrix according to the selected convention.
Note: it is also possible to compute the Euler angles directly from the Rodrigues (axis-angle) rotation vector. You just need to find the correct equations.Tue, 14 Mar 2017 09:20:57 -0500http://answers.opencv.org/question/134017/need-explaination-about-rvecs-returned-from-solvepnp/?comment=134024#post-id-134024Comment by WillC for <p>I am using ArUco for pose estimation and i want to get the global world coordinates of my camera using say a single detected aruco marker. For this, I need to know the rotation of camera wrt marker along y axies (upward/downward axis). The output of ArUco /SolvePnP gives me rvecs which contains rotation vector. Now, I really don't understand how this rotation vector represents the angle of rotation. I can convert it to rotation matrix using Rodrigues but still i don't get the actual roll, yaw, pitch angles (or rotation along x,y and z axes) which i really need.</p>
<p>So, can anyone please explain how to manipulate rotation using the rotation vector in rvecs and also how to get simple rotation angles along the three axes from them. Thanks</p>
http://answers.opencv.org/question/134017/need-explaination-about-rvecs-returned-from-solvepnp/?comment=144010#post-id-144010Don't know whether you got your answer yet, but bear in mind that (1) solvePnP gives you the translation from the camera coordinate frame to the object coordinate frame as tvec, and the rotation from the camera frame to the object frame as rvec , and (2) - which always gets me - that OpenCV specifies the camera coordinate frame as +Z=forward=from camera sensor through lens into the world, +X=right, +Y=downWed, 26 Apr 2017 01:25:40 -0500http://answers.opencv.org/question/134017/need-explaination-about-rvecs-returned-from-solvepnp/?comment=144010#post-id-144010Comment by WillC for <p>I am using ArUco for pose estimation and i want to get the global world coordinates of my camera using say a single detected aruco marker. For this, I need to know the rotation of camera wrt marker along y axies (upward/downward axis). The output of ArUco /SolvePnP gives me rvecs which contains rotation vector. Now, I really don't understand how this rotation vector represents the angle of rotation. I can convert it to rotation matrix using Rodrigues but still i don't get the actual roll, yaw, pitch angles (or rotation along x,y and z axes) which i really need.</p>
<p>So, can anyone please explain how to manipulate rotation using the rotation vector in rvecs and also how to get simple rotation angles along the three axes from them. Thanks</p>
http://answers.opencv.org/question/134017/need-explaination-about-rvecs-returned-from-solvepnp/?comment=144012#post-id-144012This question, comments, and answers should help point you in the right direction too: http://answers.opencv.org/question/92211/solvepnp-inconsistency-when-rotating-markers-on-a-plane/Wed, 26 Apr 2017 01:29:46 -0500http://answers.opencv.org/question/134017/need-explaination-about-rvecs-returned-from-solvepnp/?comment=144012#post-id-144012Comment by Tetragramm for <p>I am using ArUco for pose estimation and i want to get the global world coordinates of my camera using say a single detected aruco marker. For this, I need to know the rotation of camera wrt marker along y axies (upward/downward axis). The output of ArUco /SolvePnP gives me rvecs which contains rotation vector. Now, I really don't understand how this rotation vector represents the angle of rotation. I can convert it to rotation matrix using Rodrigues but still i don't get the actual roll, yaw, pitch angles (or rotation along x,y and z axes) which i really need.</p>
<p>So, can anyone please explain how to manipulate rotation using the rotation vector in rvecs and also how to get simple rotation angles along the three axes from them. Thanks</p>
http://answers.opencv.org/question/134017/need-explaination-about-rvecs-returned-from-solvepnp/?comment=134095#post-id-134095Check out [Euclidean Space](http://euclideanspace.com/maths/geometry/rotations/conversions/index.htm). It has explanations for, and equations to get from anything to just about anything.Tue, 14 Mar 2017 18:50:31 -0500http://answers.opencv.org/question/134017/need-explaination-about-rvecs-returned-from-solvepnp/?comment=134095#post-id-134095