Re: Averaging rotation matrices



Am 30.10.2007 12:31 schrieb peterbone@xxxxxxxxx:
Hello,

I have 2 rotation matrices that I would like to average to produce a
new rotation matrix. I realise that the definition of 'average' is
slightly arbitrary in this case but basically I would like the result
to be between the 2.
The way I'm currently doing it is by doing an element-wise mean
between the matrices. The result is no longer orthogonal so I correct
it by making each row a unit vector and then use 2 cross products
between the rows to make it orthogonal again. If I get the cross
products the right way round then I can ensure that the result has
determinant of +1 and is a 'special orthogonal matrix' and therefore a
valid rotation matrix. I'm not sure if this will always give a good
result but it gives good results for the few examples I've tested
(Matlab code below).
Is there a standard method for doing this?

Thanks,
Peter Bone

Hmm, what about taking the square root of their product?

;===========================================
;MatMate-Listing vom:30.10.2007 12:47:53
;============================================
a : // a random matrix
0.00 27.29 37.22 7.06
3.14 67.17 42.57 84.09
86.10 31.87 8.20 5.97
20.26 16.18 47.48 29.33

[1] t = gettrans(a,"pca") // get a rotation-matrix
t :
0.31 -0.92 -0.03 0.22
0.57 0.01 -0.23 -0.79
0.47 0.16 0.86 0.09
0.59 0.35 -0.45 0.57

[2] a1 = a*t // rotate
a1 :
37.41 8.62 22.52 -14.11
109.41 33.82 -17.01 -0.63
52.43 -75.84 -5.29 -2.03
55.50 -0.85 23.35 12.68

[3] t1 = gettrans(a*t,"quartimax") // get another rotation matrix
t1 :
0.92 -0.36 0.12 -0.07
0.36 0.93 0.00 -0.03
-0.13 0.03 0.83 -0.55
-0.00 0.03 0.55 0.83

[4] a2 = a1*t1 // get the further rotated matrix
a2 :
34.75 -5.01 15.21 -26.76
115.46 -8.37 -1.58 0.70
21.75 -89.77 0.64 -0.07
47.89 -19.62 32.78 -5.78


[5] t2 = sqrt(t*t1) // now try to "average" t and t1
t2 :
0.67 -0.74 -0.06 -0.06
0.61 0.61 -0.32 -0.39
0.23 0.14 0.94 -0.20
0.36 0.25 0.06 0.90

[6] chk = t2*t2' // is it a rotation-matrix (is it orthogonal)?
chk :
1.00 0.00 -0.00 -0.00
0.00 1.00 0.00 0.00
-0.00 0.00 1.00 0.00
-0.00 0.00 0.00 1.00

[7] b1 = a*t2 // apply the average rotation one time
b1 :
27.66 23.74 26.75 -11.67
83.27 65.45 23.42 40.47
80.89 -41.63 -7.39 -14.22
44.83 8.95 40.11 9.38

[8] b2 = b1*t2 // apply it a second time
b2 :
34.75 -5.01 15.21 -26.76
115.46 -8.37 -1.58 0.70
21.75 -89.77 0.64 -0.07
47.89 -19.62 32.78 -5.78



[9] chk = a2 - b2 // check the two results
chk :
-0.00 0.00 0.00 0.00
-0.00 -0.00 0.00 0.00
-0.00 0.00 0.00 0.00
-0.00 0.00 0.00 0.00


Gottfried Helms
.



Relevant Pages

  • Averaging rotation matrices
    ... I have 2 rotation matrices that I would like to average to produce a ... it by making each row a unit vector and then use 2 cross products ... determinant of +1 and is a 'special orthogonal matrix' and therefore a ... valid rotation matrix. ...
    (sci.math)
  • Re: Averaging rotation matrices
    ... valid rotation matrix. ... Peter Bone ... that I need to do a weighted average - so in my Matlab code it would ...
    (sci.math)