A question on Zhihu caught my attention: given several dozen measurements of an object's orientation, how do you find their average?
The measurements were available as rotation matrices and quaternions. It sounds like a routine calculation, until you ask what “average” means for a rotation.
Defining the average
The definition used here is geometric: given n elements , find a representative point
in the same space by minimizing a distance-based objective.
For rotations, that gives the following optimization problem:
The distance between two elements of SO(3) is defined by:
We can solve this numerically for a set of rotations. But is there an analytical solution?
Three approaches are easy to imagine:
- Convert to Euler angles and average the three components separately.
- Use quaternions and average their four components, following the method in the Unity discussion on quaternion averaging.
- Map the rotations to a tangent space with Log, average them in that vector space, then map the result back to SO(3) with Exp.
I implemented all three and compared them with numerical optimization on three randomly generated datasets.
Three comparisons
1. Rotations spread across SO(3). The first set is sampled uniformly over the rotation space.

Here are the results from the three averaging methods and numerical optimization:

The video puts the four results together.
2. Rotations close to the identity. The second set is sampled within a small neighborhood of SO3.Identity().


3. The same cluster, rotated elsewhere. For the third set, I left-multiplied every rotation in the second set by a randomly chosen rotation matrix.


What the experiments suggest
In these examples, none of the three shortcuts matches the numerical solution exactly. As of 2021, there seemed to be no analytical solution to the problem.
There is a useful approximation, though: when the input rotations are close to one another, the quaternion-averaging method can give a reasonably accurate result.