Rail inspection is very important for ensuring safety and preventing dangerous situations. Track super-structure can have different types of anomalies such as defects of rail surface and sleepers, missing of fastening elements and deviations in the contour of the ballast. In this paper we present a vision-based technique for automatically detecting the absence of the fastening bolts that secure the rails to the sleepers. The inspection system uses images from a digital line scan camera installed under a train. The images are preprocessed by using several combinations of wavelet transform and principal component analysis methods. Two different types of classifiers analyse the images in order to evaluate the preprocessing technique that gives the highest rate in detecting the presence of the bolts. The final detecting system (the best combination preprocessing technique and classifier) was applied on a long sequence of real images showing a high reliability and robustness. Results in terms of the detection rate and false positive rate are given in the paper.