Research on Image Preprocessing Algorithm for Rail Surface Recognition

Abstract

The rail surface status image is affected by the noise in the shooting environment and contains a large amount of interference information, which increases the difficulty of rail surface status identification. In order to solve this problem, a preprocessing method for the rail surface state image is proposed. The preprocessing process mainly includes image graying, image denoising, image geometric correction, image extraction, data amplification, and finally building the rail surface image database. The experimental results show that this method can efficiently complete image processing, facilitate feature extraction of rail surface status images, and improve rail surface status recognition accuracy.

Share and Cite:

Zuo, J. , Liu, L. , Yang, C. and Tang, Y. (2024) Research on Image Preprocessing Algorithm for Rail Surface Recognition. Open Journal of Applied Sciences, 14, 2801-2808. doi: 10.4236/ojapps.2024.1410183.

1. Introduction

The adhesion force formed when the rolling stock wheelset and the track contact each other will directly affect the effective performance of traction performance [1] [2]. Therefore, if you want to improve the traction capacity, you must make full use of the adhesion force between the wheel and rail. Due to the complexity of wheel-rail contact behavior and strong nonlinear coupling, the wheel-rail adhesion characteristics are complex and changeable, random, and have a large range of changes [3]-[6]. Even the adhesion characteristics at the same location will change significantly due to different environments, the corresponding real-time adhesion coefficient and adhesion peak point will also change accordingly. For example, when there are condensates such as ice, snow, oil, water, and fallen leaves on the rail surface, the adhesion characteristics will be significantly reduced [7]-[11]. To this end, the visual information under different rail surface conditions is researched and analyzed, and then the visual features of different rail surface conditions are extracted, so as to effectively identify the rail surface conditions, thereby improving wheel-rail adhesion utilization and vehicle operation efficiency [4] [12] [13]. The researchers first used the average method to grayscale the rail surface image, used the median denoising method to remove noise, used the Radon transformation method to perform geometric correction of the image, then extracted the rail surface area, and finally used mirror transformation, added noise. The rail surface image is amplified by brightness changes, and finally standardized to obtain a rail surface image data sample set, which lays the foundation for the research on rail surface state identification methods.

2. Acquisition of Rail Surface Image Data

The research object is to track surface images in different states (dry, wet, and oily), which are randomly captured using a CCD camera. After image preprocessing, three typical rail surface state images are finally obtained as image data sample sets for rail surface state identification experiments. Some rail surface pictures are shown in Figure 1.

Figure 1. Partial rail surface image. (a) Dry rail surface; (b) Wet rail surface; (c) Oil stained rail surface.

3. Image Preprocessing

Affected by noise such as the shooting environment, the rail surface state image contains a large amount of background information and other interference factors, so the rail surface state image needs to be preprocessed. The image preprocessing process mainly includes image grayscale → image denoising → image geometric correction → image Extraction → data amplification, finally forming a rail surface image database, which facilitates the research of image feature extraction and identification methods.

3.1. Image Grayscale Conversion

Color in life can be seen as the combination of pixel values of the red channel R, green channel G, and blue channel B. The value of each channel pixel ranges from 0 to 255. The purpose of image grayscale is to convert a three-channel color image into a single-channel image according to certain rules, that is, convert the pixel values of the R channel, G channel, and B channel of an image into a single-channel image with a pixel value of 0 - 255. In order to reduce the computational load of the rail surface state image, the RGB three-channel color image of the rail surface needs to be grayscaled. Grayscale processing methods mainly include weighted average method, average method and maximum method.

The average method is to average the pixel values of the RGB three channels in a color rail surface image. The result of the calculation is the gray value, which is converted into a single-channel grayscale rail surface image. Its conversion formula is as Formula (1):

I=1/3 ( R+G+B ) (1)

Among them, R, G, and B represent the pixel values of the three channels, and I represents the pixel value of the gray-scale rail surface image. The results of grayscale processing of dry, wet, and oily rail surface images based on the average method are shown in Figure 2. The storage space of the converted grayscale rail surface state image is 1/3 of the original, while reducing the computational load of rail surface image data extraction and improving operating efficiency.

(a) (b) (c)

Figure 2. Grayscale image processed by average value method. (a) Dry rail surface; (b) Wet rail surface; (c) Oil stained rail surface.

3.2. Image Denoising

Due to various noise interference, the rail surface state image is distorted, appearing as a bright spot or a dark spot. In order to avoid such problems, the rail surface image needs to be denoised. Commonly used methods for denoising include mean denoising, median denoising, and Gaussian denoising. The method of mean denoising is to take a point in the image as the center and average the pixel values of all points around this point. This value replaces the gray value of the center point. The calculation formula is as shown in Equation (2):

g( i,j )= 1 N ( i,j )M f( i,j ) (2)

Among them, f(i, j) represents the gray value of the center point, g(i, j) represents the gray value after the average operation, M is the set of pixel values of all points around the center point, and N represents the total of all points around the center point.

The method of Gaussian denoising is to use a Gaussian filter template to scan each row and column of the image, and obtain the new gray value of each point in the image through a convolution operation.

The method of median denoising is to arrange the gray values of points near the noise point in the image in ascending order to obtain a new sequence, and select the median of the new sequence as the new gray value of the noise point. The counting formula is shown in Formula (3):

g( i,j )=med( f 1 , f 2 ,, f n )={ f n+1 2 ,nis an old number 1 2 ( f n 2 + f n 2 +1 ),nis an even number (3)

Among them, { f 1 , f 2 ,, f n } represents the sequence of gray values of points near the noise point from small to large, g(i, j) represents the new gray value after denoising the median value of the noise point, n is the total number of pixels in the image.

3.3. Geometric Correction of Images

The image shooting angle is not vertical, resulting in geometric distortion of the rail surface image. Geometric correction of the image is required to facilitate the extraction of rail surface data. At present, Hough transform method and Radon transform method are often used to perform geometric correction of images. Hough correction is performed by finding the angle of the largest overlap point in the parameters. The Radon algorithm obtains the image tilt angle based on the projection angle of the superimposed positioning direction. Taking the dry image of the rail surface as an example, Figure 3(a) is the effect after Hough correction, and Figure 3(b) is the effect after Radon correction. It can be seen from Figure 3 that the effect of Radon geometric correction is the most ideal.

(a) (b) (c)

Figure 3. Geometric correction diagram of rail surface image. (a) Original image; (b) Image after Hough transform; (c) Image after Radon transform.

3.4. Rail Surface Area Extraction

After the rail surface image has been grayscaled, median denoised, and geometrically corrected, there is still a large amount of non-rail surface background information, which will affect the recognition accuracy of the rail surface state, so the rail surface area needs to be extracted. Rail surface area extraction process: first use the Canny second-order differential edge detection algorithm to obtain the shape of the rail surface area, then filter out non-rail surface areas through image morphology processing, and finally obtain the coordinates corresponding to the rail surface area to realize the extraction of the rail surface area. The extraction process of dry rail surface is taken as an example to illustrate the rail surface image extraction process, as shown in Figure 4.

1) Extract the rail image based on the Canny algorithm, as shown in Figure 4(b).

Figure 4. The results of rail surface image extraction. (a) Original image; (b) Canny edge extraction; (c) Closed operation; (d) Second erosion operation; (e) Opening operation; (f) Rail surface image.

2) Perform closed operation, the operation operator is [25, 25], the result is shown in Figure 4(c).

3) Perform an erosion operation to remove the noise information in the non-orbital range, using the column vector [1, 1, 1] as the operator. The result is shown in Figure 4(d).

4) Perform the opening operation, using [25, 25] as the operator, and the result is shown in Figure 4(e).

5) Finally, delete areas with pixels less than 2000 to filter out non-rail surface areas. And it is segmented according to the coordinates of the rail surface area, and finally the rail surface image in Figure 4(f) is obtained.

3.5. Amplification of Rail Surface Image Data

In order to meet the image data quantity requirements for image recognition, the rail image data needs to be amplified. The amplification methods include mirror transformation, superimposed Gaussian noise, brightness transformation, etc.

1) Mirror transformation

The effect of rail surface image mirroring change is shown in Figure 5. Figure 5(a) is the original image, Figure 5(b) is the effect after horizontal mirroring of the image, and Figure 5(c) is the effect after vertical mirroring of the image.

Figure 5. Effect diagram of rail surface image mirroring. (a) Original image; (b) Image after horizontal mirroring; (c) Image after vertical mirroring.

2) Addition of noise

Adding Gaussian noise to the original image can improve the robustness of the training model. Gaussian noise signal is also called a normal distribution signal, and its probability density function satisfies Equation (4):

p( h )= 1 2πσ e ( hn ) 2 / 2 σ 2 (4)

In the formula, h represents the Gaussian noise signal, and σ represents the standard deviation of h. σ2 represents the variance of h.

The result of adding Gaussian noise to the rail surface image is shown in Figure 6. Figure 6(a) is the original image, Figure 6(b) is the Gaussian noise image with σ2 added as 0.01, and Figure 6(c) is the Gaussian noise image with σ2 added as 0.05.

Figure 6. The result of adding Gaussian noise to the rail surface image. (a) Original image; (b) Mean 0, variance 0.01; (c) Mean 0, variance 0.05.

3) Brightness transformation

The brightness of an image represents how light or dark the image. f(i, j) represents the pixel grayscale of the original rail surface image, and the pixel grayscale after image brightness transformation is g(i, j), then

g( i,j )=f( i,j )+b (5)

In the formula, b represents the brightness factor, b > 0, the image becomes brighter, b < 0, the image becomes darker. The image brightness transformation effect is shown in Figure 7. Figure 7(a) is the original image, Figure 7(b) is the image darkening effect when b is −5%, and Figure 7(c) is the image brightening effect when b is +5%.

Figure 7. Rail surface brightness transformation effect diagram. (a) Original image; (b) b = −5% image; (c) b = +5% image.

4. Construction of Image Data Sample Library

After preprocessing, the rail surface status image can form an image data sample library, which is convenient for rail surface status identification. However, standard sizes need to be unified. The specific steps are as follows:

1) Use the Prewitt algorithm to detect the edge of the rail surface image. Let the image outline be P and the rail surface state image be f(i, j), as shown in Equation (6):

G( i )=| [ f( i1,j1 )+f( i1,j )+f( i1,j+1 ) ][ f( i+1,j1 )+f( i+1,j )+f( i+1,j+1 ) ] | G( j )=| [ f( i1,j+1 )+f( i,j+1 )+f( i+1,j+1 ) ][ f( i1,j1 )+f( i,j1 )+f( i+1,j1 ) ] | (6)

P( i,j )= G i + G j (7)

Among them, Gi represents the gray value above and below the image point (i, j), Gj represents the gray value left and right of the image point (i, j); P(i, j) is the rail surface state image outline.

2) Calculate the width W and length L of the rail surface status image outline P, and compare the sizes of W and L. If W > L, the image is scaled horizontally to 256 pixels. If W < L, the image is scaled vertically to 256 pixels. After the above processing, image P1 is obtained.

3) Place the P1 image in the center of a 256 * 256 image to perform short-side black filling on the image. A total of 240 rail surface images were taken on site, including 80 images of dry rail surface, 80 images of wet rail surface, and 80 images of oily rail surface. After image preprocessing, the number was increased to 1885, and the images were standardized to establish an image recognition database.

5. Conclusion

The researchers collected rail surface state images, then preprocessed the rail surface images to extract rail surface area images, and finally standardized them to obtain rail surface image data sample sets. Experimental results show that this method is fast in extracting rail surface area images. With low cost and high accuracy, an ideal image sample database can be obtained, laying a foundation for the research on rail surface status identification methods.

Acknowledgements

The research was supported in part by Hunan Provincial Natural Science Foundation of China (Grant Number: 2022JJ50095), and in part by Hunan Education Department Scientific Research Project of China (Grant Number: 22B1013).

Conflicts of Interest

The authors declare no conflicts of interest regarding the publication of this paper.

References

[1] Yu, H., Peng, C., Liu, J., Zhang, J. and Liu, L. (2024) Improved Metric-Learning-Based Recognition Method for Rail Surface State with Small-Sample Data. IEEE Access, 12, 4985-4996.
https://doi.org/10.1109/access.2023.3347634
[2] Pichlik, P. and Bauer, J. (2021) Adhesion Characteristic Slope Estimation for Wheel Slip Control Purpose Based on UKF. IEEE Transactions on Vehicular Technology, 70, 4303-4311.
https://doi.org/10.1109/tvt.2021.3072484
[3] He, K., Zhang, X., Ren, S. and Sun, J. (2016) Deep Residual Learning for Image Recognition. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), Las Vegas, 27-30 June 2016, 770-778.
https://doi.org/10.1109/cvpr.2016.90
[4] Zheng, S., Zhong, Q., Chen, X., Peng, L. and Cui, G. (2022) The Rail Surface Defects Recognition via Operating Service Rail Vehicle Vibrations. Machines, 10, Article 796.
https://doi.org/10.3390/machines10090796
[5] Alirezazadeh, P., Schirrmann, M. and Stolzenburg, F. (2022) Improving Deep Learning-Based Plant Disease Classification with Attention Mechanism. Gesunde Pflanzen, 75, 49-59.
https://doi.org/10.1007/s10343-022-00796-y
[6] Liu, J., Liu, L., He, J., Zhang, C. and Zhao, K. (2020) Wheel/rail Adhesion State Identification of Heavy-Haul Locomotive Based on Particle Swarm Optimization and Kernel Extreme Learning Machine. Journal of Advanced Transportation, 2020, Article ID: 8136939.
https://doi.org/10.1155/2020/8136939
[7] Luo, H., Cai, L. and Li, C. (2023) Rail Surface Defect Detection Based on an Improved Yolov5s. Applied Sciences, 13, Article 7330.
https://doi.org/10.3390/app13127330
[8] Chen, G., Wang, X., Ni, W. and Wei, L. (2023) A Steel Rail Surface Defect Detection and Recognition Method Based on Mask R-Transformer. 2023 IEEE 6th International Conference on Pattern Recognition and Artificial Intelligence (PRAI), Haikou, 18-20 August 2023, 299-305.
https://doi.org/10.1109/prai59366.2023.10332076
[9] Zhong, Y. and Chen, G. (2024) Rail Surface Defect Detection Based on Dual-Path Feature Fusion. Electronics, 13, Article 2564.
https://doi.org/10.3390/electronics13132564
[10] Hu, Q., Tang, B., Jiang, L., Zhu, F. and Zhao, X. (2022) Rail Surface Defects Detection Based on Yolo V5 Integrated with Transformer. 2022 IEEE 5th International Conference on Electronics Technology (ICET), Chengdu, 13-16 May 2022, 1131-1135.
https://doi.org/10.1109/icet55676.2022.9824255
[11] Yue, B., Wang, Y., Min, Y., Zhang, Z., Wang, W. and Yong, J. (2019) Rail Surface Defect Recognition Method Based on Adaboost Multi-Classifier Combination. 2019 Asia-Pacific Signal and Information Processing Association Annual Summit and Conference (APSIPA ASC), Lanzhou, 18-21 November 2019, 391-396.
https://doi.org/10.1109/apsipaasc47483.2019.9023096
[12] Li, Q. and Ren, S. (2012) A Visual Detection System for Rail Surface Defects. IEEE Transactions on Systems, Man, and Cybernetics, Part C (Applications and Reviews), 42, 1531-1542.
https://doi.org/10.1109/tsmcc.2012.2198814
[13] Xia, Y., Han, S.W. and Kwon, H.J. (2023) Image Generation and Recognition for Railway Surface Defect Detection. Sensors, 23, Article 4793.
https://doi.org/10.3390/s23104793

Copyright © 2025 by authors and Scientific Research Publishing Inc.

Creative Commons License

This work and the related PDF file are licensed under a Creative Commons Attribution 4.0 International License.