# Track Line Recognition Based on Morphological Thinning Algorithm +
## 4 Experiments and Results  
After preprocessing with the improved ZS algorithm, the preliminary track line was obtained, and the complete track line was then also obtained using the denoising algorithm. Finally, the track region was extracted using the track line matching algorithm. In order to verify the effectiveness of the proposed algorithm under different routes and different lighting conditions, various environmental conditions were tested. The tracks of different routes are usually classified into a single set of straight track lines, multiple sets of straight track lines (only focusing on the current traffic routes), curved with a large curvature, curves with a small curvature, two turnout roads and multiple turnout track lines. After the above processing, we obtained the image of a single-pixel-wide track line and the track region, colored in green. Our experimental results for different scenes are shown in Figures 15 and 16. Figure 16: Multiple turnout track lines and track region extraction. Figure 15: Single set of straight track lines and track region extraction. In order to verify the effectiveness of our method more comprehensively, a test dataset was established. Our test data were collected in Shaoguan City, Guangdong Province, China. We built a railway track video library comprising 380 items, including videos of different lighting conditions and directions of different driving routes. The resolution of each frame was 1920 \(\times\) 1080, and the frame rate was 10 fps. Several typical video frames in the video library are shown in Figure 18. Trains were traveling at a speed of 30 km/h, and the range of images captured by the camera was 10-150 m, which is sufficient to meet driver reaction needs. The algorithm code was implemented in the Visual Studio 2017 platform and runs in a 2 GB memory Intel Core I5 CPU. The speed at which the algorithm processes a 1920 \(\times\) 1080 single-frame image is 150 ms.  
To demonstrate the advantages of our method, we compared it with other methods; we tested the methods used in [30,32] and the related theoretical methods used in [36]. We randomly selected 10 videos from the dataset and processed them with these methods. Table 1 shows the results of the comparative experiment. In Table 2, TNF means total number of frames and GNF means total number of good frames (we removed the frames with discontinuities and noisy track lines). The method in [30] was based on Sobel. Research in [32] was based on ZS. Skeleton is a continuous thinning of the skeleton through morphological erosion and opening operations mentioned in the literature [36]. As can be seen from the table, under the same conditions, more frames with better extraction track lines are obtained through our method, and our processing accuracy is also higher. On sunny days, when the light was better, our accuracy is as high as 94.74%; however, in the evenings or on rainy days, our accuracy is a little lower; nevertheless, accuracy is still around 90%. Table 2 shows the results of the comparison between the running time of the track line extraction algorithm and the track region extraction algorithm under different lighting and different route scenes. It can be seen from Table 3, with our algorithm and according to the different conditions, each frame-image-processing time is slightly different. When dealing with complex track lines and rainy weather conditions, the processing time is relatively long (five frames per second); however, when dealing with good light and a simple track line, the processing time is slightly shorter (seven frames per second). Nevertheless, there is not much difference between them in terms of processing speed. The algorithm also meets the real-time requirements of freight railway. (More than five frames per second is sufficient for freight railroads, which do not have fast trains.) Figure 18: Driving routes under different lighting conditions and directions.