Averaging rotation

Hello,

I am new to this forum, (and to this field) but there are great materials here, thanks for your effort. (and excuse me for my naive understanding …)

I came from the MRI neuro imaging community where where realignment between to image is a primary task. Every one is working with the Euler representation, and I thinks for the purpose (coregistration) it is just find. ( it is a mess because of different convention used by different software, but manageable)

I am also working on simulation of MRI acquisition during subject motion within the scanner, and I add to solve then a “new” problem :
How to compute an average affine ?

(Just for the context, I need this average, to remove it from the input motion time course, so that the simulated volume would be at the same spatial position as the motion free volume)

If I have only translation then the solution is simple : it is a simple vector arithmetic mean
but for rotation things get more complicate,
I saw a few mathematical paper on this topic, and then I realised the importance of dual quaternion and finally I come to look at PGA

So my question is to know if PGA will have a “smarter” answer to this question … ?

There are several possible generalizations of the mean to spherical quantities, none of them perfectly analogous to the affine mean.

Maybe start with Buss & Fillmore (2001) “Spherical Averages and Applications to Spherical Splines and Interpolation.”


One thing I find works okay in practice for small regions is to take your n-sphere and stereographically project it around some point roughly in the center of your region, then just take the regular mean in the new flat coordinate system.

If you want something that will be invariant under rotation you can iterate (re-center your stereographic projection at the mean you found and use the new projection to find a new mean, then repeat until the result stops changing).

Sorry I a new to this field, and I just starting reading the amazing documentation found on this forum.

thanks for your response, but It seems a bit difficult …

Why not just take the ‘regular’ means of n motors (as the average rotations of the n rotations written with the n motors ) ?

I recently compared 3 norms for comparing an averaging rotation, using some GA to do the analysis, but with classicallly implementable results.

Optimal Combination of Orientation Measurements Under Angle, Axis and Chord Metrics

https://link.springer.com/chapter/10.1007/978-3-030-74486-1_4

Leo Dorst

2 Likes

@LeoDorst you might be interested in using a rational parametrization (if you like, you can think of taking a stereographic projection centered at the midpoint, and then linearly interpolating in projected space) as an alternative to slerp or chord-based interpolation. For moderately sized angles this behaves much better than chordal interpolation and doesn’t require a square root every time. If you need to compute many intermediate rotations it is significantly less expensive than slerp.

If you really decide you need slerp, you can furthermore compose with a fast approximation of the tangent function and cut all the transcendental functions:

1 Like

Hi Leo,

Thanks you very much for this nice paper, I really appreciate reading it, although I do not have the math level to fully follow the derivations, but I am find to just take the results.
I like the clears up of the mysterious nature of quaternions and the claim to study the different averaging techniques in a unified framework is also very nice. (and the PGA introduction was also great !)

Never the less I am still lost probably at a higher level

What is not clear to me is why there is not a unique solution to the averaging problem. I am certainly bias by the specific problem I try to solve, since I do observe a unique solution …
So why the math’s answer is : it depends on a metric choice … (It does not for translation there is a unique average, why not for rotation, they are both motion … !)

I probably miss something, so let say it depends on the metric choice, So the question becomes, which one to chose ? Or how to interpret those 3 different choices ?.
In a first reading I though the Arc Metric would be only related to the ange difference between 2 position whereas the bivector metric, will take into account the rotation axis difference … what about the third one the Chord Metric is a mixt of both ?
But then in section 4 figure 4 you show rotor with the same distance and you point out that some differ mainly in angle and others mainly in rotation plane … and later one that the same picture can be draw for the arc metric … so does the arc metric also show difference in the rotation plane (or rotation axis orientation) ? If yes then my first initial understanding of the Arc Metric should be wrong …

I like you interpretation with the noise model, which would make an argument to choose one of this 3 metric (although for the chord metric, you did not present it with a noise perturbation … why ?). Any way for my particular application, (averaging a ‘random’ head motion, I do not see an argument for choosing one of the 2 noise models … in this case I do have changes in angle and axis … (it is not a perturbation around a single pose estimate) )

May be there is no problem at all, since you demonstrate that the 3 estimators will give very close result (in a first order approximation). So if I work only with small motions, may be I do not care, and just take the chord estimator, which is the most simple expression and just a “normal” average !

Now I get even more confused since i read this note from @enki about averaging orientations

So what is the link between this Karcher mean and the chord estimator which I report here for completness

so which one to use ???

Dear Romain,

You have read the paper well, and I would say your understanding of the consequences is about what I learned from doing it as well… There does seem to be very little to choose between the metrics, if you have no physical reason in the process you are studying. There are physiological measurement of how ‘near’ in actuation space various motions are, based on biological control feedback loops. Perhaps those also exist for head motions, and perhaps one of the algebraic methods would approximate those better than another one (you know, like the non-linear perception metric on colors); or could be seen as a weighted version of one of the metrics. The Inertial properties of the head should also play a role in that, I am now writing a tutorial on dynamics in PGA which might be issued around Christmas. Besides the algebraic reason of ease of processing I mentioned (which you picked up on), those real-world aspects might be a way of choosing between them for the larger rotations.

Cheers,
Leo

P.S. I actually wrote most of this paper (including the Kalman part) 20 years ago – I did check whether things happened since then, perhaps in satellite adjustment, but only found the new unifying framework as a reason to redo the structure of the paper.

The Karcher souds like one is averaging the bivectors (since it involves the logarithms). Except that it iteraties, which may correspond to the difficulty of ding it in closed form…

Hi Romain, maybe you are aware, but in case you are not, there is a closed form solution for the averaging of rotors under the chord metric.

Basically you have this optimization problem: \argmin_R \sum_i \| <R_i \tilde R>_2\|^2

where <R_i \tilde R>_2 is the bivector part of the geometric product. The norm of that bivector is \| <R_i R>_2\| = \sin \theta/2 so this functional is minimizing the \sin^2 \theta/2 which is the same measure that the chord distance is minimizing for rotation matrices under Frobenius norm (up to a scalar).

This problem can be restated as \argmax_R \sum_i \| <R_i \tilde R>_0\|^2

which is maximizing \cos^2 \theta/2. This is convenient since this can be expressed as a quadratic form on the 4D vector space like:

\argmax_R R^T M R

where R is just a 4D vector and the matrix M = \sum_i R_i R_i^T, where R_i are 4D vectors. The quadratic form is maximized when R is equal to the eigenvector of M associated with the max eigenvalue.

That is a well known solution on quaternions derived by Markley et al (http://www.acsu.buffalo.edu/~johnc/ave_quat07.pdf)

Perhaps you are also aware of the Log mean: R = \exp( \sum_i \lambda_i \log(R_i) ) where \sum_i \lambda_i = 1.
This is basically the average of rotors in the tangent space at the north pole of S^3, so it gets close to the Riemannian metric as rotors are close to the identity. It is cheap to compute and you can get sensible results at, for instance, doing higher order rotor interpolation, however this metric is not bi-invariant.

Best!

Hi thanks for sharing,

I went through this papers but unfortunately this does not mean I am fully aware of it … I have hard time to follow those works … (and the most clear I found is really the one from dorst)

I easily get confuse, for instance your first statement you use the same words as in Dorst paper above, ‘chord metric’ but yet with an other definition:

compare the definition you start with and equation 50 from the screen shot (from Dorst’s paper) I put above …

I do not know if those two alternative definition should lead to the same results (but note, that Dorst also give a close form for the chord average, which is rather simple (it looks like the arithmetic mean on the rotor)

are they the same, ? or should one of you change the naming ?

The second mean you propose, looks similar, to the Bivector averaging

Ok, lets clarify that we could define the chordal distance of two rotations in SO(3) as:

d_{chord}(R_1, R_2) = \| R_1 - R_2 \|

However, that definition doesn’t make sense if we don’t specify what norm (\| \|) we are using and the norm depends on what are R_1 and R_2 e.g., for rotation matrices the norm is usually the Frobenius norm of the matrix. For rotors the norm would be the Euclidean distance between them in the embedding space \R^4 (4-dimensional vector space) or other related norm.

Unfortunately for rotors the distance d_{chord} is not well defined since R and -R represent the same rotation and it is not clear which one to choose (the distance d_{chord}(R, -R) should be zero but it isn’t). So the mean rotor minimizing chordal distance on average R = \frac{\sum_i R_i}{n} is meaningful only if you choose all the R_i to have the same “orientation”.

On the other hand, the chord metric for matrices \| A_1 - A_2 \|_F under Frobenius norm is well defined and it can be shown, using Rodrigues formula, that chordal length is related to the sine of the angle as d_{chord}(A_1, A_2) = 2\sqrt{2} \sin(\theta/2).

For rotors you can also minimize the \sin(\theta/2) using the distance I defined previously \|<R_1 \tilde R_2>_2\| where the norm is the Euclidean norm in the embedding space of 3D bivectors \R^3. You can see this is actually the same as the chord distance of matrices under Frobenius norm (up to a scalar). If you minimize the squared distance then you will get the closed form expression I refer to in my previous post.

I haven’t done the comparison of the two, my guess is that they should be close to each other (if properly implemented).

I haven’t read Leo Dorst’s paper yet, but I guess yes, the last one should be the “bivector averaging” appearing on his paper.

1 Like