# A UAV-Based Visual Inspection Method for Rail Surface Defects
## 1 Introduction
Therefore, the existing object recognition methods based on sophisticated texture and shape features are unfeasible, due to the limitation of visual features [15]. Also, due to the above challenges, these inspection models based on inspection trains are unable to be used in the case of UAV rail images. To overcome these challenges, this paper presents a novel image enhancement algorithm based on [PERSON]'s law and a new threshold segmentation method based on the gray stretch in wavelet domain. [PERSON]'s law was first proposed by German physiologist [PERSON], and later formulated quantitatively as a mathematical expression referred to as Weber contrast by psychologist [PERSON] [33]. It reveals the global influence of background stimulus on humans' sensitivity to the intensity increment [34]. Weber contrast is commonly used in cases where small features are present on a large uniform background, i.e., where the average luminance is approximately equal to the background luminance [35]. Due to few defects existing on rail surfaces and the high reflection properties of rail surfaces, the brightness mean of longitudinal line along a track approximates to the background luminance. It is supposed that the [PERSON]'s law is suitable for enhancing UAV-based rail images. Therefore, this paper proposes a novel LWLC (Local Weber-like Contrast) algorithm based on [PERSON]'s law. Although the rail surface defects and backgrounds can be highlighted and homogenized by LWLC, respectively, noise points and low contrast of background and defects still exist in UAV-based rail images. This leads to inaccurate segmentation thresholds based on traditional threshold methods, such as Otsu method [36] and maximum entropy (ME) method [37]. An image segmentation method based on gray stretch and threshold algorithm (GSTA) [38] outperforms the Otsu method [38]. This method of GSTA uses the Otsu method to obtain a threshold after image wavelet decomposition, and then grayscale of object and background on this image is extended to a large scale based on this threshold. Subsequently, the Otsu method is also used to get an optimization after the image is reconstructed in wavelet domain. This method has achieved attractive results on image segmentation. In addition, the wavelet transform combined with median/mean filtering is extremely effective for image (or UAV image) de-noising [39; 31; 40]. Therefore, inspired by these successes, this paper put forward a new threshold method named _gray stretch maximum entropy_ (GSME), which utilizes gray stretch in wavelet domain combined with median filtering de-noising to increase defects detection performance. The advantages of the proposed methods in this paper are as follows: (1) LWLC algorithm is local, nonlinear, and illuminance independent. This algorithm can adapt to different sunlight illuminance, eliminate the significant changes of gray-scale, and highlight defects of UAV-based rail images. (2) The GSME method emphasizes gray stretch and image de-noising on rail images, and automatically gives more suitable segmentation thresholds for rail surface defects detection. (3) To the surface defects detection based on UAV-based rail images, a LWLC-GSME model that achieves a recall of 93.75% for T-I defects and a recall of 94.26% for T-II defects can provide a feasible solution. The remaining sections of this paper is organized as follows: details of the LWLC and the GSME algorithms are described in Methodology. The experiment setup and result analysis are presented in Experiment results and performance analysis. A conclusion is provided at the end of the paper.