Quantcast
Viewing all articles
Browse latest Browse all 17

Answer by Mario García for "Average" of multiple quaternions?

The easiest implementation (with Numpy in Python>=3.6) of Markley's solution would be:

import numpy as npdef q_average(Q, W=None):    if W is not None:        Q *= W[:, None]    eigvals, eigvecs = np.linalg.eig(Q.T@Q)    return eigvecs[:, eigvals.argmax()]

where Q is of size N-by-4. The resulting quaternion is already normalized.

In this case the weights are equal to 1 by default. Otherwise you can give a list of weights of size N (one per quaternion.)

That's it.


Viewing all articles
Browse latest Browse all 17

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>