Wheelset is one of the most important parts of the train, and the malfunction of the wheelset will directly affect the driving safety. Accurate and efficient wheelset geometric parameters detection is of great significance to the development of railway systems. Online measurement system using structured light is the current research hotspot, which has the advantages of non-contact, fast speed, etc. This paper proposes an in-field calibration method that is with simple operation, high efficiency and high precision for the on-line detection system. Position of the feature points was obtained with the accuracy of sub-pixel level. Considering two kinds of (radial and tangential distortion) distortions at the same time, the LM (Levenberg-Marquardt) optimization algorithm was used to obtain the nonlinear equations with the smallest comprehensive error. Then the internal and external parameters of the camera are obtained. In addition, the method has been applied to the site. High-precision result of wheel diameter which is obtained from on-line diameter inspection equipment can be used to correct the situation when the structure light deviates from the center of the circle. The field measurements show that the error of the wheel pair parameters using this algorithm is within 0.3 mm and has good repeatability.