Visual inspection techniques for rail surface defects have become prevalent approaches to obtain information on rail surface damage. However, uneven illumination leads to illegibility of local information, and the change of the wheel-rail area results in the changeful background of the rail surface, both of which pose challenges to the visual inspection. This paper proposes a novel algorithm that detects rail surface defects via partitioned edge features (PEF). PEF eliminates the effect of uneven illumination by effectively extracting edge features and building homogeneous background on the ra...