OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Thu, 29 Jun 2017 13:50:35 -0500how to get angles of x y z in pose estimation?http://answers.opencv.org/question/160041/how-to-get-angles-of-x-y-z-in-pose-estimation/ i use landmark to extract face points and use solvePnP to estimate head pose but now i don't know how calculate head angles from X, Y and Z axis with solvePnP output parameters ?
i try to convert rvet values to degree but seem some times values bigger than 180 !!!Wed, 14 Jun 2017 00:45:20 -0500http://answers.opencv.org/question/160041/how-to-get-angles-of-x-y-z-in-pose-estimation/Answer by Ice_T02 for <p>i use landmark to extract face points and use solvePnP to estimate head pose but now i don't know how calculate head angles from X, Y and Z axis with solvePnP output parameters ?
i try to convert rvet values to degree but seem some times values bigger than 180 !!!</p>
http://answers.opencv.org/question/160041/how-to-get-angles-of-x-y-z-in-pose-estimation/?answer=160123#post-id-160123You want to obtain yaw, pitch and roll from 3x1 rotation Vector, if i understand you correctly.
You should first use function "Rodrigues" to create a 3x3 rotation matrix out of it. Write something like:
cv::Mat rotMat(3,3, CV_64FC1);
cv::Rodrigues(rotVec.at(0), rotMat); //convert 3x1 to 3x3
Next i suggest you have a look at [this](http://planning.cs.uiuc.edu/node103.html). Its more or less what you require!
Wed, 14 Jun 2017 03:40:16 -0500http://answers.opencv.org/question/160041/how-to-get-angles-of-x-y-z-in-pose-estimation/?answer=160123#post-id-160123Comment by Ice_T02 for <p>You want to obtain yaw, pitch and roll from 3x1 rotation Vector, if i understand you correctly.</p>
<p>You should first use function "Rodrigues" to create a 3x3 rotation matrix out of it. Write something like:</p>
<pre><code>cv::Mat rotMat(3,3, CV_64FC1);
cv::Rodrigues(rotVec.at(0), rotMat); //convert 3x1 to 3x3
</code></pre>
<p>Next i suggest you have a look at <a href="http://planning.cs.uiuc.edu/node103.html">this</a>. Its more or less what you require!</p>
http://answers.opencv.org/question/160041/how-to-get-angles-of-x-y-z-in-pose-estimation/?comment=160546#post-id-160546"*Each quadrant should be chosen by using the signs of the numerator and denominator of the argument. The numerator sign selects whether the direction will be above or below the x-axis, and the denominator selects whether the direction will be to the left or right of the y-axis. This is the same as the atan2 function in the C programming language, which nicely expands the range of the arctangent to [0,2pi]*"
The part where it states "*This is the same as the 2*" ... for some reason its cut off ... its atan2.
Please also be aware of the last sentence ... "*Note that this method assumes r11 != 0 + r33 != 0.*"Fri, 16 Jun 2017 03:09:29 -0500http://answers.opencv.org/question/160041/how-to-get-angles-of-x-y-z-in-pose-estimation/?comment=160546#post-id-160546Comment by aligoglos for <p>You want to obtain yaw, pitch and roll from 3x1 rotation Vector, if i understand you correctly.</p>
<p>You should first use function "Rodrigues" to create a 3x3 rotation matrix out of it. Write something like:</p>
<pre><code>cv::Mat rotMat(3,3, CV_64FC1);
cv::Rodrigues(rotVec.at(0), rotMat); //convert 3x1 to 3x3
</code></pre>
<p>Next i suggest you have a look at <a href="http://planning.cs.uiuc.edu/node103.html">this</a>. Its more or less what you require!</p>
http://answers.opencv.org/question/160041/how-to-get-angles-of-x-y-z-in-pose-estimation/?comment=160217#post-id-160217but whats mean 2(r21,r11) ? mean of ',' its product or other mean ?Wed, 14 Jun 2017 12:14:41 -0500http://answers.opencv.org/question/160041/how-to-get-angles-of-x-y-z-in-pose-estimation/?comment=160217#post-id-160217Comment by swiss_knight for <p>You want to obtain yaw, pitch and roll from 3x1 rotation Vector, if i understand you correctly.</p>
<p>You should first use function "Rodrigues" to create a 3x3 rotation matrix out of it. Write something like:</p>
<pre><code>cv::Mat rotMat(3,3, CV_64FC1);
cv::Rodrigues(rotVec.at(0), rotMat); //convert 3x1 to 3x3
</code></pre>
<p>Next i suggest you have a look at <a href="http://planning.cs.uiuc.edu/node103.html">this</a>. Its more or less what you require!</p>
http://answers.opencv.org/question/160041/how-to-get-angles-of-x-y-z-in-pose-estimation/?comment=162831#post-id-162831atan2 function requires two arguments ; y and x. The comma is only the separator between the two arguments.Thu, 29 Jun 2017 13:50:35 -0500http://answers.opencv.org/question/160041/how-to-get-angles-of-x-y-z-in-pose-estimation/?comment=162831#post-id-162831