Photogrammetric was widely used in engineering applications. But in a moving scene the standards’ position kept changed and accuracy of measurement would wave synchronously. To get a stable and precise optical measure system, a method using synchronously moving light standard with the camera was presented in this paper. The paper described the principle of measurement, the recognition algorithm and the height calculation. To meet the Real-time requirement a pre-computer method was used to optimize the calculation and to shorten the consume time. Experiments results show that the method has high accuracy and rapid detection speed to guarantee a constant clearance between the air pipe and uneven ground around railway.