Ask Your Question
0

SolvePnp rvec suddenly begins to give opposite/unexpected values , is this observed before?

asked 2017-03-16 18:08:15 -0600

Oguz gravatar image

I want to smooth motion of head by getting moving average of last 3 rvec and tvec vectors. But suddenly comes unexpected values of rvec,all values became negative :

3.15671 0.096776 0.32789 3.18738 0.0878376 0.336211 3.15005 0.0896022 0.337018 -3.06086 -0.0907339 -0.339971 -3.07529 -0.0846121 -0.343904 -3.08211 -0.0861078 -0.349439 ..... -3.03756 0.257243 -0.510188 -3.00875 0.241385 -0.505155 -3.0265 0.255717 -0.504729 3.13553 -0.306111 0.507516 3.12246 -0.339343 0.507442 3.11797 -0.409513 0.505041

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2017-03-16 20:53:47 -0600

Tetragramm gravatar image

If you want to average rotations together, the only sane method is quaternions.

First convert the rvec to a rotation matrix with the Rodrigues method.

Then convert the rotation matrix to a quaternion and average them. Convert the quaternion back to a rotation, then back to an rvec, if you need to.

edit flag offensive delete link more

Comments

Thank you very much.Could you recomend a reliable code for conversion pls.

Oguz gravatar imageOguz ( 2017-03-17 05:47:11 -0600 )edit

You see that link to euclidean space? That's the reliable code.There are version of that code all over the place, such as in Boost/Quaternions, but that's what they do.

Tetragramm gravatar imageTetragramm ( 2017-03-17 16:37:03 -0600 )edit

Thanks for the suggestion of http://www.boost.org/doc/libs/1_46_1/libs/math/doc/quaternion/html/ (Boost/Quaternions) - that library is surprisingly rarely referenced.

WillC gravatar imageWillC ( 2017-04-26 01:32:31 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2017-03-16 18:08:15 -0600

Seen: 539 times

Last updated: Mar 16 '17