## 2 Proposed Method
### Dynamic Time Warping (DTW) Classifier  
DTW is an algorithm used for measuring similarities between two temporal sequences at different speeds [31]. DTW was originally designed for speech recognition and has been applied to temporal sequences in audio, video, and graphical data [32]. It can be used to analyze any data in a linear sequence. To implement DTW, two time sequences are needed--the original gesture template and the conducting gesture to recognize. DTW takes these two sequences and then calculates an optimal match between the two [33]. The gesture with the best match, in other words, the one with the highest similarity, is the recognized gesture. In this section, we visualize the implementation of DTW. In the visualization, five averaged template samples were used. Figure 8 illustrates the averaged samples in orange and a sample input from the user in blue. A difference was observed between the two, and it was possible to match them correctly by using DTW.  
To determine the degree of match, we used  
Figure 9, and i and j are the numbers of frames in each sequence. This equation has an initial condition of \(D(h_{t}(1),\ h_{u}(1))=|h_{t}(1)-h_{u}(1)|\) with the minimum being zero.  
This equation gives a distance matrix between the two time sequences. We can find the warping path between these two sequences by starting from \(h_{t}(1),\ h_{u}(1)\) and determining the minimum between the distances on the right, below, and diagonally. If the warping path goes diagonally, it is counted as a match. Otherwise, it is just counted as another step in the warping path. To calculate the percentage of accuracy from the template matching, we count the number of matches in the DTW algorithm and compare it with the number of matches that a perfect gesture would have. If the match is over the threshold, the gesture is considered a match. For our system, we set the threshold to 60%. We took the previous example and input the data into the algorithm. The distance matrix and the process of finding an optimal warping path are shown in Figure 9.  
Figure 8: Both the template and user data graphed together, where the blue curve indicates the template gesture and the orange curve indicates the user gesture.  
Figure 9: Dynamic warping path marked in red between the template data, marked in blue, and the user data, marked in orange.  
This warping path shows where the points of the two gestures are connected and how the path warps according to the distances between the two points. For example, in Figure 9, if there is no point match, the path will move horizontally until the end; otherwise, it will make turns by going down one step. In short, when the path goes down one step, it means that there is a point match. In our system, if the gesture made by the user had more than a 60% match with the template gesture, it was counted as a match and recognized as such. In Figure 10, we visualize the warping path by graphing the points and connecting them to each other where they match.  
In this case, the total number of matches in the aforementioned example was 40 out of 60, which provided an accuracy above the threshold. Our system takes each user's gesture and compares it, using DTW, with every template available and records the gesture with the highest accuracy as the output.  
Figure 10: _Cont._