Programming language: Python
Version language: Python 3.8.8
Libraries: OpenCV 4.5.1
Most images of skin lesions have unwanted elements, such as shadows and hairs, which can make it difficult to segment the lesion and introduce erroneous information on its characteristics. Therefore, it is necessary to apply some artificial vision techniques to eliminate any noise component.
Body hair is one of the factors that can affect lesion segmentation. For the detection and removal of hairs, a pre-processing technique called DullRazor is used, which consists of applying a series of morphological operations to the image in order to generate a mask that contains the hairs. The steps to apply the DullRazor algorithm are:
- Convert the original image to grayscale.
- Closing to the grayscale image, using a linear or cross-shaped kernel.
- Calculate the difference between the resulting image and the original.
- Apply binary thresholding to obtain a mask with the hairs in the image.
- Replace the pixels in common between the mask and the original image, with pixels from the latter.
For steps 2 and 3 of the DullRazor algorithm, the advanced morphological operation blackhat from the OpenCV library was used. On the other hand, the cv2.inpaint command from the same library was used in the last step of the algorithm.
Input image from HAM10000 database.
Developed by engineer Javier Velasquez (2020)