# Evaluation of Human Action Based on Feature-Weighted Dynamic Time Warping
## 3 Data Acquisition and Processing
### Data processing  
During data collection, due to the occlusion of key points, ambient light, clothing worn, external interference, and equipment placement, there may be data gaps and noise, resulting in errors between experimental values and real values and loss of key information. In order to reduce the impact of these errors, gap filling and data filtering are required:  
1. Gap filling: In this paper, segmented cubic spline interpolation is used to fill the gaps. The main idea is to divide the data series into several intervals and use cubic polynomials to fit the data in each interval, thus calculating the value and filling in the gaps. The fitted curve is represented by the segmented function \(S(x)\); for example, \(n+1\) data points are given \((x_{i}y_{i})\), where \(i=0,1,\,\cdots,\,n\), \(x_{i}\)\(\in\)\([a,b]\). Segmentation is the division of the interval \([a,b]\) into n intervals [\((x_{0},x_{1})\), \((x_{1},\,x_{2})\),..., \((x_{n-1},\,x_{n})\)], where the left-end point \(x_{0}=a\), the right-end point \(x_{n}=b\), and a cubic polynomial of the shape \(y_{i}=a+bx_{i}+cx_{i}{}^{2}+dx_{i}{}^{3}\) is constructed in each interval. \(S(x)\) must meet the following conditions: 1. If the interpolation condition is satisfied, every point in the interval passes through a cubic spline function, that is, \(S(x_{i})=y_{i}\), where i = 0, 1, \(\cdots\), \(n\). 2. In each interval \([x_{i}x_{i}+1]\), there is a cubic polynomial. 3. Curve smoothing: \(S(x)\)\(\in\)\(C^{2}[a,b]\), \(S(x)\), \(S^{\prime}(x)\), and \(S^{\prime\prime}(x)\) are continuous over the interval \([a,b]\). \(S(x)\) can be solved by using three types of boundary conditions. Based on the cubic equation of \(S(x)\), each interval contains four unknowns. For n intervals, this results in \(4n\) unknowns, requiring an equal number of equations \((4n)\) to solve. In total, \(4n-2\) equations can be obtained from the three satisfying conditions of the cubic spline function, and the remaining two equations can be obtained from the boundary conditions, which are of three types:  
1. The second-order derivative of the specified endpoint, here \(M_{0}\) and \(M_{n}\), respectively. \(S^{\prime\prime}(x_{0})=M_{0}\), and \(S^{\prime\prime}(x_{n})=M_{n}\); in particular, when \(M_{0}=M_{n}=0\), that is, \(S^{\prime\prime}(x_{0})=S^{\prime\prime}(x_{n})=0\), they are called natural boundary conditions. 2. The first-order derivative of the specified endpoint, here \(m_{0}\) and \(m_{n}\), that is, \(S^{\prime}(x_{0})=m_{0}\) and \(S^{\prime}(x_{n})=m_{n}\). 3. S(x) is a periodic function with period (\(b\)-\(a\)): \(S^{(k)}(x_{0}+0)=S^{(k)}(x_{n}-0)\), with \(k=0,1,2\). Spline curves under three different boundary conditions are used, where boundary condition 1 is the second-order derivative of the specified endpoint, boundary condition 2 is the first-order derivative of the specified endpoint, and boundary condition 3 is a periodic function within the interval; the results are shown in Figure 4.  
From the figure, the spline curves under all three boundary conditions exhibit noticeable variations at the endpoints, while the curves remain almost unchanged in the middle section. Boundary condition 1 (natural boundary condition), where the second derivative at the endpoints is set to zero, results in the smoothest and most natural transition at the endpoints. This condition avoids unnecessary oscillations and ensures a smooth, continuous curve that better reflects the natural motion trends, especially in applications like human body key-point data interpolation. Compared with first-order derivatives or periodic boundary conditions, especially for motion data, the velocity and acceleration at the endpoints usually have physical significance. Setting the second derivative at the endpoints (i.e., acceleration) allows the interpolation curve to better align with the actual physical motion laws.