Commit 06b233bd authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

corrected the output euler angle on y axis in RQDecomp3x3 (thanks to Lasve for the patch)

parent 3d92d4c0
...@@ -2913,17 +2913,17 @@ cvRQDecomp3x3( const CvMat *matrixM, CvMat *matrixR, CvMat *matrixQ, ...@@ -2913,17 +2913,17 @@ cvRQDecomp3x3( const CvMat *matrixM, CvMat *matrixR, CvMat *matrixQ,
/* Find Givens rotation for y axis. */ /* Find Givens rotation for y axis. */
/* /*
( c 0 s ) ( c 0 -s )
Qy = ( 0 1 0 ), c = m33/sqrt(m31^2 + m33^2), s = m31/sqrt(m31^2 + m33^2) Qy = ( 0 1 0 ), c = m33/sqrt(m31^2 + m33^2), s = -m31/sqrt(m31^2 + m33^2)
(-s 0 c ) ( s 0 c )
*/ */
s = matR[2][0]; s = -matR[2][0];
c = matR[2][2]; c = matR[2][2];
z = 1./sqrt(c * c + s * s + DBL_EPSILON); z = 1./sqrt(c * c + s * s + DBL_EPSILON);
c *= z; c *= z;
s *= z; s *= z;
double _Qy[3][3] = { {c, 0, s}, {0, 1, 0}, {-s, 0, c} }; double _Qy[3][3] = { {c, 0, -s}, {0, 1, 0}, {s, 0, c} };
CvMat Qy = cvMat(3, 3, CV_64F, _Qy); CvMat Qy = cvMat(3, 3, CV_64F, _Qy);
cvMatMul(&R, &Qy, &M); cvMatMul(&R, &Qy, &M);
...@@ -3016,7 +3016,7 @@ cvRQDecomp3x3( const CvMat *matrixM, CvMat *matrixR, CvMat *matrixQ, ...@@ -3016,7 +3016,7 @@ cvRQDecomp3x3( const CvMat *matrixM, CvMat *matrixR, CvMat *matrixQ,
if( eulerAngles ) if( eulerAngles )
{ {
eulerAngles->x = acos(_Qx[1][1]) * (_Qx[1][2] >= 0 ? 1 : -1) * (180.0 / CV_PI); eulerAngles->x = acos(_Qx[1][1]) * (_Qx[1][2] >= 0 ? 1 : -1) * (180.0 / CV_PI);
eulerAngles->y = acos(_Qy[0][0]) * (_Qy[0][2] >= 0 ? 1 : -1) * (180.0 / CV_PI); eulerAngles->y = acos(_Qy[0][0]) * (_Qy[2][0] >= 0 ? 1 : -1) * (180.0 / CV_PI);
eulerAngles->z = acos(_Qz[0][0]) * (_Qz[0][1] >= 0 ? 1 : -1) * (180.0 / CV_PI); eulerAngles->z = acos(_Qz[0][0]) * (_Qz[0][1] >= 0 ? 1 : -1) * (180.0 / CV_PI);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment