├── ISIC_0031023.jpg
├── screenshots
├── screenshot_0.png
├── screenshot_1.png
├── screenshot_2.png
├── screenshot_3.png
├── screenshot_4.png
├── screenshot_5.png
└── screenshot_6.png
├── dullrazor.py
└── README.md
/ISIC_0031023.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BlueDokk/Dullrazor-algorithm/HEAD/ISIC_0031023.jpg
--------------------------------------------------------------------------------
/screenshots/screenshot_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BlueDokk/Dullrazor-algorithm/HEAD/screenshots/screenshot_0.png
--------------------------------------------------------------------------------
/screenshots/screenshot_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BlueDokk/Dullrazor-algorithm/HEAD/screenshots/screenshot_1.png
--------------------------------------------------------------------------------
/screenshots/screenshot_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BlueDokk/Dullrazor-algorithm/HEAD/screenshots/screenshot_2.png
--------------------------------------------------------------------------------
/screenshots/screenshot_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BlueDokk/Dullrazor-algorithm/HEAD/screenshots/screenshot_3.png
--------------------------------------------------------------------------------
/screenshots/screenshot_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BlueDokk/Dullrazor-algorithm/HEAD/screenshots/screenshot_4.png
--------------------------------------------------------------------------------
/screenshots/screenshot_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BlueDokk/Dullrazor-algorithm/HEAD/screenshots/screenshot_5.png
--------------------------------------------------------------------------------
/screenshots/screenshot_6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BlueDokk/Dullrazor-algorithm/HEAD/screenshots/screenshot_6.png
--------------------------------------------------------------------------------
/dullrazor.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | """
3 | Created on Tue Feb 18 11:42:26 2020
4 |
5 | @author: Javier Velasquez P.
6 | """
7 | import cv2
8 |
9 | #IMAGE ACQUISITION
10 |
11 | #Input image
12 | path='ISIC_0031023.jpg'
13 | #Read image
14 | image=cv2.imread(path,cv2.IMREAD_COLOR)
15 | #Image cropping
16 | img=image[30:410,30:560]
17 |
18 | #DULL RAZOR (REMOVE HAIR)
19 |
20 | #Gray scale
21 | grayScale = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY )
22 | #Black hat filter
23 | kernel = cv2.getStructuringElement(1,(9,9))
24 | blackhat = cv2.morphologyEx(grayScale, cv2.MORPH_BLACKHAT, kernel)
25 | #Gaussian filter
26 | bhg= cv2.GaussianBlur(blackhat,(3,3),cv2.BORDER_DEFAULT)
27 | #Binary thresholding (MASK)
28 | ret,mask = cv2.threshold(bhg,10,255,cv2.THRESH_BINARY)
29 | #Replace pixels of the mask
30 | dst = cv2.inpaint(img,mask,6,cv2.INPAINT_TELEA)
31 |
32 | #Display images
33 | cv2.imshow("Original image",image)
34 | cv2.imshow("Cropped image",img)
35 | cv2.imshow("Gray Scale image",grayScale)
36 | cv2.imshow("Blackhat",blackhat)
37 | cv2.imshow("Binary mask",mask)
38 | cv2.imshow("Clean image",dst)
39 |
40 | cv2.waitKey()
41 | cv2.destroyAllWindows()
42 |
43 |
44 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Dullrazor algorithm 💻🧬
2 |
3 | 
4 |
Programming language: Python
9 | Version language: Python 3.8.8
10 | Libraries: OpenCV 4.5.1
11 |
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.
15 | 16 |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:
17 | 18 |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.
26 |Input image from HAM10000 database.
31 | 32 | ### Input image 33 |





Developed by engineer Javier Velasquez (2020)
51 | --------------------------------------------------------------------------------