SharpRazor: Automatic removal of hair and ruler marks from dermoscopy images
Related Experiment Video
Updated: Aug 1, 2025

Dermoscopy Aids in the Diagnosis of Discoid Lupus Erythematosus
Published on: May 16, 2025
Reda Kasmi1, Jason Hagerty2, Reagan Young3
1Faculty of Technology, Laboratoire de Technologie Industrielle et de l'Information (LTII), University of Bejaia, Bejaia, Algeria.
Background:
The removal of hair and ruler marks is critical in handcrafted image analysis of dermoscopic skin lesions. No other dermoscopic artifacts cause more problems in segmentation and structure detection.
Purpose:
The aim of the work is to detect both white and black hair, artifacts and finally inpaint correctly the image.
Method:
We introduce a new algorithm: SharpRazor, to detect hair and ruler marks and remove them from the image. Our multiple-filter approach detects hairs of varying widths within varying backgrounds, while avoiding detection of vessels and bubbles. The proposed algorithm utilizes grayscale plane modification, hair enhancement, segmentation using tri-directional gradients, and multiple filters for hair of varying widths. We develop an alternate entropy-based processing adaptive thresholding method. White or light-colored hair, and ruler marks are detected separately and added to the final hair mask. A classifier removes noise objects. Finally, a new technique of inpainting is presented, and this is utilized to remove the detected object from the lesion image.
Results:
The proposed algorithm is tested on two datasets, and compares with seven existing methods measuring accuracy, precision, recall, dice, and Jaccard scores. SharpRazor is shown to outperform existing methods.
Conclusion:
The Shaprazor techniques show the promise to reach the purpose of removing and inpaint both dark and white hair in a wide variety of lesions.

