A railroad switch machine monitoring system is an important system for realizing centralized supervision, comprehensive evaluation, and accident prevention. There is a need to improve the maintenance of electric switch machines, in particular the locking mechanism, which needs precise adjustment to within 0.1 mm. The work that we present here is concerned with the application of an image processing algorithm that detects the indication indentation of switch machines. In this study, the Canny edge detector is used to obtain the edge values in binary image. The Zhang Suen thinning method is used to reduce the thickness of the edges. In post-processing, the probabilistic Hough transform (PHT) is used to detect the lines through the edge lines obtained. The proposed approach significantly improves the performance of the line detection and makes the transform more robust to the detection of the spurious lines.