# Classification of Orientation

I am using inertial sensors to capture motion from the wrist/ ankles of subjects and synthesising this data into a feature set to be able to classify the activity performed by the subject (i.e. standing, walking, sitting).

On top of the metrics output by the sensors I would also like to be able to use the orientation of the limb segments for classification. I have been using an existing algorithm to determine the quaternions and can also convert these into Euler angles if need be.

My question is how best process these quaternions in order to feed them into a classifier to provide information about limb segment orientation to the classifier. The options for feeding the data into the classifier as far as I'm aware are as follows:

1) Feed each element of the quaterion as a feature: My concern is that each element of the quaternion is clearly non-linear and the classifier I use may not be sophisticated enough to be able to determine useful orientation information from this metric

2) Convert to Euler angles: This again suffers from a non-linear relationship with orientation relative to a world space depending on order of successive rotations (may be solved using extrinsic euler angles?)

3) Calculate Quaternion modulus from the non-unit quaternion: I have seen this method suggested in a paper on classification of EEG signals but I'm not sure of it's usefulness for this application. To be honest I'm not entirely sure on the what Quaternion modulus actually represents in real term other than for it's application in normalising quaternions. https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4813911/#B40-sensors-16-00336

Many thanks in advance for any help!

I don’t know about your method 3, but I do know about quaternions and Euler angles. I was discussing them over a beer last night, believe it or not.

The orientation (attitude) at each point has 3 degrees of freedom so 3 Euler angles describe it completely. A quaternion has one extra element which is superfluous. The point of quaternions is that some geometrical calculations are easier than with Euler angles.

The fact that the relation between input data and output data is nonlinear is not a problem, if you have sufficient data and you have a nonlinear model (basically, unless you insist on logistic regression).

But you can make it far easier for your model to learn the relation if you transform your input, or compute a different input from your raw data, that has a simpler relation.

For example, as input for your model you could provide the Euler angles of the orientation of each foot, the lower leg, the upper leg. But you can also compute the bend at the knee and the ankle, and the model will probably learn from that more easily.

• Thanks for your reply! The best way I can visualise quaternions is to imaging them (maybe incorrectly) as if they were axis-angle rotation whereby the 3 imaginary components define an axis and the magnitude defines the rotation around the axis. If I only provide the 3 imaginary components without the real component can the classify really perform how I would like it to? My concern with inputting each component of the quaternions is not just that each component is non-linear but also that actual orientation depends on the other components, i.e. (1 0.5 0 0.5) is very different from (1 0.5 0 0) Commented Sep 17, 2019 at 16:43
• No, I’m saying to use the Euler angles, or something derived from them (like how much the knee is bent). The imaginary components of the quaternion are not the angles...
– Paul
Commented Sep 17, 2019 at 17:18