# Optical High-Speed Rolling Mark Detection Using Object Detection and Levenshtein Distance
## 3 Camera-Based Rolling Marks Detection  
A rolling mark can be considered a \"surface anomaly\" due to its distinctive elevation on the rail. To enhance the visibility of these marks, dark field illumination is employed in image processing techniques. In this work, the illumination setup was similar to that depicted in Figure 3. All objects were located within the structure gauge specified in the railroad area. The emitted light was directed onto the rail surface but not directly back into the camera. Only in the vicinity of a raised surface, such as a rolling mark, does some of the light reflect back to the camera, resulting in brighter contours of the mark in the captured image (as shown in Figure 4).  
Figure 3: Concept drawing of the applied darkfield illumination.  
Furthermore, the illumination system differentiated between red and green colors, exploiting the photometric stereo effect. This technique takes advantage of the varying angles of light incidence to create shading variations, which can help to accentuate surface features. A similar principle was utilized in [2] to detect defects on the rail surface. Building upon this principle, the present work employed it to further enhance the visibility of rolling marks. Furthermore, an optical bandpass filter, tuned to the wavelength of the illumination, was used, reducing ambient influences, such as sunlight.  
To enable the extraction of information from a rolling mark, the process involved two main steps: detection (localization) of the mark in the image and subsequent interpretation. While conventional computer vision approaches often rely on a combination of neural networks for object detection, such as You Only Look Once (YOLO) [3], along with additional text recognition software (OCR, Optical Character Recognition, e.g., [4; 5]), this work adopted a different approach (YOLO is a widely used object detector that has been intensively characterized in numerous computer vision benchmarks [6] offering high frame rates and a relatively user-friendly software framework).  
In this work, each individual character of the rolling mark string was detected separately using the deep learning-based YOLO object detector. This approach allows for more precise localization of each character within the mark. Subsequently, the identified characters were passed to a parser that utilized the Levenshtein distance metric [7] for the interpretation and analysis of the rolling mark. By treating each character as an individual object of interest, the proposed approach provides more flexibility and accuracy in capturing the intricate details of the rolling mark. This method avoids the need for additional preprocessing steps, such as converting the region of interest to a binary image, which are commonly employed in traditional object detection and OCR techniques. The parser, leveraging the Levenshtein distance metric (explained in detail in Section 3.2), compared the detected characters with reference rolling marks and performed corrective actions according to the calculated distance. This enabled the system to handle partially incorrectly recognized marks and ensure the accurate interpretation of the rolling mark content. This novel combination of an object detection technique and the power of the Levenshtein distance-based parser provides a robust and efficient solution for rolling mark detection and interpretation.