Dynamically measuring rail profile using the structured-light vision suffers from random vibrations on the line laser projector, which would cause distorted rail profiles. This paper presents a simple and effective distortion rectifying method to address this issue. The distorted rail profile is rectified by easily projecting it onto an auxiliary plane which is parallel to the cross section of rail. In order to establish the auxiliary plane, three profiles formed by radiating multiline structured light on rail are used to fit the rail longitudinal axis. More importantly, only one of the light planes is required to be calibrated beforehand. The others are calibrated online with the proposed self-calibration method, which is based on collinearity and parallelity constraints on the scene points of different rail profiles and requires only one image of the scene. Apart from evaluating the implementation with comprehensive experiments, we compare our method against other published works. The results exhibit its effectiveness and superiority in terms of the dynamic measurement of the rail profile.