2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human...

download 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

of 117

Transcript of 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human...

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    1/117

    Statistical Analysis of Orientation Trajectories via

    Quaternions with Applications to Human Motion

    by

    Su Bang Choe

    A dissertation submitted in partial fulfillmentof the requirements for the degree of

    Doctor of Philosophy(Statistics)

    in The University of Michigan2006

    Doctoral Committee:

    Professor Julian J. Faraway, ChairProfessor Robert W. KeenerAssociate Professor Bernard J. Martin

    Assistant Professor Ji ZhuAssociate Research Scientist Matthew P. Reed

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    2/117

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    3/117

    c Su Bang Choe 2006All Rights Reserved

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    4/117

    To my parents

    ii

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    5/117

    ACKNOWLEDGEMENTS

    First of all, Id like to thank Professor Faraway for his advice and guidance

    throughtout these many years. His patience and sometimes much needed prodding,

    are the main reasons Ive finally made the finish line. I need to thank the HUMOSIM

    laboratory (and its sponsoring partners) for providing me with the analysis problem

    that ultimately led to this research. Id like to also thank my dissertation committee

    members for their helpful comments and insightful critique. Collaboration and dis-

    cussion with fellow HUMOSIM students especially, Kyunghan Kim, Woojin Park

    and Jing Wang, were important sources of inspiration and I would like to thank them

    as well. Finally, Id like to thank my wife for her love and support without which, I

    could not have undertaken this.

    iii

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    6/117

    TABLE OF CONTENTS

    DEDICATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii

    ACKNOWLEDGEMENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii

    LIST OF FIGURES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi

    LIST OF TABLES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii

    CHAPTER

    I. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

    II. Orientation Parameterizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    2.1 Rotation and Orientation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52.2 Rotation Parameterizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    2.2.1 Rotation Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62.2.2 Euler Angles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.2.3 Axis-Angle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.2.4 Quaternions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142.2.5 References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    III. Statistical Analysis of Orientations . . . . . . . . . . . . . . . . . . . . . . . . . 21

    3.1 Human Kinematic Data: Links, Joints and Co-ordinate Frames . . . . . . . 213.2 The Angle of Rotation Metric for Orientations and the Mean Orientation 253.3 The Tangent Mapping Approach . . . . . . . . . . . . . . . . . . . . . . . . . 29

    3.3.1 Exponential and Logarithm maps for Quaternions . . . . . . . . . . 293.3.2 Distribution Theory on the Tangent Space . . . . . . . . . . . . . . 323.3.3 Joint Range of Motion Limits . . . . . . . . . . . . . . . . . . . . . 343.3.4 Interpolation and Smoothing . . . . . . . . . . . . . . . . . . . . . 363.3.5 Hemisphere Commonization and Data Concentration: The Slerp

    Residual . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393.3.6 Functional Regression Modelling of Orientation Trajectories . . . . 43

    3.4 The Constraint Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513.4.1 Distribution Theory on S3 . . . . . . . . . . . . . . . . . . . . . . . 523.4.2 Interpolation and Smoothing on S3 . . . . . . . . . . . . . . . . . . 533.4.3 Regression Models on S3 . . . . . . . . . . . . . . . . . . . . . . . . 563.4.4 The Quaternion ANOVA model QANOVA . . . . . . . . . . . . 573.4.5 Simulated Power Study . . . . . . . . . . . . . . . . . . . . . . . . . 62

    IV. Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

    iv

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    7/117

    4.1 An Orientation Trajectory Model for the Right Hand in Unladen Reaches . . 674.1.1 Purpose of Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 674.1.2 Description of Experiment . . . . . . . . . . . . . . . . . . . . . . . 674.1.3 Data Preparation and Fitting of the Speed-Adjusted Slerp Residual

    Functional Regression Model . . . . . . . . . . . . . . . . . . . . . 734.1.4 Functional QANOVA . . . . . . . . . . . . . . . . . . . . . . . . . . 84

    4.1.5 Joint Limit Estimation . . . . . . . . . . . . . . . . . . . . . . . . . 86

    V. Discussion and Future Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

    APPENDICES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98

    BIBLIOGRAPHY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103

    v

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    8/117

    LIST OF FIGURES

    Figure

    2.1 Illustration ofroll, pitch and yaw with a 3D sailboat obtained from the Orientlibpackage in R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

    2.2 Illustration of a gimbal with three rings . . . . . . . . . . . . . . . . . . . . . . . . 13

    3.1 Illustration of the HUMOSIM linkage system. The reference posture shows thehuman figure standing erect, facing forward and holding the arms outstretched tothe sides parallel to the ground with palms facing downward. Each body segments

    local co-ordinate system is shown aligned with the global co-ordinate system markedas X0-Y0-Z0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

    3.2 Illustration of the exponential map and the logarithm map which allows us to movebetween quaternions which are on the surface of the sphere to points on the tangentspace taken at the identity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

    3.3 Illustration of the Tangent Gaussian distribution in lower dimensions. . . . . . . . 33

    3.4 Illustration of the potential problem in using the flipping algorithm on an orien-tation trajectory that exists on the boundary between hemispheres. The originaltrajectory starts in the upper hemisphere and curves down to the lower hemispherebefore returning back to the upper hemisphere. Using the flipping algorithm wewould flip our smile on the lower hemisphere to the other side of the sphere tocreate a frown on the upper hemisphere. . . . . . . . . . . . . . . . . . . . . . . . 40

    3.5 Illustration of the slerp model and the slerp residuals. The slerp model(a) gives theshortest trajectory on the sphere between two points. The slerp residuals (b) arethe rotations, shown as arrows, that take us from the slerp trajectory to the actualobserved trajectory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

    3.6 Plots of power versus for the one-way functional QANOVA simulation study. Wehave two curves for the two different term orderings and a curve for the likelihoodratio test. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

    3.7 Plots of power versus for the second simuation study. We have three curves forthe different QANOVA term orderings and one for the likelihood ratio test. . . . . 66

    4.1 Illustration of how the user will place target hand-prints for the human model toreach to. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

    vi

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    9/117

    4.2 Illustration of experiment setup. (a) Each cluster consists of five blocks. The blockswere color-coded and the subject was asked to grip the block with the thumb on aselected color side. (b)Three clusters were placed at different heights on a tower.(c)The tower was then placed in four positions: 45 to the left, forward, 45 to theright, 90 to the right. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70

    4.3 Illustration of placement of optical markers (shown as circles) and electromagneticsensors (shown as squares) on a subject . . . . . . . . . . . . . . . . . . . . . . . . 71

    4.4 Illustration of the marker positions for the HUMOSIM linkage system. For ourexperiment we will not have any of the markers below the hip. . . . . . . . . . . . 72

    4.5 Handplot of the neutral orientation. The conical cylinder shows the forearmaligned parallel to the x-axis. The hand is, in turn, aligned to the fore arm withthe palm facing downwards. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75

    4.6 Histograms of the difference in the start cutoff points and end cutoff points betweenrotational and translational motion defined as = Rotation Translation. Theunits are the number of frames. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77

    4.7 Plot of a typical angular speed profile. . . . . . . . . . . . . . . . . . . . . . . . . . 78

    4.8 Illustration of spherical co-ordinates r,,. Adapted from Weisstein (2006) . . . . 80

    4.9 Picture depicting the local orientation of the hand with respect to the forearm(forearm remains stationary), a handplot, for a reach where the first order modelfit showed a 10 DTW difference with the actual observed trajectory. The speed-adjusted slerp trajectory is also shown. The frames are equally spaced in the timedomain. Most of the noticeable difference occurs in the second and third frames. . 82

    4.10 Plot of 5th, 50th and 95th percentile DTW distance for the first order model and theslerp model by Rdist class. The Rdist variable measures the angle of rotation metric

    between the orientation of the hand at the target with the neutral orientation.We grouped the data into 20 separte classes based on the Rdist. . . . . . . . . . . . 84

    4.11 Ellipsoidal Joint Range of Motion Limit estimated from our terminal local orientations 89

    4.12 25 sampled points from our Ellipsoidal Joint Range of Motion Limit . . . . . . . . 89

    4.13 Handplots of the 25 sampled points from our Ellipsoidal Joint Range of MotionLimit. Using a matrix index to identify a plot, e.g. [2,4] is the plot that is on thesecond row and fourth column, we identify those that appear to be impossible [1,4], [2,1] and [2,4], and those that appear not to be on the joint limit boundary [3,3] and [3,4] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

    4.14 Plot of mahalanobis distance versus weight of subject. Males are indicated by Mand females are indicated by F. The regression line for males is given by the solidline while the one for females is given by the dashed line. It appears as if wristflexibility increases with weight for females while the opposite holds true for males. 92

    5.1 Combined reach trajectory predicted by our model to a target from the HUMOSIMexperiment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97

    vii

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    10/117

    LIST OF TABLES

    Table

    4.1 Anthropometry of subjects in Terminal Hand Orientation and Effort Reach Study,2000 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73

    4.2 DTW distance as compared to actual observed local quaternion trajectory . . . . . 81

    4.3 DTW distance for the different models when data are subdivided by angular dis-tance to target orientation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

    viii

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    11/117

    CHAPTER I

    Introduction

    The study of object motion in three dimensional space occurs in a wide variety

    of areas. Examples can be found in human kinematics, plate tectonics, and even

    vectorcardiography, but one can easily think of other instances where such data

    occur. Any rigid object moving through three dimensional space will have six degrees

    of freedom associated with its motion: three for its position in space and three for its

    orientation. Positional data are likely to be more familiar, especially if represented

    using Cartesian co-ordinates. The space of such co-ordinates is Euclidean IR3 and

    linear algebra techniques for working in such a space are taught at an elementary

    college level.

    Orientation data are more complex, however, and some introduction is required.

    The orientation of any rigid body can be thought of as the end product of a rota-

    tion of some reference frame in IR3 and is represented as such. The standard way

    of representing rotations is by way of rotation matrices (sometimes called Direction

    Cosine Matrices), but alternatives exist. One such alternative parameterization us-

    ing Euler angles is popular as these angles are easier to visualize, but this form of

    parametrization suffers from a few problems. Another method involves the use of

    quaternions, a form of hyper-complex number first introduced by Hamilton (1866).

    1

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    12/117

    2

    In chapter 2 we introduce these competing parameterizations and explain why the

    quaternion parameterization was chosen.

    Much of the statistical literature related to orientation focuses exclusively on ro-

    tation matrices including some theoretical (see Downs (1972), Khatri and Mardia

    (1977)) and applied work (see Chang (1986)). This literature is inter-related with

    results obtained from directional statistics (see Bingham (1974), Watson (1983), Jupp

    and Mardia (1989), Mardia and Jupp (2000)) and can be considered as a corollary of

    it. Prentice (1986) was the first to introduce quaternions for statistical analysis. His

    work focused on translating the existing theory on rotation matrices to the quater-

    nion parameterization; converting the orientation problem back to a directional one

    but in a higher dimension. Still, the statistical literature in this area is sparse, but

    the computer graphics and animation field has produced a wealth of resources. The

    rising popularity of video games, computer-animated films and computer-generated

    special effects has resulted in a substantial amount of study of orientation repre-

    sentations. Shoemake (1985) introduced quaternions as a method for representing

    orientations to the computer graphics world. Much of the work that followed was

    geared towards creating better and faster interpolation algorithms which was impor-

    tant for animation applications.

    The current research is focused on applications in the area of human kinematics.

    Specifically we seek to predict human motion via a statistical model under a range of

    input conditions. Motion data can be analyzed as functions over time, which requires

    the adaptation of functional analysis techniques (see Ramsay and Silverman (1997))

    for use with orientation data. Functional regression analysis of orientation data, as

    a result, is a key concept of this research. This work can be used in areas besides

    human kinematics as most orientation data result from the study of some objects

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    13/117

    3

    motion. These new methods are described in Chapter 3 along with relevant work

    from the literature that these methods draw upon.

    The data and impetus for this research comes from the Human Motion Simula-

    tion Laboratory (HUMOSIM) at the University of Michigan. Over the years the

    lab has accumulated a large motion capture database (over 72,000 motions) from

    numerous studies of test-oriented human motion. A wide variety of individuals have

    participated such that we can assess the effects of body dimensions, gender and age.

    A majority of the motions are load-transfers and reach tasks. By considering body

    segments such as the hand or the head as objects moving through three dimensional

    space, we can use the methods in chapter 3 to model the orientation trajectory of

    the segment during a motion. In chapter 4, we describe the orientation trajectory

    model for the right hand in unladen reach motions as an application of our methods.

    The purpose of the model is to predict the orientation trajectory of the right hand

    for a variety of reach tasks given a beginning and target orientation, as well as a

    subjects anthropometric information. This model forms part of the HUMOSIM

    Framework, a modular approach to human motion simulation.

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    14/117

    CHAPTER II

    Orientation Parameterizations

    In this chapter we will describe the mathematical theory behind the concepts of

    three-dimensional spatial rotation and orientation. There are many ways to param-

    eterize rotations, each with its own set of advantages and disadvantages. To fully

    understand these issues we will describe spatial rotation from the beginning starting

    with Eulers Theorem. We will describe four parameterizations that are popular in

    the human motion/animation field. These are:

    1. Rotation Matrix

    2. Euler Angles

    3. Axis-Angle

    4. Quaternions

    We will pay particular attention to quaternions, our parameterization of choice,

    providing a detailed introduction to the quaternion hyper-complex algebra. The

    other three are described briefly with particular emphasis on interpolation, metrics,

    ease-of-use and robustness. Based on these criteria, we explain why quaternions are

    best suited for our purposes.

    4

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    15/117

    5

    2.1 Rotation and Orientation

    We live and operate in a three dimensional world and since we interact with

    rigid body objects everyday the concept of spatial rotation and orientation is highly

    intuitive. Unfortunately, the mathematics involved are not and will need some ex-

    planation.

    First of all we need to distinguish between rotation and orientation. Many peo-

    ple use these terms interchangeably but there is a subtle difference. Rotation is a

    transformation that changes one vector to another such that:

    The magnitude of the vector is preserved.

    The handedness of the vector is preserved which, in mathematical terms, means

    that the direction of the cross products of the basis vectors are preserved i.e.

    there is no reflection.

    Orientation is the attitude of a rigid body in space and is expressed as a rotation

    with respect to a fixed co-ordinate frame. Thus an orientation can be thought of asthe end product of a rotation from some other reference orientation.

    Eulers Rotation Theorem states that every orientation can be described as a

    rotation by some angle about some fixed axis a. In other words we can obtain any

    orientation by a single rotation from any other orientation. The axis provides us

    with the direction and the angle provides us with the magnitude.

    We can see that this angle can serve us nicely as a distance metric between orien-

    tations and is in fact the natural group metric for rotations. One further result we

    can use from Eulers Rotation Theorem is that there are three degrees of freedom

    associated with spatial rotations two for the axis1 and one for the angle.1since length does not matter it can be represented as two angles i.e. spherical coordinates

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    16/117

    6

    Concatenating rotations2 needs to be handled carefully because rotation is non-

    commutative. To illustrate this, form three orthogonal axes with your right hand

    with your thumb pointing upward, your index finger pointing forward and your

    middle finger pointing to the left. Rotate 90 degrees counter clockwise around your

    thumb axis and your index finger should now be pointing to the left. Next, rotate

    90 degrees counter clockwise around your middle finger and the end result is that

    your index finger will be pointing downward. If we were to swap the order of the two

    rotations and do the middle finger rotation first (index finger will point downward)

    followed by the thumb rotation we will in the end have our index finger pointing to

    the left, obtaining a different end orientation.

    2.2 Rotation Parameterizations

    2.2.1 Rotation Matrix

    A 3 3 matrix M is considered a rotation matrix if and only if:

    MTM = I,(2.1)

    det M = +1.(2.2)

    The first condition implies that a rotation matrix is orthogonal, i.e. it consists of

    orthogonal column vectors each of unit magnitude. The set of all 3 3 orthogonal

    matrices are denoted as O(3) (an example of a Steifel manifold3) where the SO

    stands for special orthogonal. There are two possible subsets of O(3) one for

    those matrices with det = +1 and another for those with det = 1. The latter are

    sometimes known as rotoinversion matrices as they change the handedness of the

    vector it is applied to. The former preserves handedness and this subset it denoted

    as SO(3).

    2Concatenation involves performing multiple rotations on the same object3The Steifel manifold Vr(IRp) is the space of p r matrices X such thatVr(IRp) = {X : XTX = Ir}

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    17/117

    7

    A rotation matrix M SO(3) will transform a vector x IR3 to a new vector

    y = Mx(2.3)

    by rotating it and preserving its magnitude.

    If we know the basis for the newly rotated space with respect to the original basis

    we can easily create the rotation matrix the basis vectors form the columns of the

    matrix, i.e.,

    M =

    | | |

    xnew ynew znew

    | | |

    (2.4)

    where xnew, ynew and znew are the rotated basis column vectors.

    Concatenation is handled through matrix multiplication. IfM1 is the first rotation

    to be applied and M2 is the second then the resulting combined rotation matrix is

    given by

    M21 = M2M1(2.5)

    Note that since we are using column vectors the order of rotation is read from

    right to left. Non-commutativity can easily be seen mathematically as

    M2M1 = M1M2(2.6)

    It is not straight-forward to relate a rotation matrix to Eulers Rotation Theorem.

    The axis of rotation can be obtained from performing an eigen decompostion of

    the matrix. The axis is given as the eigenvector associated with the unit eigenvalue.

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    18/117

    8

    The other two eigenvectors are complex and thus will have complex eigenvalues. The

    angle of rotation can be obtained using a somewhat circuitous method. We take an

    arbitrary unit vector x IR3 and then rotate it using our rotation matrix to obtain

    y = Mx. The rotation angle is then given by

    = arccos(x y)(2.7)

    The main advantage of the matrix representation is its mathematical robustness.

    This stems from the fact that rotations are defined by this representation. As a result

    it is the only parameterization that will uniquely represent a given rotation, i.e. there

    is a 1-to-1 mapping between SO(3) and the space of rigid body rotations. Another

    advantage is the familiarity of matrix algebra as it forms part of all early level linear

    algebra courses. Much of the literature that exists for orientation statistics deals

    exclusively with the matrix parameterization.

    Unfortunately there are some disadvantages of using this representation. First

    of all, we are using nine parameters to describe something with three degrees of

    freedom. This means there are six constraints three to maintain unit length of

    the columns and three to enforce mutual orthogonality. This inherent inefficiency

    can lead to data storage issues especially in human motion where just a single motion

    file is the size of an entire dataset in many fields.

    There are computational issues as well. For instance, performing numerous con-

    catenations could lead to round-off error accumulating to such an extent that the re-

    sulting matrix is no longer in SO(3). We will have to use re-normalization algorithms

    such as the Gram-Schmidt which are not straightforward and can be computationally

    expensive if we have to do them frequently.

    Due to the numerous constraints, interpolation of matrices is also difficult and the

    fact that SO(3) is not a vector space makes most interpolators which use the convex

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    19/117

    9

    sum:

    M1 + (1 )M2(2.8)

    not work as the interpolated matrices would not be in SO(3).

    2.2.2 Euler Angles

    Euler angles represents rotation by first factorizing the rotation into a series of

    three sequential rotations around the principal axes (x,y,z) and then enumerating

    the three angles involved. These rotations in matrix form are as follows:

    Mx =

    1 0 0

    0 cos sin

    0 sin cos

    ,(2.9)

    My =

    cos 0 sin

    0 1 0

    sin 0 cos

    ,(2.10)

    Mz =

    cos sin 0

    sin cos 0

    0 0 1

    .(2.11)

    where is the angle around the x-axis, is the angle around the y-axis and is the

    angle around the z-axis.

    Any sequence of these three rotations such that no two consecutive rotations are

    around the same axis can be deemed as a possible Euler angle definition and is known

    in the literature as an Euler angle set. There are twelve such sets in all the first

    six use all three principal axes and are sometimes known as Cardan angles: XYZ,

    YZX, ZXY, ZYX, XZY and YXZ while the other six have its first and last rotations

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    20/117

    10

    about the same axis: XYX, YZY, ZXZ, XZX, XYX and YXY and are read in the

    order the rotation is applied.

    There exists yet another distinction that tends to cause confusion and it is in the

    way the principal axes are treated. To illustrate this we will use the XYZ Euler

    angle set as an example. One way to implement this set is to think of the three

    principal axes to be fixed globally and thus the object is rotated through the global

    x-axis then the global y-axis and finally the global z-axis. The other way is to treat

    the principal axes as fixed to the object itself and thus these axes themselves rotate

    with the object. So using this local axes method we would rotate the object first

    around its own x-axis then around the y-axis which has changed due to the previous

    x rotation and finally around the resulting z-axis obtained after the y rotation.

    One can easily show that the local axes XYZ set is the same as the global axes

    ZYX set. Note once again that these are read in the order the rotations are applied

    which is opposite the order in which the matrices are multiplied.

    Let Rz be the matrix representing rotation around the global z-axis, Ry be the

    one for the global y-axis and finally Rx be the one for the global x-axis in the global

    axes ZYX set. Other than the first rotation, both subsequent rotations will require

    change of basis operators such that we rotate in the axes of the original frame. Thus

    we obtain the following:

    Rz = Mz,(2.12)

    Ry = MzMyM1z ,(2.13)

    Rx = MzMyMxM1y M

    1z .(2.14)

    When we then multiply these rotation matrices together to perform the rotation

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    21/117

    11

    we prove the result.

    RxRyRz = MzMyMx.(2.15)

    We will only refer to the local axes sets when we refer to Euler angles in the future.

    There is no method by which concatenation can be performed using Euler angles

    and we will need to convert to another parameterization to do so.

    Euler angles are even more difficult to relate to Eulers theorem than rotation

    matrices. One way to do so is to convert the Euler angles to rotation matrices first.

    Since obtaining the rotation angle is so difficult many people just use the Euclidean

    distance metric by treating the Euler angle triple as a vector. This is clearly erroneous

    however as the space of Euler angles is S S S (S is a unit circle) not IR3. Not

    only is there a problem when the angle goes through a discontinuity such as from 2

    to 0, but it also ignores the rotational order and thus the inherent coupling between

    the Euler angle components. For this reason this metric can be used only for those

    orientations that are in very close proximity to each other.

    Euler angles are easy to interpret and visualize and it is because of this that

    they are still widely used today. For example in human motion analysis we can

    interpret the Euler angles in terms of sagittal, transverse and axial motion. Such a

    factorization of the orientation aids in analyzing and describing the different postures

    of the human body. In aeronautics, the angles are described as roll, pitch and yaw

    (see figure 2.1) and are used to describe the orientation of aircraft during flight.

    An important problem with using Euler angles is due to an apparent strength - it is

    a minimal representation (three numbers for three degrees of freedom). All minimal

    parameterizations of SO(3) suffer from a co-ordinate singularity which results in a

    loss of a rotational degree of freedom in the representation. For example, let us

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    22/117

    12

    Figure 2.1: Illustration ofroll, pitch and yaw with a 3D sailboat obtained from the Orientlib packagein R

    consider the XYZ set. Any rotation where the Y angle is /2 results in the z-axis

    aligning with the original x-axis. This alignment of the axes causes the final Z angle

    to be redundant as any resulting orientation could have been obtained initially using

    an appropriate X rotation and thus the loss of a degree of freedom.

    This phenomenon is known in the literature as gimbal lock which is a term that

    originates from a physical device known as a gimbal (see figure 2.2). This device

    is made up of three orthogonal concentric rings and is a physical realization of the

    Euler angle set. Gimbal mounted gyroscopes are often used in aircraft attitudes

    sensors. The gyro will stay in a fixed orientation with respect to the earth regardless

    of the plane and the gimbal rings will rotate as the plane moves to keep this gyro

    in place. Sensors are then placed on the rings to measure the Euler angles. Gimbal

    lock occurs when the middle ring lies flat with the outer ring thus causing the inner

    rings axis of rotation to be equal to the outer rings. Any further rotations along the

    original inner ring axis cannot be accomplished without resetting the gimbal causing

    the gimbal rings to wildly fluctuate whenever it operates near the singularity.

    Any interpolation scheme based on treating the angles as a vector and using the

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    23/117

    13

    Figure 2.2: Illustration of a gimbal with three rings

    convex sum will behave badly due to the inherent coupling that exists in the Euler

    angles. In fact any attempt at factorization of SO(3) to independent components

    will fail. We can show this by performing any rotation around two of the principal

    axes, say the x-axis and the y-axis. If we eigen decompose the resulting rotation

    matrix we will see that there will be z-axis component to the rotation axis even

    though we only did an XY rotation. Interpolation at or near gimbal lock can lead

    to numerical instability.

    2.2.3 Axis-Angle

    The axis-angle representation is a direct interpretation of Eulers Rotation Theo-

    rem in that we use the unit axis of rotation (a) and the angle of rotation (). Thus

    we have three parameters4 to measure three degrees of freedom and thus is a minimal4The axis of rotation can be represented in spherical co-ordinates as only direction is needed

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    24/117

    14

    representation of the rotation group.

    Obviously by its nature we can directly obtain the angle metric from the param-

    eterization. It also represents the action of rotation in the most direct way possible

    making it very intuitive.

    Like Euler angles we cannot concatenate rotations using the axis-angle represen-

    tation and so conversion to either matrix or quaternions is required. Round-off error

    can be handled for the unitary axis of rotation by normalizing but not for the angle.

    Multiplicity is a problem with this representation and we need to bound the angle

    in [, ) so as to solve the problem of all multiples of 2 being the same angle.

    This, however, does not entirely solve the problem as we still have that (a, ) and

    (a, ) both represent the same rotation. The zero rotation or identity can be

    represented with = 0 regardless of the axis of rotation allowing an infinite possible

    identities.

    Methods to solve the multiplicity problem will cause discontinuities to exist and

    interpolation schemes will suffer because of it. Naive methods where we treat the

    axis-angle as a four vector are obviously flawed, but no reasonable alternatives exist.

    2.2.4 Quaternions

    Quaternions were discovered by Sir William Rowan Hamilton, an Irish mathe-

    matician in 1843. He extended the idea of complex numbers so that he could carry

    out multiplication and division on triples of real numbers and it is from his discovery

    of quaternions that vector algebra came into being.

    Quaternions are a four dimensional extension of complex numbers with three di-

    mensions being imaginary and the other being real. Such higher dimensional complex

    numbers are known as hyper-complex with quaternions (four) and Cayley numbers

    (eight) being the most well-known. As such, many of the properties of quaternion

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    25/117

    15

    algebra can be deduced by logically extending the well known properties of complex

    algebra.

    Quaternions can be written in several different ways and it is helpful to know

    them all as each form is useful.

    q = [v, w](2.16)

    = [(x,y,z), w](2.17)

    = [x,y,z,w](2.18)

    = ix +jy + kz + w.(2.19)

    where x,y,z,w IR, v IR3, i2 = j2 = k2 = ijk= 1.

    The last form shows the classical complex number form with i, j and k being the

    three imaginary numbers with pairs multiplying as in a cross-product:

    ij = ji= k,(2.20)

    jk= kj = i,(2.21)

    ki = ik= j.(2.22)

    Hamilton called the real part w the scalar and the imaginary triple v = (x,y,z) the

    vector. A pure quaternion is one where w = 0 and can be used to represent a three

    vector. Likewise a scalar quaternion has v = 0 and can be used to represent a scalar.

    Even though we sometimes write a quaternion as a four dimensional vector, the

    usual vector algebra cannot be used. Addition and subtraction of quaternions is

    straight-forward, commutative and performed component-wise. There are two well

    known methods for vector multiplication: the cross product and the dot product,

    each yielding a different type of result. The quaternion product is an amalgamation

    of these two and as such is non-commutative due to the cross-product term.

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    26/117

    16

    Addition

    q1 + q2 = [v1, w1] + [v2, w2](2.23)

    = [v1 + v2, w1 + w2].(2.24)

    Multiplication

    q1 q2 = [v1, w1] [v2, w2](2.25)

    = [v1 v2 + w1v2 + w2v1, w1w2 v1 v2].(2.26)

    Other important operations, reminiscent of those found in complex number theory,

    include the conjugate, norm (or magnitude) and inverse.

    Conjugate

    q = [v, w](2.27)

    = [v, w](2.28)

    Norm/Magnitude

    q2 = q q(2.29)

    = w2 + v v(2.30)

    = w2 + x2 + y2 + z2(2.31)

    Inverse

    q

    1

    =

    q

    q(2.32)

    Like complex numbers, quaternions can be put in polar form:

    q = rev2(2.33)

    = r

    v sin

    2, cos

    2

    (2.34)

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    27/117

    17

    where r is the magnitude of the quaternion, 2

    is the angle (we explain why we have

    2 instead of in the next paragraph) and v is the axis which is a unit three vector or

    a pure unit quaternion. The above formula can easily be proved by using the power

    series expansion of the exponential and then using the fact that v2 = 1.

    De Moivres theorem of powers for complex numbers can be similarly extended

    for quaternions giving us:

    qt = rteta2(2.35)

    = rt

    a sin t

    2, cos t

    2

    (2.36)

    So how can quaternions be used to parametrize rotation in IR3? First of all,

    we restrict ourselves to a multiplicative subgroup of quaternions by enforcing unit

    magnitude as this is all that is required for rotation parameterization and furthermore

    will not change the scale of the object being rotated5. Let x be a vector in IR3 and

    suppose we wish to rotate this about an axis a by an angle . Then the rotation

    formula in quaternions would be of the form:

    y = q x q1(2.37)

    where q =

    a sin 2 , cos2

    and y is the rotated vector and both x and y are in pure

    quaternion form. Thus to rotate a vector x we need to put it in quaternion form and

    then multiply to the left with the rotation quaternion and multiply to the right by

    its conjugate. Thisdouble multiplication is the reason why we have 2

    instead of

    in our quaternion parameterization.

    The identity quaternion given by:

    qI = (0, 0, 0, 1)(2.38)

    5From now on all quaternions will be unit unless otherwise indicated.

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    28/117

    18

    is the unit scalar quaternion it plays the role of the identity matrix, i.e., it rep-

    resents a zero rotation. Like the matrix the identity quaternion has the following

    properties:

    q qI = qI q = q(2.39)

    q q1 = q1 q = qI(2.40)

    Another property of this formula is that q and q would produce the same rota-

    tion and thus we have a problem of double-coverage. As mentioned previously, the

    only parameterization that does not suffer from multiplicity is the rotation matrix.

    Although we acknowledge the quaternion multiplicity, it can be handled using some

    straight-forward techniques that are described in section 3.3.5.

    Concatenation of rotations is handled similarly to that of matrices due to the

    non-commutative nature of quaternion multiplication. Thus if we wish to rotate by

    q1 followed by q2. By the quaternion rotation formula we have:

    y = q2 (q1 x q1

    1 ) q1

    2(2.41)

    = (q2 q1) x (q2 q1)1(2.42)

    It is useful to look at the unit quaternions from a geometric and topological point

    of view as it provides us with a fair amount of intuition as to how the unit quaternions

    work. If we think of unit quaternions as unit vectors in IR4 then the space of unit

    quaternions is the surface of a four dimensional hypersphere denoted as S3 (the 3

    stands for the three degrees of freedom that exists for this surface and not the number

    of dimensions which is four) in the literature. Thus the double coverage problem can

    be interpreted as antipodal symmetry as q and q are antipodes or, in other words,

    on direct opposite sides of the sphere.

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    29/117

    19

    The main advantage of the quaternion representation is that it does not suffer

    from a co-ordinate singularity. This can be explained through what is known as the

    Hairy Ball Theorem in topology. It states that if we have a ball covered with hair

    we cannot comb the hair such that all the hairs lie flat on the surface of the ball.

    In other words, it is impossible to create a continuous tangent vector space on the

    surface of a sphere with an even number of degrees of freedom. The corollary to this

    is that it is possible to do this for spheres with odd degrees of freedom. Since unit

    quaternions live on S3 we can move smoothly on the surface of the sphere without

    encountering any discontinuities.

    Quaternions can be thought of as a more efficient representation than rotation ma-

    trices as it uses four numbers instead of nine. Quaternion multiplication requires less

    calculation than matrix multiplication6 and as such algorithms for quaternions run

    almost five times faster than those for rotation matrices. Numerical round-off errors

    are much more easily handled with quaternions requiring simple re-normalization as

    opposed to matrices that require re-orthonormalization through Gram-Schmidt or

    other such computationally expensive methods.

    The perceived disadvantage of quaternions are that they are difficult to interpret.

    However, quaternions in polar form makes it trivial to relate it to Eulers Theorem

    with the axis and angle easily obtained. The problem lies in the fact that quaternions

    are unfamiliar to a majority of people as they are seldom taught in basic college level

    math courses. By using the geometric interpretation of quaternions one can avoid

    thinking of them as a black box.

    The major problem we face when using quaternions is that they live on the surface

    of a hypersphere and thus we cannot use the familiar Euclidean vector space methods,6Quaternion multiplication requires 16 scalar multiplies while matrix multiplication requires 81.

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    30/117

    20

    statistical or otherwise. This is a problem inherent in the rotation group and is not

    just as a result of choosing quaternions as our parameterization method. This will be

    discussed in more detail in the next chapter where we introduce orientation statistics

    and formulate methods to model quaternion data.

    2.2.5 References

    The information presented in this chapter were taken from many different sources.

    Much of the information in the section on quaternions was obtained from Shoemake

    (1985), (1987) and from the man who discovered them, Hamilton (1866). There are

    also references that look at all the parameterizations: Buss (2003) and Goldstein

    (1980). Two websites that have a wealth of information are: Baker (2006) and Weis-

    stein (2006).

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    31/117

    CHAPTER III

    Statistical Analysis of Orientations

    In this chapter we will introduce statistical methods for analyzing orientation

    data using the quaternion method of parameterization with an emphasis on human

    motion. A detailed description of this type of data precedes the statistical analysis.

    We then introduce the natural metric for orientation data as well as the concept of

    a mean orientation.

    We consider two possible approaches to handling quaternion data:

    1. The Tangent Mapping approach where we map our quaternions from S3 onto

    a tangent space.

    2. The Constraint approach where we stay in S3 and consider it a constrained

    subspace of IR4.

    We describe both approaches and derive statistical models for each.

    3.1 Human Kinematic Data: Links, Joints and Co-ordinate Frames

    Before we dive into the statistical analysis we need to introduce the type of data

    that we are trying to model and describe some of the issues involved.

    The human body can be modeled conceptually as a chain of rigid links or seg-

    ments connected together by joints. These segments represent body parts which are

    21

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    32/117

    22

    considered to be rigid in that they are considered not to bend or stretch. The joints

    connect these segments and allow rotational movement between segments. Depend-

    ing on the joint, we have up to three rotational degrees of freedom available for a

    particular body segment.

    How many links and joints there are depends on the particular linkage system

    used which needs to be chosen by the experimenter. The linkage system also effects

    the number of rotational degrees of freedom each joint allows. For example, let us

    consider the arm, which is made up of the hand linked to the forearm via the wrist

    joint and the forearm linked to the upper arm via the elbow joint. Intuitively, we

    would allow three degrees of freedom for the orientation of the hand as we can move

    it up or down, left or right as well as twist it along the axis of the forearm. The

    twist, however, does not really occur at the wrist joint but rather along the forearm

    due to the action of the tendons. It is thus possible to allow the twist to occur at

    the elbow thus giving the elbow and the wrist two degrees of freedom each rather

    than the usual three for the wrist and one for the elbow.

    We obtain our data via the use of motion capture for which we place markers

    on certain landmark points on a subjects body and use cameras or other sensors to

    track the location of these markers as the subject performs prescribed tasks. Our

    raw human motion data consists of the marker positions recorded in fixed frequency

    intervals with respect to an arbitrary global co-ordinate system set up by the motion

    capture device. From these marker positions we calculate the positions of the joint

    centers corresponding to the linkage system that we are using. Data from each

    individual frame are called posture data and a series of posture data over time are

    called motion data.

    The orientation of a particular body segment can be obtained with respect to the

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    33/117

    23

    Figure 3.1: Illustration of the HUMOSIM linkage system. The reference posture shows the humanfigure standing erect, facing forward and holding the arms outstretched to the sidesparallel to the ground with palms facing downward. Each body segments local co-ordinate system is shown aligned with the global co-ordinate system marked as X0-Y0-Z0

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    34/117

    24

    global co-ordinate system or the co-ordinate system induced by the segment that

    directly precedes it in the chain called the local co-ordinate system (see figure 3.1).

    We denote a quaternion that represents the orientation of a segment with respect

    to the global co-ordinate system as a global quaternion and similarly for a local

    quaternion. The global quaternion for each segment is calculated from the marker

    locations. The simplest way to do this is to form a rotation matrix using the basis

    vectors that form the co-ordinate system of the segment. We can then convert1 this

    to obtain the global quaternion. As an example suppose we have two segments A

    and B with B preceding A in the chain. Let us denote the global quaternion for A

    as GAq and the global quaternion for B asGB q. This can be read as the quaternion for

    segment subscript with respect to the co-ordinate system superscript. Once we

    have these we can obtain the local quaternion of A with respect to the co-ordinate

    system of B by:

    B

    A q =B

    Gq G

    A q(3.1)

    = GB q GAq.(3.2)

    Whether we choose to use global or local quaternions, we extract the orientation

    from each posture in the motion and create an orientation trajectory for that segment.

    These trajectories, which will vary in length depending on the speed at which the

    motions are performed, will then form our response. This choice is an important one

    however, with advantages and disadvantages on both sides. We will discuss these in

    the next chapter when we perform an example analysis and model the orientation

    trajectory of the right hand during reaching tasks.

    1See Appendix for the various conversion algorithms between rotation parameterizations.

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    35/117

    25

    3.2 The Angle of Rotation Metric for Orientations and the Mean

    Orientation

    It is obviously important for a distance metric to be defined for us to move ahead in

    statistically modeling and analyzing orientation data. As mentioned in the previous

    chapter, Eulers Rotation Theorem provides us with a natural angle of rotation metric

    between orientations. Since we have made the choice of using quaternions as our

    parameterization method we need to be able to obtain this metric from them.

    Let q1 and q2 be two quaternions representing different orientations. Then the

    rotation required to go from q1 to q2 is given by:

    qnew = q1 q2(3.3)

    From the previous chapter we know that the angle of rotation can be obtained

    from the scalar component of a quaternion and thus if we apply this to the new

    quaternion we calculated we get2:

    new = 2 arccos |scalar(qnew)|(3.4)

    = 2 arccos |scalar(q1 q2)|(3.5)

    = 2 arccos |w1w2 + v1 v2|(3.6)

    = 2 arccos |q1 q2|(3.7)

    Thus the angle of rotation metric for quaternions is also the angle formed between

    them at the origin. Since S3 has unit radius this can also be thought of as the length

    of the shortest geodesic between them.3

    2Absolute values are taken so as to remove the antipodal symmetry property. This way it will always return theangle from the closer antipode.

    3The geodesic is defined as a locally length minimizing curve. On the sphere the geodesic is a great circle linkingthe two points on the hypersphere.

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    36/117

    26

    With this metric we can now define a mean or average orientation. In normal

    p-dimensional Euclidean space the mean can be defined as:

    (3.8) x = arg minxIRp

    n

    i=1

    |xi x|2

    We can describe the mean orientation in an analogous way with Euclidean distance

    replaced with the angle of rotation metric. For the quaternion parameterization this

    becomes:

    (3.9) q = arg minqS3

    ni=1

    arccos |qi q|2.

    Buss and Fillmore (2001) describes an iterative solution to this minimization. As

    with all iterative algorithms there are issues with speed and accuracy. We shall call

    this the Minimum Distance mean.

    Prentice (1989) described an alternate method of obtaining this mean which he

    derived from the mean rotation matrix. Suppose we have a sample ofn orientations in

    rotation matrix form i.e. X1, . . . , Xn from SO(3) and we are interested in obtaining

    the mean orientation. A naive estimator would be the element-wise arithmetic mean,

    X =1

    n

    ni=1

    Xi(3.10)

    =1

    n

    ni=1

    xi11 xi12 x

    i13

    xi21 xi22 x

    i23

    xi31 xi32 x

    i33

    (3.11)

    =

    1

    nn

    i=1 xi

    11

    1

    nn

    i=1 xi

    12

    1

    nn

    i=1 xi

    13

    1n

    ni=1 x

    i21

    1n

    ni=1 x

    i22

    1n

    ni=1 x

    i23

    1n

    ni=1 x

    i31

    1n

    ni=1 x

    i32

    1n

    ni=1 x

    i33

    (3.12)

    where xijk is the jkth element of the ith sample matrix. Unfortunately this estimator

    is not a rotation matrix. To solve this problem we need to decompose this mean

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    37/117

    27

    matrix into matrix polar form. The following definition is taken from Downs (1972).

    Definition. Let F be a 33 square non-singular matrix. The matrix M.K is called

    a polar form of F, with M the polar component and K the elliptical component, where

    (1)F = MK, (2)MTM = I, det(M) = 1 and (3)K is symmetric positive-definite.

    There exists a relationship between matrix polar forms and least squares in that

    M = argminX tr{(F X)T(F X)} for all X SO(3). As FTF and XTX are

    constant, this is equivalent to M = arg maxX =tr(FTX).

    To numerically evaluate the decomposition ofF into its matrix polar form requires

    us to first of all look at its singular value decomposition,

    (3.13) F = D

    where and are rotation matrices and D =diag(1, 2, 3) is positive definite

    with 1 > 2 > 3 being the singular values of F. The polar component is then

    M = and the elliptical component is K = DT.

    The arithmetic mean, X = 1n

    ni=1 Xi, is not a rotation matrix as stated previ-

    ously. However if we were to put it in polar form X = M.K, the polar component

    M is a rotation matrix. In fact, it is the rotation matrix that is closest in the least

    squares sense to X.

    One can show that

    (3.14) tr(XT

    M) = 4mT

    (

    1

    n

    ni=1

    qiqT

    i )m 1

    where q1, . . . , qn S3 are the quaternion representations of X1, . . . , Xn SO(3)

    and m is the quaternion corresponding to M. From this it can be proved that m

    is the eigenvector corresponding to the largest eigenvalue of the moment of inertia

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    38/117

    28

    matrix

    (3.15) I =1

    n

    ni=1

    qiqi

    It is difficult to gain any intuition from this Eigenvector mean and attempts to find

    a meaningful interpretation from the literature were unsuccessful. We also could not

    find in the literature if there was a relationship between the minimum distance mean

    and the eigenvector mean. We were able to prove that they are, in fact, identical.

    The first step to the proof is to recognize that:

    q = arg minqS3

    n

    i=1

    arccos |qi q|2(3.16)

    = arg maxqS3

    ni=1

    (qi q)2(3.17)

    The next step is to use the Lagrange multiplier to solve this equation under the

    constraint that the solution lies in S3. We rewrite the equation by expressing the

    dot product as an inner product of the quaternions expressed as vectors in IR4. Thus

    we have:

    f(q) =n

    i=1

    (qTqi)2 + (qTq 1)(3.18)

    =n

    i=1

    (qTqi)(q

    Ti q)

    + (qTq 1)(3.19)

    = qT

    n

    i=1

    qiqTi

    q + (qTq 1)(3.20)

    = qTIq + (qTq 1)(3.21)

    Differentiating with respect to q:

    (3.22)

    qf(q) = 2Iq + 2q

    which when equated to zero leads us the eigenvector equation Iq = q. Maximization

    of the objective function will occur when q = e1 the eigenvector associated with the

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    39/117

    29

    largest eigenvalue, thus proving the result. Now that we know the two are equivalent

    the eigenvector method will be preferred over the minimum distance method due to

    ease of computation. The only time one would use the latter is that it allows us to

    incorporate weights and thus calculate a weighted average.

    3.3 The Tangent Mapping Approach

    As we have mentioned in the previous chapter, the main problem we face when

    working with the quaternion representation of orientation is that we are working in

    a non-linear space, which in this case is the surface of a unit 4D hypersphere.

    One way we can get around this problem is to make use of a fact from group

    theory which states that the surface of a 4D hypersphere is a Lie group. The tangent

    space taken at a Lie groups identity is known as a Lie algebra and the Exponential

    map is used to move between the Lie Group and the Lie algebra (see figure 3.2).

    The Lie algebra for the space of unit quaternions is Euclidean IR3 and therefore if

    we map our unit quaternions onto this tangent space we have essentially a relatively

    straight forward method to getting around the non-linearity problem.

    3.3.1 Exponential and Logarithm maps for Quaternions

    In the previous chapter we saw that the polar form of a quaternion is basically an

    exponential of a vector in pure quaternion form:

    q = ev2(3.23)

    The logarithm of a quaternion is the inverse of the exponential and is defined as:

    log q = v

    2(3.24)

    In fact exponentiation is defined only for pure quaternions and conversely the loga-

    rithm of a quaternion always results in a pure quaternion. Since a pure quaternion is

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    40/117

    30

    Figure 3.2: Illustration of the exponential map and the logarithm map which allows us to movebetween quaternions which are on the surface of the sphere to points on the tangentspace taken at the identity

    a vector we see that the above definitions give us a way of mapping between vectors

    and quaternions.

    For the purposes of computation we define the exponential map as:

    (3.25) expmap(v) =

    [0, 1] if v=0

    [vsin 2

    , cos 2

    ] if v=0

    where v IR3, = v and v = v/. We compute the logarithm map by:

    (3.26) logmap(q) =v

    sinc 2

    where v is the vector part of q and sinc(x) = sin xx

    which is known as the sink function

    and is defined as x tends to zero4.

    4We can see this from the Taylor series expansion of the sink sinc2

    = 1 +

    2

    24

    4

    245!+ . . .

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    41/117

    31

    As we can see, the exponential and logarithm maps act as almost a conversion

    algorithm between quaternions and the axis-angle representation with the exception

    that the angle is not explicitly obtained but rather represented by the magnitude of

    the axis.

    From the above definitions, we notice that work is needed for this mapping to be

    unique. The first thing we need to do is restrict 2

    to be between [0, 2

    ]. Thus the

    exponential map will take points from a ball of radius 2

    to the quaternions. Unfortu-

    nately this mapping is unique only for the interior points of the ball; antipodal points

    on the surface of the ball represent the same rotation. This is because a rotation of

    about v or v results in the same orientation. Since the log mapped quaternion

    is a minimal representation using just three parameters, it is to be expected that it

    would suffer from a singularity. Luckily, this region is well defined as opposed to the

    gimbal lock singularity region of Euler angles.

    An important property of the exponential map is that it preserves the angle metric

    between the identity and each orientation, i.e.

    (3.27) logmap(q) 0 = arccos |q qI|

    As a by product of this, it also preserves the angle formed at the identity between

    longitudinal lines.5 This means that hyper circles or hyper ellipses on S3 centered

    on the identity maps to spheres and ellipsoids on the tangent space.

    This tangent mapping approach is a local linear approximation and as such the

    further our data is from the identity the more distorted our approximation becomes.

    The exponential map does not preserve the angle metric between two quaternions

    unless one of them is the identity and the further away from the identity these points

    5Think of longitudinal lines on the Earth. They all lie on great circles that pass through the north and southpoles.

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    42/117

    32

    are the greater the discrepancy between the angle metric on S3 and the Euclidean

    metric on the tangent space.

    The exponential and logarithm map formulae are defined such that the tangent

    space is taken at the identity. This is not a problem if our data is centered at the

    identity but it is far more likely that this is not the case. To take the tangent space

    at a point other than the identity we need to rotate our data such that our tangent

    point coincides with the identity. This is essentially a change of coordinate system.

    Suppose we have n data points q1, . . . , qn and we wish to map these quaternions to

    the tangent space taken at q. We need to rotate our data such that q becomes the

    identity. The rotation required is the conjugate q and thus we need to multiply6

    our data by this conjugate to obtain our rotated data

    (3.28) q q1, . . . , q qn.

    We can then use our existing formulae to map to and from the tangent space remem-

    bering to multiply to the right by q to return to our original co-ordinate system.

    A good explanation of the exponential and logarithm maps are given in Grassia

    (1998) while explanations of Lie groups and Lie algebras can be found in Weisstein

    (2006).

    3.3.2 Distribution Theory on the Tangent Space

    Coming up with a plausible probability distribution for quaternions native to S3

    is not a simple task but there are some that have been developed, most notably the

    Bingham distribution which we will talk about in a later section. We can, however,

    describe the likely characteristics such a distribution would take. Suppose we are

    looking to model the orientation of the hand when a person initially grasps a door-6Quaternion multiplication is non-commutative and so we need to keep track of which side we performed our

    multiplication so that we can return to our original co-ordinate system when we map back from our tangent space

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    43/117

    33

    (a) In 3D (b) In 2D

    Figure 3.3: Illustration of the Tangent Gaussian distribution in lower dimensions.

    knob before opening a door. We would reasonably expect there to be a single most

    probable orientation the hand will take and a continuum of less probable orientations

    the further we get from that modal orientation. In such cases a Gaussian distribution

    centered at the mode appears to be a reasonable potential candidate.

    Antipodal symmetry of quaternions means that the distribution needs to be bi-

    modal since q and q represent the same orientation they should obviously be equally

    likely. If we were to visualize S

    3

    as the earth then we can imagine the North andSouth poles being the modes with the distribution being mirror images of each other

    above and below the equator. Thus it is possible to restrict ourselves to just one

    hemisphere and then flip any quaternion that is in the wrong hemisphere by taking

    its antipode.

    In the tangent mapping approach, we will use a standard zero-mean trivariate

    Gaussian density as our model for the tangent vectors taken at one of the modes.

    Thus the density can be written as:

    (3.29) f(q; , m) =1

    23

    2 ||1

    2

    e1

    2vTv,

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    44/117

    34

    where v = logmap(m q) i.e. the tangent vector of q taken at the mean/mode m

    and is the covariance matrix which is symmetric and positive definite.7

    (3.30) = PDPT,

    Eigen decomposition of gives us the matrix P SO(3) of eigenvectors which is

    conceptually the rotation of the tangent space that is needed to align the principal

    axes of the data with that of the tangent space and the D the diagonal matrix of

    eigenvalues which can be interpreted as the variances along those axes. This provides

    us with some intuition as to what the covariance matrix represents.

    Since the exponential map preserves angles at the identity between longitudinal

    lines as well as distances of points from the identity, isoprobability contours for this

    distribution which are in the from of ellipsoids will map onto hyper-ellipses on S3

    centered at the tangent point. We shall call this the Tangent Gaussian distribution

    from now on (see figure 3.3).

    3.3.3 Joint Range of Motion Limits

    In our application to human motion, we need to consider joint range of motion

    limits. All joints in the human body allow only a limited range of orientations.

    Even the most flexible joints, such as the wrist, do not allow complete freedom of

    movement. We would like a quick and simple method to estimate approximations

    of these joint limits, for the purpose of filtering out any implausible orientations

    from predictions we make. We concentrate on joints that allow rotations with three

    degrees of freedom. Limits for joints with two or less degrees of freedom are easily

    found.

    The common practice is to create limits using the Euler Angle representations thus

    creating one-dimensional limits for each Euler angle. Beyond the obvious problems7If we have less than three rotational degrees of freedom will be singular!

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    45/117

    35

    created by ignoring the interdependency of the Euler angles it would be computa-

    tionally expensive to apply our quaternion data as we would first have to convert to

    rotation matrices and then to Euler angles before applying the limits. Recent work

    by Herda et al. (2002) attempts to estimate this boundary using quaternion fields,

    but this is quite complex and it is vital that the data contain nearly all possible

    orientations along the boundary of the joint limit as otherwise there will be gaps

    and potholes in the estimate.

    Let us consider a conceptual distribution of all possible orientations allowed by

    the joint for which we are trying to obtain the limit. It would be centered at a

    low-stress, neutral equilibrium orientation and the further we get from this point the

    more extreme and less comfortable the orientation would be. We can then equate

    comfort of a particular orientation with how probable it is high comfort = high

    probability and low comfort = low probability. For simplicity, we approximate the

    set of orientations with equal comfort, i.e. comfort contours as hyperellipses on S3.

    This would then mean that on the tangent space, these limits can be expressed as

    3 dimensional ellipsoids. This is unlikely to be true but we are sacrificing accuracy

    for simplicity and speed as the purpose of using the limit is as a quick check on

    prediction plausibility. These ellipsoidal joint limits can be obtained from data by

    using the sample covariance matrix to estimate a Mahalanobis distance limit.

    Suppose we wish to find the range of motion limit to a joint that links segment

    A with segment B. The first step is to make sure that we are using local quaternion

    data of segment A with respect to segment B. For the most part we would not use

    global orientations for the limit as it does not isolate the joint in question but rather

    provides the accumulated effect of every joint in the body. Thus for datasets with

    complex motions that has the figure not only moving its arm but turning,twisting

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    46/117

    36

    and walking; a global joint range of motion limit could conceivably mean the entire

    space of rotations SO(3)!

    We define the Mahalanobis distance of a quaternion q from the mean/mode

    quaternion m as:

    (3.31) dMah(q) = D1

    2 PTlogmap(q m)

    where D and P are the diagonal matrix of eigenvalues and its corresponding matrix of

    eigenvectors, respectively, obtained from decomposing the covariance matrix . Thus

    the Mahalanobis distance can be interpreted as the number of standard deviations

    away from the mean our data is.

    Let be the value of this distance that denotes the joint range of motion limit. A

    logical estimator of is the maximal Mahalanobis distance obtained from our data,

    i.e.,

    (3.32) = maxqq1,...,qn

    (dMah(q)).

    One needs to keep in mind that this estimator is dependent on the point at which

    we take our tangent space m and therefore we need to make sure when we apply this

    limit that we are in the correct space.

    Obviously, the quality of this estimated limit depends on the quality of the data.

    We would ideally like for the data to be a random sample of orientations where the

    joint reaches the boundary of its range of motion limit. We will discuss the problems

    that arise when this assumption does not hold true when we apply our limit to real

    experimental data in chapter four.

    3.3.4 Interpolation and Smoothing

    The basic fundamental interpolator between two quaternions is the spherical

    linear interpolator or slerp introduced by Shoemake (1985). It interpolates along

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    47/117

    37

    the shortest geodesic path which in this case would be the great circle arc that goes

    through the two quaternions. The slerp between two quaternions q1 and q2 is given

    by:

    (3.33) slerp(q1, q2, ) =sin(1 ) 2

    sin 2q1 +

    sin 2sin 2

    q2,

    where cos 2 = q1 q2. Visualizing this geometrically, we see that the slerp embodies

    Eulers rotation theorem in that it finds the rotation that will take it from the initial

    to the final orientation and the interpolation path is obtained by varying the angle

    of rotation around the rotation axis.

    The slerp interpolator is native to S3 and is not necessarily preserved on the tan-

    gent space, i.e. the slerp interpolation path between two quaternions when mapped

    onto the tangent plane does not equal the interpolation path obtained by using

    a normal convex sum based linear interpolation between the two tangent mapped

    quaternions. It is preserved, however, if either the initial or the final quaternion is

    the point at which the tangent space is taken. This is directly due to the fact that

    the exponential map preserves the angle of rotation metric of a quaternion from the

    identity.

    Unfortunately, the likelihood that our motion data contains just two key frames or

    postures is basically zero, and the slerp cannot be used to create a smooth interpola-

    tion path between more than two. A more complex spline-type approach is required

    for this. With the tangent mapping approach we are no longer restricted to the the

    surface of the hypersphere, and thus we can call upon an abundance of well-defined

    methods. Prentice (1987) also uses this idea, employing the exponential map derived

    directly from SO(3), which is also a Lie group and is a higher dimensional extension

    of the method by Jupp and Kent (1987).

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    48/117

    38

    The approach we will be taking is to fit regression splines 8 to our tangent mapped

    quaternion trajectories using cubic B-spline basis functions. The reason we make this

    choice is two-fold; we reduce the dimensionality of our data and by using an equal

    number of uniform knot points, combined with a rescaling of actual time to relative

    time, we can circumvent the problem of having varying lengths for the trajectories.

    Dimension reduction is a major issue with motion data as a five second motion

    captured at a frequency of twenty hertz will lead to a hundred quaternion data

    points on our orientation trajectory. This is the method used by Faraway (2000)

    except that we have a trivariate response instead of a univariate one.

    Let us denote the function we are approximating as q(t). The spline function is

    given as a linear combination of m cubic B-spline basis functions,m

    j=1 pj j(t), and

    the objective is to choose control points pj such that we minimize:

    (3.34) (t) =

    10

    q(t) m

    j=1

    pjj(t)dt

    2,

    where t [0, 1] denotes proportional time. Since we only observe q(t) at fixed

    intervals the problem in matrix equation form becomes to minimize:

    (3.35) tr(ETE),

    where

    (3.36) En3 = Qn3 nmPm3,

    and n denotes the number of frames or postures in the observed trajectory. The

    matrix is made up of the basis function values and its derivation is given in the

    appendix . Using least squares, the matrix of spline control points, P, is calculated

    as:

    (3.37) P = (T)1TQ.8This method implies that we are approximating the trajectory and not interpolating it.

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    49/117

    39

    The raw marker data obtained from the measurement devices tend to have a lot

    of noise. Filtering methods are used to smooth the marker data and consequently

    produce smooth orientation trajectories. Due to this filtering, sensitivity with the

    choice of m is normally not an issue. We want to choose m to be large enough to

    capture any true systematic patterns but not so large that it will start capturing any

    random noise elements.

    3.3.5 Hemisphere Commonization and Data Concentration: The Slerp Residual

    The exponential and logarithm map, as we have defined it, is a mapping between

    one hemisphere of S3 and a subset of IR3, namely the ball of radius

    2

    . Thus we

    require the data to be in the hemisphere centered at the point at which the tangent

    is taken which we will call the tangent hemisphere. As quaternions are antipodally

    symmetric this is not a hard problem: we need only choose the antipode closest to

    the tangent point.

    Here is a simple, two-step algorithm for achieving this common hemisphere. Sup-

    pose that we have posture data q1, . . . , qn and we wish to take the tangent at q

    (normally the mean). The steps are:

    1. Calculate q qi for i = 1, . . . , n.

    2. Ifq qi < 0 then replace qi with qi.

    This flipping method where we take the antipode of quaternions not already

    in the tangent hemisphere is suitable for posture data, but there exists a potential

    problem with applying it to motion data. Suppose we have an orientation trajectory

    that is close to the hemisphere border and that it passes through it. The flipping

    algorithm would then result in the sections of the trajectory that were in the non-

    tangent hemisphere being flipped to the opposite side of the sphere thus introducing

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    50/117

    40

    Figure 3.4: Illustration of the potential problem in using the flipping algorithm on an orientationtrajectory that exists on the boundary between hemispheres. The original trajectorystarts in the upper hemisphere and curves down to the lower hemisphere before returningback to the upper hemisphere. Using the flipping algorithm we would flip our smileon the lower hemisphere to the other side of the sphere to create a frown on the upperhemisphere.

    discontinuities to the path, as seen in figure 3.4. This makes it impossible for us

    to apply not only the interpolation and spline techniques mentioned previously, but

    any functional analysis of trajectory data.

    For this reason we introduce the concept ofslerp residuals. The slerp interpolator

    introduced previously can be thought of as astraight line model that creates a

    straight trajectory from an initial orientation to a final orientation. We define the

    slerp residuals to be the difference between the actual orientation trajectory and

    the slerp model trajectory. By difference we mean the rotation required to take

    us from a point on the slerp model trajectory to a corresponding point on the actual

    trajectory. This is graphically illustrated in figure 3.5.

    Suppose we have an orientation trajectory made up of n observed posture orien-

    tations, q1, . . . , qn. The first step in obtaining our slerp residuals is to calculate our

    slerp model trajectory. One possible method for obtaining our trajectory is to use

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    51/117

    41

    (a) Slerp Model Trajectory (b) Slerp Residuals

    Figure 3.5: Illustration of the slerp model and the slerp residuals. The slerp model(a) gives theshortest trajectory on the sphere between two points. The slerp residuals (b) are therotations, shown as arrows, that take us from the slerp trajectory to the actual observedtrajectory

    the slerp interpolator to create n equally spaced postures, i.e., the angle between

    each subsequent posture orientation is constant. Our slerp trajectory would then be

    (3.38)

    q1, slerp

    q1, q2,

    1

    n 1

    , slerp

    q1, q2,

    2

    n 1

    , . . . , slerp

    q1, q2,

    n 2

    n 1

    , qn,

    which gives us an orientation trajectory that has a constant rotational speed or a

    constant angular speed profile. Such a model is unrealistic as people do not move at

    constant speeds unless trying to do so on purpose. However, that is not a problem for

    the purpose of calculating slerp residuals. The angular speed profile of the observed

    trajectory, q1, . . . , qn, will be passed on to the slerp residuals as one that is relative

    to a constant speed profile.

    The purpose of the slerp residuals is not only for us to avoid the potential of

    a discontinuity being introduced by the flipping algorithm, but also to reduce the

    spread of our data as much as possible by concentrating it around the identity.

    This improves the quality of our linear approximation on the tangent plane which

    is obviously a desirable objective. The way to maximize the concentration of the

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    52/117

    42

    slerp residuals is to apply the angular speed profile from our observed trajectory

    to our slerp model trajectory. The constant speed slerp model would result in less

    concentrated slerp residuals.

    Note that we are using an angular speed profile and not a velocity profile. The

    slerp interpolator produces orientations from a fixed axis of rotation and so these

    two are the same but for our observed trajectory it is unlikely that we have one.

    Thus we need to ignore the directional aspect of a velocity profile and use a speed

    profile instead. We calculate the angular speed profile of an orientation trajectory,

    q1, . . . , qn, as:

    (3.39) si = arccos |qi qi+1|

    for i = 1, . . . , n 1.

    Using this angular speed profile we create the following speed adjusted slerp model

    trajectory:

    (3.40)

    q1, slerp

    q1, q2, s1n1

    i=1 si

    , slerp

    q1, q2,

    2i=1 sin1i=1 si

    , . . . , slerp

    q1, q2,

    n2i=1 sin1i=1 si

    , qn.

    We now have a slerp model trajectory s1, . . . , sn, whether it is speed-adjusted or

    constant, along with our observed trajectory q1, . . . , qn and from these we calculate

    the slerp residuals as:

    (3.41) ri = si qi,

    for i = 1, . . . , n. As with all quaternion multiplication we need to be cognizant of

    the order in which this is done due to non-commutativity.

    Since q1 = s1 and qn = sn, we have that r1 = rn = qI, the identity quaternion.

    Thus we have, in effect, transformed our data to form slerp residual trajectories

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    53/117

    43

    that start and end at the identity. The extent to which we have concentrated our

    data depends upon how close our slerp model trajectories are to the actual observed

    trajectories, but it should result in data that are much less spread out and therefore

    entirely remove the incidence of discontinuous trajectories formed by the flipping

    algorithm.

    The drawback with this residual approach is that we lose information on the

    starting and ending orientation of our trajectory. Thus we would need to either

    predict these separately or be given this information as input, which is usually the

    case. On the other hand, if the task is to predict an orientation trajectory that is

    constrained to start and end at specified orientations then this method is the only

    viable way of doing so.

    3.3.6 Functional Regression Modelling of Orientation Trajectories

    Our ultimate goal, as we mentioned in the introduction, is to model the three

    degrees of freedom orientation trajectories of certain body segments during human

    motion with respect to covariates such as age, anthropometry, gender, target locationand starting and ending orientations. Our approach is to treat these trajectories

    as functions and therefore use statistical functional data analysis techniques. The

    reference for this sort of analysis is the book by Ramsay and Silverman (1997).

    All of the sections in this chapter preceding the current one have dealt with

    methods that we need for us to be able to perform a functional regression analysis

    of our quaternion orientation trajectories on the covariates listed above. Faraway

    (1997) introduces this functional regression model for univariate functions. Suppose

    we have n response functions given by y(t) = (y1(t), . . . , yn(t) and xi being the p-

    variate vector of covariates for the ith response function. The functional linear model

  • 8/2/2019 2006_Statistical Analysis of Orientation Trajectories via Qua Tern Ions With Applications to Human Motions

    54/117

    44

    is then given by:

    (3.42) yi(t) = xTi (t) + i(t).

    This is similar to the standard regression model except that the response yi(t), errorterm i(t) and vector of regression coefficients (t) are now all functions. We can

    interpret the jth coefficient function j(t) for j = 1, . . . , p as the effect of the jth

    c