In order to correct kinase inhibitors the effect of thick hairs, bottom hat morphological transformation is applied and objects which their length to width ratio is >10 have been removed. This operation has been implemented with the assumption that hairs have long and narrow structures, while lesion has elliptical structure. If the image has a lot of thick hairs, their remaining details on the border of lesion mask are corrected by applying morphological opening operator with circular structural element of size 3. Otherwise, this operator is not required to be applied. Following this,
morphological closing operator with the same element as opening operator is applied on the whole images which removes indentations on the boundary caused by reflection of light from lines and dents of skin surface. Finally, number of pixels of each object in the image is calculated and the
largest one is selected as the lesion mask. At the end, if flash light is used, the effect of large glows and reflections on image will be corrected because intensity level of large areas on the image or its sides are increases due to intense light of flash. So the flash light effect will be checked just on the lesion area, its effect on the lesion border will be corrected and its effect on normal skin is not matter in this study. For this purpose, image is converted to cyan, magenta, yellow, and key color space and Y (yellow) channel which can show areas of glows in the best way is selected. Then elliptical-shaped area which contains entire lesion and part of surrounding healthy
skin is determined as it is described in the following and the image is limited to it. For this purpose, the best-fit ellipse is defined, and length of its major and minor axes is increased to the size of largest Euclidean distance of border lesion and the defined ellipse, plus a constant value. One of the reasons of the image limiting is that lesion area in more cases is much smaller than healthy skin and by limiting image to an ellipse, accuracy of separation glows areas on lesion will has a significant improvement. In addition, the amount of processed data is also reduced which leads to an increased processing speed. Also, while defining AV-951 an ellipse by increasing the lengths of ellipse axes and adding a constant value to them, it is ensured that its border is located on the healthy skin because ellipse border indicates healthy skin. To determine glow area, k-means clustering algorithm is applied once on the limited channel Y and once more on the cluster with minimum center value, which is the output of the first run of the clustering algorithm. In each run of the algorithm, the number of clusters is selected equals to the number of smoothed histogram peaks of the input set, and five sequential iterations is performed.