# An Improved Shoulder Line Extraction Method Fusing Edge Detection and Regional Growing Algorithm
## 2 Materials and Methods
### Burr Removal  
The resulting shoulder line had some parasitic components in line corners, as shown in Figure 5. These parasitic components are called burrs. These burrs can lead to uncertain positions of the shoulder line. When the shoulder line was transformed from a grid to a vector, this defect became more prominent.  
Figure 4: Slope’s influence on the positive and negative terrain classification results: (**a**) represents the classification map of positive and negative terrain; (**b**) represents the results after slope correction.  
Figure 5: Contrast between before (**a**) and after (**b**) burr removal.  
Figure 3: Illustration of regional growth: (**a–d**) represent the four steps of the regional growing algorithm, respectively.  
This study used a morphological image-processing method to remove burrs. The basic principle of this method was that fixed structure elements were used to detect and thin the endpoint (Equation (3)). Structure elements were used to detect and remove burrs. The algorithm was as follows: (1) The threshold of endpoint thinning was determined. We observed the image; if the length of a burr was less than 3 pixels, the threshold was set to 5 pixels to guarantee the reliability of the experimental results. (2) The structure elements were determined. The diagonal pixels could be ignored because the growing method only used four neighbor pixels. This study used the structure elements as shown in Figure 6. In these elements, \"\(\times\)\" represents ignored pixels, \"1\" depicts shoulder line pixels, and \"0\" denotes background pixels. In an analysis window, if the image value agreed with any structure element in Figure 6, then \"0\" was set as the center pixel value (Equation (4)). The whole image was scanned using structure elements that could only remove one endpoint pixel at once. The above operation was repeated five times to ensure that the burrs were completely removed. The difference between before and after the above-mentioned steps is shown in Figure 5. (3) The correct end points were recovered. Given that this method processed all the end points, the correct end points were also removed, as were the burrs. The next step was to recover the correct end points. Structure elements were used to scan the whole image and remove the end points again. The burrs were already removed after the previous five scans. Accordingly, the pixels removed at this time were the correct end points. Thereafter, we performed four neighbor expansions and obtained the intersection with the original shoulder line (Equation (5)). The expansion time was the same as the thinning time. The complete process of this study method is shown in Figure 7.  
\[X_{1}=A\vartriangle\{B\} \tag{3}\]  
where \(A\) is the original shoulder line, \(B\) is the structure elements, \(\vartriangle\) is the thinning, and \(X_{1}\) is the thinning result.  
\[X_{2}=\mathop{\cup}\limits_{k=1}^{8}\left(X_{1}\odot B^{k}\right) \tag{4}\]  
where \(X_{2}\) is the end point, \(B^{k}\) (\(k\) = 1, 2, 3, 4) are the structure elements, and \(\odot\) is the hit-miss transformation.  
\[X_{3}=\left(X_{2}\oplus H\right)\cap A \tag{5}\]  
where \(X_{3}\) is the shoulder line, \(H\) is a four-neighborhood structure element, \(A\) is the original shoulder line, and \(\oplus\) is the expansion.  
\begin{tabular}{|c|c|c|} \hline \(0\) & \(0\) & \(0\) \\ \hline \(0\) & \(1\) & \(0\) \\ \hline \(\times\) & \(1\) & \(\times\) \\ \hline \end{tabular}  
Figure 6: Structure elements.