Keywords

1 Introduction

In many real-life scenarios time-varying signal analysis requires averaging (or template generation) from samples that come from many measurements [1,2,3,4]. There are several state-of-the art methods which can be used averaging. Among most popular is Kalman Filter (KF) [5] that is used for example in kinematic model synthesis [6,7,8]. Other popular method is DTW barycenter averaging (DBA) [9], which was already used in movements’ analysis [10, 11]. One can use the smoothing ability of KF to average the signals that came from multiple measurements of the same angle. However, in the situation when signals cannot be wrapped optimally linearly, the nonlinearity between signals will be smoothed by the KF. This smoothing might visually damage the recorded content, because it might treat nonlinearity as noise. Due to this we choose DBA approach.

The motivation of this paper was a need to create the averaged karate action templates for future use in athletes’ kinematic analysis. That approach has many important applications. For example it can be applied in computer supervised training to calculate and visualize an average performance of an athlete or to compare it to templates of world class sportsmen’s to find the optimize the action’s technique. The aim of this paper is to propose and initial evaluate our novel algorithm that enables averaging of time-varying sequences of rotations with three degrees of freedom described by quaternions. To our best knowledge the method of this kind has not yet been reported in scientific papers. The methodology is based on DBA with one minus dot product distance function, Markley’s quaternions averaging method [12] and Gaussian quaternion signal smoothing. The proposed algorithm is applied to generate single averaged motion capture (MoCap) recording from ten MoCap of mawashi-geri karate kick of black belt Shorin-Ryu karate master. We have used inverse kinematic model.

2 Materials and Methods

This section presents all algorithms that are used for MoCap signal averaging and smoothing. Due to paper space limitation we did not provide the details of Markley’s and DBA algorithm that can be found elsewhere (in [9, 12] appropriately).

2.1 Quaternion Averaging

For the Quaternion averaging we have utilized Markley’s algorithm [12]. It determines the average norm-preserving quaternion from a set of weighted quaternions. The solution involves an eigenvalue/eigenvector decomposition of a matrix composed of the given quaternions weights matrix.

2.2 Signal Averaging

To average a set of time-varying signals we have used Dynamic Time Warping barycenter averaging (DBA) heuristic algorithm [9] that uses Dynamic Time Warping (DTW) similarity measure. The cost function in DTW for quaternions is defined as:

$$\begin{aligned} cf(x,y) = 1 - (x \circ y) \end{aligned}$$
(1)

where x, y are normalized quaternions and \(\circ \) is a dot product. Because we are dealing with quaternions, the barycenter averaging is replaced by Markley’s algorithm from Sect. 2.1.

Signal Averaging Algorithm

figure a

2.3 Smoothing Algorithm

It is possible that DBA algorithm introduces in averaged signals the high frequency noises that are visible as rapid Euler angles hops. This is of course result of the DBA heuristic which does not prevent these situations even if input data does not contain that type of noises. Our smoothing algorithm works similarly to typical discrete linear convolution algorithm with Gaussian kernel, however instead of linear combination of signal samples in kernel window and kernel weights, we use Markley’s algorithm from Sect. 2.1 with Gaussian weights.

Smoothing Algorithm

figure b

2.4 MoCap Averaging

The averaging algorithm for MoCap data works as follows. As an input it takes a set of MoCap recordings of a single activity. They may vary in length, however they have to use the same kinematic model. In our case we use inverse kinematic model with 16 various features that represents the rotation of body joints with three degrees of freedom in Euler angles (see Fig. 1). The Euler angles are recalculated to quaternions. This step remove problems caused by nonlinearity in Euler angles domain: \([-180, 180)\) for rotation towards X axis, \([-90, 90)\) for Y and \([-180, 180)\) for Z. Also quaternions prevent the gimbal lock phenomena. Signal in each feature of each recording is interpolated to the uniform length with nearest neighbor interpolation. It is obvious that signals among single MoCap recording have same number of frames, however different MoCap recordings may have different frames number. The new length equals the longest signal in the input dataset. After averaging all features, each of the averaged signals is smoothed with algorithm from Sect. 2.3. The obtained averaged and smoothed quaternions are recalculated to Euler angles.

Fig. 1.
figure 1

This figure presents the 16 points over the human body in which three-dimensional rotations in Euler angles are measured. Figure presents also local coordinate systems for each measuring point.

3 Results

To evaluate our novel MoCap averaging algorithm, we have used recording of black belt Shorin-Ryu karate master. The activity we wanted to average was a mawashi-geri kick with a right leg. We have recorded ten repetitions of this kick with a Shadow 2.0 wireless motion capture system. The tracking frequency was 100 Hz with 0.5\(^\circ \) static accuracy and 2\(^\circ \) dynamic accuracy. We have prepared data to be in reverse kinematic model which is presented in Fig. 1. Data was recalculated from Euler angles representation to quaternions and we applied the methodology that was presented in Sect. 2 of this paper. The length of the signals among those ten recordings varied from 226 to 249 frames, due to this the averaged signal had length of 249 frames. We have calculated 100 iterations of DBA method after which results became stable.

In Figs. 2, 3 and 4 we have presented the plots of Euler angles values that describe the rotation in hips measuring point about X, Y and Z axis. The dotted plots are values from input data set (they names begins with Hips in legend of plots). The blue solid line is a result of averaging by algorithm from Sect. 2.2. The red solid line is plot smoothed with algorithm from Sect. 2.3. In Figs. 5, 6 and 7 we have presented the plots of Euler angles values that describe the rotation in RightLeg measuring point about X, Y and Z axis. Dotted plots are values from input data set, solid black lines are results of averaging and red plot are smoothed results from black plot.

Fig. 2.
figure 2

This figure presents the plots of Euler angles values that describe the rotation in Hips measuring point for about X axis. (Color figure online)

Fig. 3.
figure 3

This figure presents the plots of Euler angles values that describe the rotation in Hips measuring point for about Y axis. (Color figure online)

Fig. 4.
figure 4

This figure presents the plots of Euler angles values that describe the rotation in Hips measuring point for about Z axis. (Color figure online)

Fig. 5.
figure 5

This figure presents the plots of Euler angles values that describe the rotation in RightLeg measuring point for about X axis. (Color figure online)

Fig. 6.
figure 6

This figure presents the plots of Euler angles values that describe the rotation in RightLeg measuring point for about Y axis. (Color figure online)

Fig. 7.
figure 7

This figure presents the plots of Euler angles values that describe the rotation in RightLeg measuring point for about Z axis. (Color figure online)

We have also prepared visualization of MoCap recordings averaged by our methodology to check if our algorithm did not introduce some visible deviations from expected limbs trajectories. In Fig. 8 we present rendering of important parts of averaged mawashi-geri kick.

Fig. 8.
figure 8

This figure presents rendering of important parts of averaged mawashi-geri kick done by our algorithm.

To evaluate how similar averaged signals are to the input dataset we have used DTW normalized distance between each time-varying signal (in quaternions) and averaged signal. The normalized distance is defined as a DTW distance divided by the sum of length of two signals between which distance is calculated. In Fig. 9 we present those results in the form of heat map with color-coded values. In Table 1 we present means and standard deviations of that comparison grouped by features (measuring points) names.

Table 1. This table summarizes results from proposed algorithms evaluation.
Fig. 9.
figure 9

This figure presents normalized DTW distance between averaged signals and input data in the form of heat map with color-coded values. Each row represents different input recording (there were totally 10 MoCap recordings in our data set) while each column is for different measuring point name.

4 Discussion

As can be seen in Figs. 2 and 4, the proposed method deals very well with nonlinearity in rotation description caused by periodicity of Euler angles notation. Also two very similar rotations might be composed of two sets of three rotations about X, Y and Z axis that might have quite different values, for example compare signal 9 and 10 in Figs. 2 and 4 to other signals in those figures. Both those problems are solved thanks to applications of quaternions in DBA averaging. The DBA might introduce some high-frequency noises that are clearly visible in Figs. 2, 3, 4, 5, 6 and 7 as peaks of angle values in relatively smooth angles trajectories. Those noises are unwanted phenomena that should not appear in MoCap recordings which operate in frequency 100 Hz even while dealing with such fast body actions like karate. Those errors are introduced because DBA is a heuristic method. As can be seen on all plots, our smoothing method performed by an algorithm described in Sect. 2.3 removes those peaks very well without damaging the overall signal characteristic.

The visualization of MoCap recordings averaged by our methodology was judged by a karate master as very accurate. The averaging did not introduced visible deviations from expected limbs trajectories.

The results presented in Table 1 prove that mean DTW normalized distance between averaged signal and original signals varies from \(6.153 \cdot 10^{-3}\) for LeftForearm sensor to \(0.713 \cdot 10^{-3}\) for Hips sensor, which were very good results. The heat map in Fig. 9 shows that the biggest distance between averaged signals and input data is present in measuring points that describe position of hands, especially LeftForearm. This situation is caused by two facts. The first is that arm position is a bit less important than precise lower body movements in this technique and the professional karate athlete might pay a bit less attention to some small variation in his or her hands placement. The second fact was that we have some small MoCap errors introduced during data acquisition in the region of LeftForearm that resulted in less precise angles measurement.

5 Conclusions

In this paper we have presented the algorithm that enables averaging of multiple MoCap signals of the same full body action which is represented as the set of time-varying signals in inverse kinematic. Basing on discussion in previous section, we can conclude that the proposed method seems to be promising for that task. That type of averaging has many important applications. For example it can be used to calculate and visualize an average performance of an athlete who performs some activity that he or she wants to optimize in training. The numerical and visual data may be a very important feedback for the coach that supervises the training [13]. Also our method is not limited to MoCap data averaging; it can be applied to any type of quaternion-based time-varying sequences.

The next step of our researches will be evaluation of our algorithm on significantly larger dataset.