sksurgerycore.algorithms.averagequaternions module

Quaternion averaging functions

sksurgerycore.algorithms.averagequaternions.average_quaternions(quaternions)[source]

Calculate average quaternion

Params quaternions:
 is a Nx4 numpy matrix and contains the quaternions to average in the rows. The quaternions are arranged as (w,x,y,z), with w being the scalar
Returns:the average quaternion of the input. Note that the signs of the output quaternion can be reversed, since q and -q describe the same orientation
sksurgerycore.algorithms.averagequaternions.weighted_average_quaternions(quaternions, weights)[source]

Average multiple quaternions with specific weights

Params quaternions:
 is a Nx4 numpy matrix and contains the quaternions to average in the rows. The quaternions are arranged as (w,x,y,z), with w being the scalar
Params weights:The weight vector w must be of the same length as the number of rows in the
Returns:the average quaternion of the input. Note that the signs of the output quaternion can be reversed, since q and -q describe the same orientation
Raises:ValueError if all weights are zero