The on-machine measurement system can effectively improve the machining efficiency and accuracy of the optics in the grinding stage, but the common grinding machine has large geometric errors and ambient temperature errors, which are the key factors restricting the accuracy of on-machine measurement. In this paper, a high-precision error separation technique including geometric error separation and temperature error separation is proposed to achieve sub-micron level measurement accuracy in the grinding stage. The on-machine measurement system is built based on the color confocal sensor. A sensitive error model is established based on Abbe's principle and multi-body dynamics, and the geometric error separation with zero Abbe's error is achieved by a high-precision reference mirror. Then the temperature error influence model is established based on the scanning path, and the temperature error separation method based on the auxiliary profile line is proposed according to the temperature error model. Finally, it is verified through experiments that after error separation, the measurement accuracy of the on-machine measurement system is improved from tens of micron to sub-micron, which exceeds the measurement accuracy of ordinary coordinate measurement machines (CMMs), and can effectively improve the machining accuracy and efficiency in the grinding stage.