# Research on the Positioning Method of Steel Belt Anchor Holes Applied in Coal Mine Underground
## 4 Realization of Steel Belt Anchor Hole Positioning
### Positioning of the Anchor Holes  
The Hough transform is a typical algorithm in the field of digital image processing and machine vision [28] and can be applied to the detection of straight lines and circles. The properties of the anchor hole boundaries after binarization are similar to those of the image, so the principle of the Hough transform can be applied to the detection of circles in the matrix.  
A point \(i\) on the boundary in Figure 12 has the coordinates of \((x_{i},y_{i})\), which can be a point on a circle with radius \(R\) and center coordinates \((X_{i},Y_{i})\), as shown in Equation (3):  
\[(x_{i}-X_{i})^{2}+(y_{i}-Y_{i})^{2}=R^{2} \tag{3}\]  
Equation (3) can be transformed, as shown below:  
\[X_{i}=x_{i}-R\cos\theta \tag{4}\]  
\[Y_{i}=y_{i}-R\sin\theta \tag{5}\]  
In the equation, \(\theta\) is the angle, \(0^{\circ}\leq\theta\leq 359^{\circ}\), and \(\theta\) takes an integer.  
For point \((x_{i},y_{i})\), set \(R_{\text{max}}\) and \(R_{\text{min}}\) to the radius of the anchor hole of the steel belt as a reference and take the value between them in turn. For each \(R\) value, take \(\theta\) value from \(1^{\circ}\) to \(359^{\circ}\) in turn, and calculate the centroid coordinates \((X_{i},Y_{i})\) according to Equations (4) and (5). Then, the centroid coordinates are obtained, and record the rounded centroid coordinates and the radius \(R\) used for calculating the centroid coordinates together. Iterate over the points on the boundary in Figure 12 and repeat the above operation; the recorded center coordinates and radius will be repeated. As the number of repetitions increases,  
Figure 12: Extracted map of binarized boundary.  
it means that more and more boundary points are on the circle with center coordinates \((X_{i},Y_{i})\) and radius \(R\). Calculate the number of repetitions, and find the largest number of repetitions of the center coordinates \((X_{i},Y_{i})\). At this time, the center coordinates \((X_{i},Y_{i})\) and radius \(R\) of the circle are composed of the largest number of boundary points, which is the closest to the true value of the anchor hole of the calculation of all the center coordinates and radius, so that the center coordinates and radius are considered to be the center coordinates and radius of the anchor hole. The flowchart is shown in Figure 13.  
Firstly, create a four-dimensional array to store the circle center coordinates, radius information, and the number of repetitions. When threshold segmentation is performed, there is an error between the radius of the circle sought in the extracted anchor hole boundary points and the actual anchor hole radius, so the maximum and minimum radii are set, and the radius of the anchor hole of the steel belt is within that range.  
Each a point on the boundary in Figure 12 is read. Starting from the smallest radius \(R=R_{\text{min}}\), the angle increases by \(1^{\circ}\), according to Equations (4) and (5) to calculate the center of the circle coordinates, and after rounding and radius are put into an array to calculate the number of repetitions, in the form of \([X_{i},Y_{i},R,m]\), \(m\) for the number of repetitions. After calculating all the points, iterate the four-dimensional array, and the largest value of \(m\) corresponding to the center of the circle coordinates and radius is required. By calculating, the obtained Hough circle detection result is shown in Figure 14.  
Figure 13: Flowchart of Hough circle detection program.