It is surface imperfections on optical elements that have significant effects on the propagation quality of light in the high power laser systems, and even cause laser damage on the optical elements. Thus, quantitative detection of surface imperfections is very important for optical elements quality evaluation. The microscopy imaging method has been widely applied to detect surface imperfections. In the process of acquiring image, image background brightness could be non-uniform owing to uneven light intensity of illumination. Thus, some extracted information of surface defects will be lost. To solve the problem, a background correction method based on mathematical morphological is proposed. Luminance means, luminance uniformity, standard deviations and image detail as four factors are used to evaluate imperfection image. The background correction method combined with the improved Otsu method is used to extract the target of surface defects, which has better performance than the basic Otsu method. Through the research of the sensitivity of the algorithm for image noise and segmentation accuracy, it can offer theoretical directions for quantitative detection of surface imperfections.