# A Fully-Automatic Gap Filling Approach for Motion Capture Trajectories
## 1 Introduction  
Motion capture (MoCap) systems are used to digitally track and record human motion, with applications in clinical research, sports biomechanics, rehabilitation medicine, video game development, computer animation and others [1]. Optical MoCap systems use multiple cameras to estimate the three-dimensional (3D) position of a set of reflective markers that are strategically placed on the subject, allowing the quantitative analysis of human body kinematics [2, 3] and the generation of realistic animations [4]. MoCap cameras and its proprietary software are used to calibrate 3D volume with relation to a fixed 3-axis referential. If a marker is inside the volume and can be captured by two or more cameras, its 3D coordinates will be continuously estimated at a fixed frame rate. Once an acquisition period is completed, these data can be exported to a single file that associates the coordinates of all markers available at a particular frame to that frame. However, if a marker is not detected by two or more cameras, the system will not estimate its coordinates. This phenomenon is quite frequent and translates into incomplete marker trajectories that can occur due to a marker falling off or due to temporary marker occlusion caused by other body segments, interaction with physical objects and overall non-optimal experimental setups. The resultant gaps impair data quality and compromise the accuracy of the analysis [5, 6, 7]. Several methods have been proposed to handle this problem. Some of them are available in commercial MoCap post-processing software such as those provided by leading MoCap companies, such as Qualysis (Qualysis AB, Gothenburg, Sweden) or Vicon (Oxford Metric, Limited, Oxford, England). Even though they provide satisfactory results in manysituations, they still rely on manual intervention where the user needs to visually inspect each gap and decide how it should be filled [5]. This dependency on the user results in a time-consuming and cumbersome process. Various techniques have been proposed to estimate trajectories of markers in frames where they are missing (i.e., missing markers). Basic methods, such as interpolation, are typically ineffective for long gaps [8], and more advanced methods have been proposed for this reason. Some of them require prior knowledge of skeleton constraints [9], while others rely on previously recorded data (training data) from which marker dynamics and inter-marker relationships can be learned [10; 11]. Dynamic systems, e.g., Kalman filters [12; 13], have also been proposed, but they are rejected by several authors on the grounds that they are extremely susceptible to unbounded errors and, therefore, are not suitable for longer gaps [9; 14; 15]. The literature suggests that each method has its own advantages, and in some specific situations unsatisfactory results may be obtained. Some methods, for instance, are not applicable when gaps occur at the beginning or end of the measurement [8; 9]. Gap length, number of missing markers, motion speed and complexity and availability of training data and/or skeleton information are some of the factors that determine the choice of the method to use [7]. This means that a broader purpose solution for the problem of gap filling in MoCap sequences is still an open issue, as universal methods do not yet exist. In this sense, we propose a fully automatic gap filling algorithm that does not require prior training or training data, information about the skeleton or a dedicated calibration trial. The method is framed as an optimization problem on which a set of empirical principles is considered and used to define a set of equations for frame-wise minimization. The method requires the correct labelling of all markers prior to the gap filling task. We tested the algorithm in a set of artificially generated gaps featuring multiple activities captured using the full body marker set. We compared our approach with others available in commercial MoCap systems.