Device and method for detecting mounting angle of Heidenhain length gauge

The invention discloses a device and a method for detecting a mounting angle of a Heidenhain length gauge. The device comprise an adjustable base, a high-precision CCD, a diaphragm, an imaging lens and a bracket thereof, a level gauge and a computer system. The level gauge and the adjustable base are matched, so that the plane where the high-precision CCD is positioned is in the horizontal or vertical direction as possible. The imaging lens and the bracket thereof image a ball head of a measuring rod of the Heidenhain length gauge on the CCD; the diaphragm is used for limiting the imaging range; and the computer system is connected with the high-precision CCD and used for acquiring and analyzing images. One-time measurement needs to acquire two images. One image is acquired when the ball head of the measuring rod of the Heidenhain length gauge is positioned at the zero position and the other image is acquired when the ball head of the measuring rod of the Heidenhain length gauge is positioned at a non-zero position. By analyzing the variation of the ball head positions of the two images and utilizing the variation of the actual positions of the ball head, the mounting angle of the Heidenhain length gauge can be obtained according to the triangle principle. The device and the method can precisely measure the mounting angle of the length gauge and improve the reliability of the measured data of the Heidenhain length gauge, and have the advantages of simple structure and low cost.