OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Mon, 16 Apr 2018 10:54:16 -0500Obtaining Euler angles from Rodrigues Rotation Matrixhttp://answers.opencv.org/question/189455/obtaining-euler-angles-from-rodrigues-rotation-matrix/ Hi,
I wish to extract Euler angles from the **rvec** output parameter of [cv::solvePnp](https://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#bool%20solvePnP(InputArray%20objectPoints,%20InputArray%20imagePoints,%20InputArray%20cameraMatrix,%20InputArray%20distCoeffs,%20OutputArray%20rvec,%20OutputArray%20tvec,%20bool%20useExtrinsicGuess,%20int%20flags)).
I understand that 3x1 rvec needs to be passed on to the [Rodrigues](https://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#void%20Rodrigues(InputArray%20src,%20OutputArray%20dst,%20OutputArray%20jacobian)) function to obtain the 3x3 rotation matrix.
But to obtain Euler Angles, I need to use a fixed convention ( see [this](https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix) , for example Z-Y-X,etc ) which requires the rotation matrix to be obtained from a **permutation (fixed order) of multiplication of Matrices** ,
**eg: for Z-Y-X convention,
R_resultant = Rz * Ry * Rx**.
I have looked into the source code [here](https://github.com/opencv/opencv/blob/master/modules/calib3d/src/calibration.cpp#L251) for Rodrigues function but don't quite understand how the matrix is formed Hence -
**My Question**: What is the **convention** (Z-Y-X, X-Y-Z, etc) of the formation of the 3x3 Rotation matrix obtained from Rodrigues ? Without this information I cannot obtain Euler angles. I have seen [this tutorial](https://github.com/opencv/opencv/blob/master/samples/cpp/tutorial_code/calib3d/real_time_pose_estimation/src/Utils.cpp#L189) for real time pose estimation, but unfortunately I don't understand the assumption for the convention (and hence I had made another question for that - [here](http://answers.opencv.org/question/189414/issue-in-opencv-sample-tutorial-for-real-time-pose-estimation/?comment=189453#post-id-189453)).malharjajooMon, 16 Apr 2018 10:54:16 -0500http://answers.opencv.org/question/189455/Rotation Vectors and Translation Vectorshttp://answers.opencv.org/question/14256/rotation-vectors-and-translation-vectors/Hii , I am using cvCalibrateCamera2(....) function in opencv . Here one of the output that I get is the rotation_vectors which is Nx3 matrix . I have seen the documentation and it says look at cvRodrigues2() function for further details . And I have understood that cvRodrigues2() function converts the a 1x3 rotation vector to a 3x3 rotation matrix . My question is which 1x3 rotation vector out of the N , should be inputted to cvRodrigues2() function for calculating the Rotation Matrix ?? sachin_rtThu, 30 May 2013 00:03:41 -0500http://answers.opencv.org/question/14256/Rotation Matrix calculation using cvRodrigues , Calculating real world coordinates from pixel world coordinates .http://answers.opencv.org/question/14969/rotation-matrix-calculation-using-cvrodrigues-calculating-real-world-coordinates-from-pixel-world-coordinates/Hii I want to get real world (X,Y,Z) coordinates of an object from live capture from a PTZ camera .
I have found the intrinsic parameters , and using chessboard calibration with 15 chessboard images . I have also found the extrinsic prameters . I know Z coordinate cannot be found using a single camera .
To do this I need to find rotation and translation matrix . I have a doubt that for finding rotation matrix cvRodrigues() function will convert a rotation vector to 3x3 rotation matrix , but here I will have 15 rotation vectors . Which one should I use for finding the rotation matrix ??
Also I want to know if I happen to pan or tilt my camera from the original calibration position . will i have to recalculate my rotation matrix and translation matrix or can i use the old ones ?? sachin_rtTue, 11 Jun 2013 00:20:46 -0500http://answers.opencv.org/question/14969/