While installation of the slit lamp drum, there are some problems such as uncertainty in the evaluation of the clarity of the drum image by the human eye. In order to solve these problems, a digital correction method based on the definition evaluation algorithm is proposed to improve the drum quality. By studying the current mainstream image sharpness evaluation algorithm, several algorithms that are in good agreement with the subjective evaluation are selected, and some appropriate preprocessing method are used to process the image. Finally, the program is written to test the drum image. Three sets of experiments are designed to simulate the focal length change of the camera, the change of drum magnification, and the influence of illumination variation on the algorithm on the production line. The calculation results are compared and analyzed from four aspects: unimodality, unbiasedness, sensitivity, and real-time. The results show that the selected algorithm can accurately evaluate the drum image under different magnifications and different illuminations, and can meet the real-time requirements of the production line.