# A New Face Recognition Method for Intelligent Security
## 4 3D Human Face Recognition Method
### Improved Layered Elastic Matching Method
#### 4.2.2 Improved Layered Elastic Matching  
Matching is performed between two open curves \(A\) and \(B\). First, we establish the shape tree of curve \(A\) and then find its corresponding relationship on curve \(B\) to make the minimum deformation error between curve \(B\) and curve \(A\). The process of matching is described below. For the two to-be-matched curves \(A=(a_{1},a_{2},\cdots,a_{n})\) and \(B=(b_{1},b_{2},\cdots,b_{m})\), let \(a_{1}\) correspond to \(b_{1}\) and \(a_{n}\) to \(b_{m}\). The midpoint \(a_{i}\) of the shape tree of \(A\) divides the curve \(A\) into two parts \(A_{1}\) and \(A_{2}\). \(b_{2},b_{3},\cdots,b_{m-1}\) are sequentially made as the midpoint \(b_{j}\) of \(B\), and \(b_{j}\) divides the curve \(B\) into two parts, \(B_{1}\) and \(B_{2}\) corresponding to \(A_{1}\) and \(A_{2}\), respectively. If the point \(b_{j}\) is such that the similarity \(s_{1}\) of \(A_{1}\) and \(B_{1}\), the similarity \(s_{2}\) of \(A_{2}\) and \(B_{2}\) and the weighted similarity \(s_{3}\) of the relative positions between the two midpoints \(L(a_{i}|a_{1},a_{n})\) and \(L(a_{j}|a_{1},a_{m})\) in the two curves leads the sum \(s=s_{1}+s_{2}+s_{3}\) to its minimum, the minimum similarity \(s\) is taken as the final similarity between \(A\) and \(B\). According to the similarity between \(A\) and \(B\), the similarity calculation between the subcurves \(A_{1}\) and \(B_{1}\) can be calculated according to the following optimal recursion equation:  
\[\varphi(A,B)=\min_{b_{j}\in B}(\varphi(A_{1},B_{1})+\varphi(A_{2},B_{2})+ \lambda_{A}*diff(L(a_{i}|a_{1},a_{n}),L(b_{j}|b_{1},b_{m}))), \tag{3}\]  
where \(dif\) represents the relative position error of the midpoint between \(A\) and \(B\), and \(\lambda_{A}\) is the weighting factor. We use different weights for different nodes on the shape tree to represent the degree of the deformation. In this study, the weighting factor is determined according to the length of the curve. For the deformation with the longer distance between the relative position of the midpoint and the first and last sampling points, a higher weighting factor \(\lambda_{A}\) is assigned, and the reverse is even smaller. Since we use the Bookstein coordinate system to represent the relative positional relationship of the three points, the point on the system is considered to be equivalent to the point on the morphospace [26]. Therefore, the relative position error of the midpoint is calculated by the Procrustes distance [27]. For the two points of the Bookstein coordinates \((x_{1},y_{1})\) and \((w_{1},z_{1})\) we first map \((w_{1},z_{1})\) to \((u_{1},v_{1})\) according to Equation (4):  
\[(u_{1},v_{1})=(w_{1}\cos\theta-z_{1}\sin\theta,w_{1}\sin\theta+z_{1}\cos\theta), \tag{4}\]  
where  
\[\theta=\tan^{-1}\left(\frac{w_{1}y_{1}-z_{1}x_{1}}{w_{1}x_{1}+z_{1 And their Procrustes distance:  
\[dif=\sqrt{\left(u_{1}-x_{1}\right)^{2}+\left(v_{1}-y_{1}\right)^{2}}. \tag{6}\]  
The following discussion is about the default condition of \(\varphi(A,B)\) when there are only two sampling points in \(A\) or \(B\). A curve with only two sample points is equivalent to a line segment, and the cost for matching is zero when they are matched. When the length of one-line segment and another separable curve is determined, the matching cost increases as the length of the separable curve increases, and the cost decreases when the length decreases. Affected by its attitude, the surface of the human face undergoes some deformation, and different weights of curve similarity in different areas should be given for weighted fusion. The weight of the forehead area is increased, and the weight of the mouth and eye area is decreased. The weight calculation is shown in Equation (7):  
\[w_{i}=\left\{ \begin{array}{c}\mathrm{e}^{-i/6},i=1,2,3,\\ \mathrm{e}^{-(8-i)/6},i=4,5,6,\end{array} \right. \tag{7}\]  
where \(i\) is the serial number of the radial curve and the area where the radial curve located is the empirical value.