In this paper an accurate measurement method for optics system based on the lunar imaging is presented, and this method has the following steps. Firstly, the optical imaging system observes the lunar and acquires the image on the ground or in orbit, and records the position and the time simultaneously, with which the distance to the lunar can be computed. Secondly, the initial region of the lunar in the acquired image is decided by the gray value threshold, and the Canny edge detection method with parabola fitting is used to acquire the sub-pixel image edge points. Thirdly, the extracted edge points are used to preliminary fit the lunar disc, and the lunar ring is formed based on the fitted lunar disc expanded two pixels, then the initial coarse fitting disc is acquired according to the maximum number of edge points located in the lunar ring. Fourthly, the sub-pixel lunar disk can be obtained via the least squares fitting on the base of the initial coarse fitting disc. At last, the focal length of the optical imaging system can be computed with the position relationship between the optical imaging system and the lunar. Experiments show that this method has the ability to focal length measurement with high accuracy and frequency. By the means of imaging to the lunar, taking advantage of the long distance, sub-pixel edge detection and fitting for the lunar disc diameter, etc, whether in the full lunar and the waning lunar，the focal length could be measured accurately. It has a wide application prospects both in the developing and in orbit operating stage for optical imaging system.