## 3 Materials and Methods
### Feature Extraction  
Step 1: Create a set of hand gesture training images and get the database. The database contains training images \((M)\) of dimensions \(N\times N\): \(I_{1}\), \(I_{2}\),..., \(I_{M}\).  
Step 2: Represent each image \(I_{i}\) in a vector \(Z_{i}\) where \(1\leq i\leq M\) with dimension \(N^{2}\).  
Steps 3 and 4 allow normalizing the vectors of the images of gestures of the hand. This normalization eliminates common characteristics of the images of gestures, in such a way that every image vector represents to the only characteristic.  
Step 3: Calculate the average of the vector of the image:  
\[\Psi=\frac{1}{M}\sum_{i=1}^{M}Z_{i} \tag{1}\]  
Step 4: Get the difference image by subtracting the vector from the average image of each vector from the gesture training image:  
\[\Phi_{i}=Z_{i}-\Psi \tag{2}\]  
Thus, \(\Phi_{i}\) is the normalization of the vectors of the gesture images, \(Z_{i}\) is a vector of the gesture image and \(\Psi\) is a vector of the average image.  
The following steps are for calculating the Eigen vectors but first the covariance matrix \(C\) must be calculated.  
Step 5: Calculate the covariance matrix \(C\) with dimensions \(N^{2}\times N^{2}\):  
\[C=\frac{1}{M}\sum_{n=1}^{M}\Phi_{n}\Phi_{n}^{T}=AA^{T} \tag{3}\]  
where \(A=[\Phi_{1},\Phi_{2},\Phi_{3},\ldots,\Phi_{M}]\) is a column of matrix with each gesture normalized with dimensions \(N^{2}\times M\) where \(N^{2}\) is the number of rows and \(M\) is the number of columns.  
The dimensions of \(AA^{T}\)\([N^{2}\times N^{2}]\) are very large, therefore it generates \(N^{2}\) Eigen vectors of big size; the dimensions are as big as the gesture's own image. Therefore, there is a need to reduce the dimensionality with a reduced dimensionality covariance matrix. This can be done by calculating the covariance matrix in the following way:  
\[C=A^{T}A \tag{4}\]  
Step 6: Calculate the Eigen vectors \((u_{i})\) of \(A^{T}A\) with dimensions \(M\times M\), which has the same Eigen vectors and Eigen values of the covariance matrix \(AA^{T}\). Then, to calculate the \(u_{i}\), it has to be that the total number of rows in the covariance matrix gives the total number of Eigen vectors. That is, the total number of Eigen vectors \(=M\).  
Step 7: Calculate the best \(M\) Eigen vectors of \(AA^{T}\) with the following equation:  
\[v_{i}=Au_{i} \tag{5}\]  
where \(v_{i}\) is the upper Eigen vector in dimensional space while \(u_{i}\) is the lower Eigen vector in dimensional space.  
Step 8: Take only the Eigen vectors \((V)\) corresponding to the largest Eigen values \((V)\).  
To make the representation of the database of the training images using the Eigen vectors is when each gesture is projected in the space. It is for this reason that the projection of the gesture is calculated through the weight of each training image; therefore, the weight is calculated as follows:  
\[w_{j}=v_{j}^{T}\cdot(Z_{i}-\Psi) \tag{6}\]  
where \(j=1,2,3,\ldots,M\).  
As the weight vector is represented as:  
\[\mu=\left[w_{1},w_{2},w_{3},...,w_{M}\right]^{T} \tag{7}\]  
each image in the training database is represented by the weight vector in the following way:  
\[\mu_{i}=\left[w_{1}^{j},w_{2}^{j},w_{3}^{j},...,w_{M^{\prime}}^{j}\right]^{T} \tag{8}\]  
Thus, for each training image, the weight vectors are calculated and stored.