## 5 Curvilinear Path Approximation
Firstly, a straight path model was estimated for the center pixel set \(\mathrm{S_{C}}\) in guidance window 1. The target points \(SN_{h}=\left\{b_{1},b_{2},\ldots,b_{\mathrm{S_{num}}}\right\}\), \(\left(h=1,2,\ldots F_{q}\right)\) are distinguished from the noise points, where \(S_{\mathrm{num}}\) is the number of target points, and \(SN_{1}\) are the target point set in guidance window 1. The straight path \(EI\) estimated is shown in Figure 12a, which can be expressed by the following formula: \(y=\beta_{1h}x+\beta_{0l}\left(h=1,2,\ldots F_{q}\right)\), where \(F_{\mathrm{q}}\) is the number of guidance window partitions. Secondly, the vertical distance \(vd_{i}\) from each point of the set \(SN_{1}\) to the straight path \(EI\) is calculated by means of Equation (22). Then, Equation (23) is used to obtain the mean squared error \(\sigma_{1}^{pix}\) of the vertical distance \(vd_{i}\) in guidance window 1. Figure 11: The framework of binary tree guidance window partition. \[\mathrm{vd}_{i} =\frac{\beta_{1h}x_{j}+\beta_{0h}-y_{i}}{\sqrt{\beta_{1h}^{2}+1}}\,\ i=1, \ldots,S_{num} \tag{22}\] \[\sigma_{h}^{pix} =\sqrt{\frac{1}{S_{num}}\sum_{i=1}^{S_{num}}\mathrm{vd}_{i}^{2}}\,\ h=1, 2,\ldots F_{q} \tag{23}\]  
If \(\sigma_{1}^{pix}\leq\Delta\alpha\), then the straight path \(EI\) is accepted as the approximation result for the curvilinear path \(AB\). The BTGWP approximation method stops. If \(\sigma_{1}^{pix}>\Delta\alpha\), then the current guidance window is partitioned to two subguidance windows, e.g., guidance window 1 is divided into guidance windows 2 and 3, as shown in Figure 12b. Thirdly, the IPSO-based path parameter estimation approach is again performed in guidance windows 2 and 3, respectively. The target point sets \(SN_{2}\) and \(SN_{3}\) are collected, with the corresponding straight path model \(E_{1}T_{1}\) and \(T_{1}I_{1}\) found, as shown in Figure 12b. Fourthly, the mean squared errors \(\sigma_{2}^{pix}\) and \(\sigma_{3}^{pix}\) of the vertical distances in guidance windows 2 and 3 are calculated by means of Equations (22) and (23). If \(\sigma_{2}^{pix}\leq\Delta\alpha\) and \(\sigma_{3}^{pix}\leq\Delta\alpha\), then the straight paths straight paths \(E_{1}T_{1}\) and \(T_{1}I_{1}\) are the final approximation results for guidance windows 2 and 3. If \(\sigma_{2}^{pix}>\Delta\alpha\) or \(\sigma_{3}^{pix}>\Delta\alpha\), then guidance window 2 or 3 is equally divided into two subguidance windows, e.g., guidance windows 4 and 5 replace guidance window 2, as shown in Figure 12c. The abovementioned process steps, i.e., the straight path model estimation, the mean squared error calculation, and the guidance window partition, are performed iteratively until the mean squared errors \(\sigma_{h}^{pix}\) of each guidance window are all less than the threshold \(\Delta\alpha\) predefined. Finally, a polyline path, containing a series of end-to-end lines, is generated as an approximation result for the curvilinear path. In terms of the operation requirements and the positioning accuracy in the industrial field, the radius of the curvilinear guide path and the approximation error threshold are preset as: \(R=0.8\) m  
Figure 12: The approximation process of curvilinear path. (**a**) The first estimation in the whole guidance window, (**b**) the second estimation in two subguidance windows, (**c**) the third estimation in four subguidance windows. and \(\Delta\alpha\)= 2 mm. The results of the curvilinear path approximation are shown in Figure 13. All mean squared errors \(\sigma_{h}^{pix}\) are less than the threshold \(\Delta\alpha\), as shown in Table 3. It is obvious that although a large number of noise points exist in the guide path image, the BTGWP approximation method can accurately convert an arbitrary curvilinear path into a polyline path, with high environmental adaptability and the curve approximation ability. It is noteworthy that the threshold \(\Delta\alpha\) will affect the result of guidance window partition.