In the field of dental image processing and analysis, automatic segmentation results of dental hard tissue can provide a useful reference for the clinical diagnosis and treatment process. However, the segmentation accuracy is greatly affected due to the limitation of imaging conditions in the oral environment, as well as the complexity of dental hard tissue topology. To further improve the precision of dental hard tissue segmentation, a novel algorithm was presented by using the sparse representation-based classifier and mathematical morphology operations. First, the captured dental image was preprocessed to eliminate the impact of imbalance local illumination. Then, the preliminary dental hard tissue areas were calculated as the initial marker regions based on color characteristics analysis, and the sparse representation-based classifier was applied sequentially to optimize the initial marker regions combined with certain morphological operations. Finally, a modified marker-controlled watershed transform was employed to segment dental hard tissue regions on the basis of the optimized marker regions, and the final results were obtained after homogeneous region merging. The experimental results show that our method has better adaptability and robustness than existing state-of-the-art methods. Graphical abstract.