# Gear Integrated Error Determination Using the Gaussian Template Convolution-Facet Method
## 4 Obtaining Gear Integrated Error Based on GTC\(-\)Facet
### Calculation of Pitch Deviation and Profile Deviation  
The key to calculating the gear integrated error based on visual images lies in the precise extraction of profiles. Classic edge detection algorithms can only extract pixel-level contours. By using the GTC\(-\)Facet sub-pixel positioning algorithm proposed in this article, the pixel-level edge contours can be further subdivided into sub-pixel levels. The effect is shown in Figure 7, and the blue arrow represents the gradient amplitude and direction of the gray level at the sub-pixel coordinate point. For ease of expression, draw an arrow every three coordinate points and reduce the amplitude of the arrow by ten. Figure 6: Circle fitting of the center hole contour on the gear end face. Take the extracted center point of the gear end face as the center of the circle, measure the radius of the theoretical indexing circle as the radius, intersect with the profile, and sort the intersection points according to the serial number of the gear teeth. As it shown in Figure 8:  
The actual angle \(\alpha_{i}\) corresponding to the single left pitch can be calculated from the vectors \(OL_{i}\) and \(OL_{i+1}\) (the same to the single right pitch):  
\[\alpha_{i}=\arccos\frac{OL_{i}\cdot OL_{i+1}}{|OL_{i}\cdot OL_{i+1}|},i=1,2, \ldots z-1 \tag{29}\]  
This can further calculate the corresponding arc length between \(L_{i}\) and \(L_{i+1}\), which is the actual tooth pitch \(P_{i}\):  
\[P_{i}=d_{M}/2\cdot\alpha_{i}=d/2\cdot\alpha_{i} \tag{30}\]  
The individual single-pitch deviation \(f_{pti}\) is as follows:  
\[f_{pti}=P_{i}-P \tag{31}\]  
The theoretical tooth pitch \(P=\pi d/z\) in the equation is calculated at the indexing circle, and the single-pitch deviation \(f_{pti}\) is the maximum absolute value of \(f_{pti}\):  
\[f_{pti}=\max\lvert f_{pti}\rvert \tag{32}\]  
Sector pitch deviation \(F_{pk}\):  
\[F_{pk}=\sum_{i=j}^{j+k}f_{pti} \tag{33}\]  
Figure 8: Solving pitch deviation from the extracted contour from the image. Figure 7: Gradient amplitude and direction of sub-pixel points. Cumulative pitch deviation \(F_{p}\):  
\[F_{p}=\max(F_{pk})-\min(F_{pk}) \tag{34}\]  
In the previous step, the sub-pixel coordinate set of the gear profile has been obtained. Before calculating the profile deviation, the theoretical involute corresponding to each profile needs to be generated. When the starting point \((r_{b},0)\) of the involute is located, the involute equation is (the left and right profiles are the same) as follows:  
Figure 8:0  
Figure 8:1  
In the formula, \(r_{b}\) is the radius of the basic circle, \(\varphi\) is the rolling angle, and \(\varphi=\tan\alpha\); \(\alpha\) is the pressure angle at any point on a segment profile, \(\alpha=\arccos(r_{b}/r)\), and \(r\) is the distance from that point on the profile to the center of the circle. Each profile has an intersection point with the basic circle, and to obtain the angle \(\gamma\) at which each intersection rotates relative to \((r_{b},0)\), the involute equation is as follows:  
Figure 8:2  
Figure 8:3  
The position of the theoretical involute is shown in Figure 8:4  
As shown in Figure 10, place the coordinate origin at the center of the circle, where \(A(x_{i},y_{i})\) is a point on the actual profile, the red curve represents the theoretical involute, and point \(A\) on the actual profile is perpendicular to the theoretical involute, with a perpendicular foot of \(P(x,y)\). According to the properties of the involute, the line connecting \(PA\) is also tangent to the basic circle at point \(T\). Assuming that the angle between the starting point of the involute and the tangent point \(T\) is \(\theta\) and the length of \(OA\) is \(\rho\), then  
Figure 8:5  
Figure 8:6 Calculation of profile deviation. Figure 8:7 Theoretical involute at the corresponding profile position.