# In-Motion, Non-Contact Detection of Ties and Ballasts on Railroad Tracks
## 5 Analysis
### Moving Standard Deviation  
As noted earlier, based on visual observation of the track and the measurements, tie surfaces are expected to have fewer variations than ballast surfaces because of their different surface characteristics, irrespective of their height level. This approach uses surface variance to distinguish between ties and ballasts. A moving window over discrete data sections is used to calculate the standard deviation within each window, denoted as \"moving standard deviation\" here. Equation (2) represents the standard deviation formula. Figure 9 illustrates the process of moving standard deviation. The red bracket with the size  
Figure 8: High-speed testing of LiDAR system on a simulated railroad track: (**a**) 19 mph (30 km/h); (**b**) 37 mph (59 km/h). The orange-shaded areas correspond to ties, while the unshaded areas correspond to ballasts. of _ws_ moves along the data and calculates the standard deviation of the data within the \"_i_\" data points within the window (i.e., \(x_{i}\)). \(\overline{x}\) denotes the average of the data points, \(x_{i}\). \[\textit{Standard deviation}=\sqrt{\frac{\sum_{i=1}^{\textit{ws}}\left(x_{i}- \overline{x}\right)^{2}}{\textit{ws}-1}} \tag{2}\]  
It is expected that the resulting moving standard deviation would enforce the surface characteristics in the ties and ballasts, leading to more confidence in differentiating between them than would be possible from the individual data points, \(x_{i}\). The standard deviation over the ties is expected to be lower than over the ballasts, enabling us to identify each. Figure 10 shows a sample plot for the mainline track testing mentioned earlier. The left axis shows the measured distance from the LiDAR sensor to the tie and ballast surfaces. The right axis shows the moving standard deviation for a spatial window of 4 inches (\(\sim\)10 cm). A spatial window is used because the measurements are made at various speeds that would yield differing numbers of samples on tie and ballast surfaces. Using a spatial window, such as one over 4 inches, would enable a more direct comparison between measurements at different speeds by relating them to a physical reference, such as one-half of the nominal width of a tie. The moving standard deviation (the purple line) exhibits an interesting pattern: it reaches a trough toward the center of the tie and a peak near the boundary between the ties and ballasts. This is because the data near the center of the tie are more consistent and have fewer variations, leading to lower standard deviations. In contrast, the measurements at the interface between the ties and ballasts are highly varied, leading to larger standard deviations. Figure 10: LiDAR system measurements for branch-line track testing at 4 mph showing measured distances from the LiDAR sensor to tie and ballast surfaces (gray line) and the moving standard deviation of the distances for a 4-inch spatial window (purple line). Ties are marked with orange shading, and unshaded areas represent ballasts. Figure 9: A graphical illustration of moving standard deviation for analyzing the LiDAR sensor measurements used for tie and ballast differentiation. The newly introduced parameter, moving standard deviation, is more interpretable for computers in distinguishing ties and ballasts compared to using measured distances. This method captures surface variations more effectively and enforces new distinct patterns associated with ties and ballasts (local minimums and maximums), enabling easier differentiation between ties and ballasts than before. Even though this method proved to be successful in differentiating between ties and ballast on the mainline track, it may prove inadequate for branch lines where the variation in data is larger than in the sample data used here. Specifically, large variations in tie surfaces, such as cracks and cuts or displaced and titled ties, can adversely affect the accuracy of the results.