The rail train number is the only sign information of the vehicle. It is very important to use the image processing method to locate the train number to improve the efficiency of rail train management. Therefore, an automatic image positioning framework for rail train numbers is developed. First, aiming at the problem of low contrast between the rail train number and vehicle body caused by insufficient illumination of the rail train in a tunnel and indoor, the improved single-scale Retinex algorithm based on brightness control is used to enhance the image, which provides the basis for subsequent train number image positioning. Then, a train number location algorithm based on speed-up robust features and stroke width transform is proposed to locate the train number accurately. The experimental results show that the accuracy of the developed method is 96.91% in the complex environment of uneven illumination and large distortion of rail train numbers.