# Dynamic Hand Gesture Recognition for Smart Lifecare Routines via K-Ary Tree Hashing Classifier
## 3 Material and Methods
### Features Extraction
#### 3.4.2 Frame Differencing  
Keyframes are the representation of the elements in the image sequences. In this model, the keyframes have been extracted that exhibit the dynamic hand gestures. Each hand shows a gesture that is localized by a set of points. To find the difference in the positions of the landmarks, the first and the pause frame sequences are taken as the keyframes. Figure 6 illustrates the change in the position of the pixel between different frames. The first frame  
Figure 4: Hand landmarks localization results in hand gestures using the skeleton method. Figure 5: The results of the Bezier curve. is well established. To find the motion of the hand gestures, we have adopted the following method of frame difference as defined in Equation (10) [52; 53; 54; 55; 56]. \[Diff_{k}(x,y)\ =\ |Frame_{k}(x,y)-Frame_{k-1}(x,y)| \tag{10}\]  
where \(Frame_{k}(x,y)\) and \(Frame_{k-1}(x,y)\) are the two consecutive frames in which the hand is not moving and \(Diff_{k}\) is defined as in Equation (11). \[Diff_{k}(x,y)\ =\ |Frame_{k}(x,y)-Frame_{k-1}(x,y)|\approx 0 \tag{11}\]  
where \(Frame_{k}(x,y)\) is the pause keyframe. The two continuous frames are impossible to be the keyframes. Thus, if \(Frame_{k-1}(x,y)\) is the keyframe, then \(Frame_{k}(x,y)\) is not the keyframe. Therefore, for each frame sequence, \(Frame_{k}(x,y)\) with \(N\) number of frames: The following approach should be outlined as:  
1. Initialize the keyframe number with \(n=1\). So, the keyframes are marked as \(M_{1}(x)\ =\ 1\), \(M_{k}(x)\ =\ 0\), \(k\ =\ (2,\dots,\ N)\). After that, compute the difference frame \(Diff_{k}\) between \(Frame_{k}(x,y)\) and \(Frame_{k-1}(x,y)\), \(k\ =\ (2,\dots,\ N)\). Compute the valid pixels of \(N\). 2. If \(N>\mathit{Thresh_{1}}\) and \(M_{k-1}(x)\ =\ 0\), set \(n=n+1\), set \(M_{k}(x)\ =\ 1\). 3. Set \(k=k+1\) if the value of \(k\) is less than \(N\). Then repeat the steps, otherwise end the procedure. 4. After calculating the frame difference, each key point \(L\) in the first keyframe and \(L^{{}^{\prime}}\) points in the other keyframes positions are calculated using the distance formula defined in Equation (12). \[Distance\ =\ \sqrt{\left(L1^{\prime}-L1\right)^{2}+\left(L2^{\prime}-L2 \right)} \tag{12}\]  
D Point Clouds  
For appearance-based features, extracted the 3D point clouds. The following are the main steps of extracting the appearance-based features [57; 58; 59]. 1. First, a central point on the palm is taken and the maximum distance \(d\) between the central point and the edges \(E_{i}\) point of the gesture region is calculated. After that, ten different lengths of the radius are defined as \(X\ =\ n\times\frac{d}{10}\)_where_\(n\ =\ 1,2,3,\dots 10\). Next, the center of the rhombus is defined as C and the radiuses \(r_{n}\). We have drawn 10 rhombuses (innermost is the first rhombus and outmost is the tenth rhombus) as shown in Figure 7. To highlight the effect of changing hand gestures, the color of the rhombus changes on the hand. 2. In Figure 7, it is visible that every rhombus has a different number of intersections with hand gesture regions. For finding the number of stretched fingers \(S\), we have  
Figure 6: Illustration of the change in the direction between different frames’ extreme points. taken the sixth rhombus (according to the thumb rule). In the sixth rhombus, we extracted those points whose colors vary from green to yellow and yellow to green. We define \(G_{i}\) as the point whose color changes from green to yellow and \(Y_{i}\) as the point whose values changes from yellow to green. 3. Now, for midpoint identification, we define it as \(M_{i}\) which is the midpoint of \(G_{i}\) and \(Y_{i}\). Then, each midpoint \(M_{i}\) and the central point \(C\) can be connected through a line and the angles between the adjacent lines are calculated. The angles are represented as \(An_{j}\) (\(j=1,2,3\ldots\)\(I-1\)). 4. Using the thumb rule, the fifth rhombus is taken as a boundary line to divide the hand gesture into two parts.