I get many rotation vectors from pose estimation of many frames (while camera is stationary) and I want the most accurate measure. Theoretically Can I average through rotation vector\matrices\other kind of data? or is that wrong? in addition, how can I tell when a rotation vector\matrix is an outlier (i.e. very different from all the others and may be a miscalculation)? for example, in translation matrix I see the difference in centimeters of every entry and can have an intuitive threshold. Is there a similar way in rotation?
-
1have a look at: https://stackoverflow.com/questions/12374087/average-of-multiple-quaternions – Micka Jul 25 '18 at 11:14
-
Thank you , I'm working in euclidean system and not quaternions so I still not sure how to do it in euclidean system. – Alophind Jul 26 '18 at 12:21
-
sometimes it might be wise to temporarily convert between different systems to perform computations difficult in one system. Not sure whether this is the case here ;) – Micka Jul 26 '18 at 12:29
2 Answers
One way, if you want to average rotations that are 'close', is to seek, in analogy with the mean of say numbers, the value that minimises the 'dispersion'. For numbers x[], the mean is what mimnimises
disp = Sum{ i | sqr( x[i]-mean)}
So for rotations R[] we can seek a rotation Q to minimise
disp = Sum{ i | Tr( (R[i]-Q)'*(R[i]-Q))}
where Tr is the trace and ' denotes transpose. Note that writing things this way does not change what we are tring to minimise, it just makes the algebra easier.
That particular measure of dispersion leads to a practical way of computing Q:
a/ compute the 'mean matrix' of the rotations
M = Sum{ i | R[i] } /N
b/ take the SVD of that
M = U*D*V'
c/ compute the rotation closest to M
Q = U*V'

- 4,211
- 2
- 14
- 12
-
Could you comment on`Tr( (R[i]-Q)'*(R[i]-Q))` ? `Tr` is the trace .. what is the apostrophe? Why is this the thing to minimize? – wcochran Sep 24 '22 at 14:45
-
You may not average rotation matrices, specifically not, when you use the term "most accurate". But let's go back to start: Matrix multiplications, i.e. rotations, do not commute. ABC != BAC != CBA ... the outcomes can be as dramatically apart as imaginable.
As far the outliers go: use quaternions instead of rotation matrices. Firstly, the amount of calculation steps can be minimised leading to higher performance there are tons of implementations of that online. And secondly by building euclidean norms on the quaternions, you get a good measure for outliers.

- 3,412
- 1
- 14
- 22
-
Unfortunately, even if the input matrices are *supposed* to be pure rotation matrices, often times, data can be a little imprecise. In order to convert an input matrix into a quaternion to find the average, one must first find the nearest rotation matrix to the input matrix. HOWEVER, the *same solution* can be found by summing all of the input matrices together, then finding then nearest rotation matrix to that sum, as stated by dmuir. – Trey Reynolds Jul 26 '22 at 01:52