If the shaft diameter can be measured in-situ during the finishing process, the closed-loop control of the shaft diameter processing process can be realized and the machining accuracy can be improved. Present work studies the measurement of shaft diameter with the structured light system composed of a laser linear light source and a camera. The shaft is a kind of part with rotationally symmetric structure. When the linear structured light irradiates the surface of the shaft, a light stripe will be formed, and the light stripe is a part of the ellipse. Therefore, the in-situ measurement of the shaft diameter can be realized by the light stripe and the rotational symmetry of the shaft. The measurement model of shaft diameter is established by the ellipse formed by the intersection of the light plane and the measured shaft surface. Firstly, in the camera coordinate system, normal vector of the light plane and the coordinates of the ellipse center are obtained by the calibration; then, the equation of oblique elliptic cone is established by taking the ellipse as the bottom and the optical center of the camera as the top. Next, the measurement model of shaft diameter is obtained by the established oblique elliptic cone equation and theoretical image plane equation. Finally, the accuracy of the measurement model of shaft diameter is tested by the checkerboard calibration plate and a lathe. The test results show that the measurement model of shaft diameter is correct, and when the shaft diameter is 36.162mm, the speed is 1250r/min, the maximum average measurement error is 0.019mm. The measurement accuracy meets the engineering requirement.