# Fuzzy Logic with Deep Learning for Detection of Skin Cancer
## 3 Proposed Method
### Segmentation  
Segmentation involves identifying the boundary of a lesion from the pre-processed dermoscopic image. This step aims to digitally dissect the affected area from the surrounding regular skin with a high level of correlation and focus on the region-of-interest (RoI). There are seven categories of segmentation methods, which include thresholding, clustering, active contours, quantization, pattern clustering, merging threshold, and fuzzy methods. However, literature suggests that conventional segmentation methods such as region enhancing, thresholding, and clustering face challenges when processing complex lesion images due to their computational and time complexity, leading to algorithmic failures. To address this limitation, many researchers have turned to segmentation methods based on deconvolutional networks, fuzzy methods, saliency, and k-mean algorithms [27; 28], [PERSON] et al. have employed GAN based method for segmentation of CT scan image for classification COVID-19 [29]. [PERSON] et al. have integrated feature pyramid with U-Net++ model for automatic segmentation of coronary arteries invasive coronary angiography [30]. The proposed method described here adopts a segmentation approach that involves two iterations. To reduce the computational burden, a sub-matrix window of size 5 \(\times\) 5 is utilized for processing. **Phase-1**  
Step 1: The input image can be expressed as a matrix of size (I \(\times\) J), where the location of each pixel can be identified as:  
\[(i,j)\in\mathrm{I}\equiv\{(1,2,3,\ldots,\mathrm{I})\times(1,2,3,\ldots,\mathrm{ J})\}\]  
Step 2: The process is executed on the R, G and B planes and the instance of the red plane r\({}_{ij}\) be the intensity value of the pixel location(i,j). Concurrently a (I \(\times\) J) binary flag image is created taking all of the values of the pixels f\({}_{r}\)(i,j) = 0. Step 3: A 5 \(\times\) 5 window will be created taking center pixel taking (i,j) where i = \((3,\,4,\ldots,\mathrm{I}-2)\)& \(j=(3,\,4,\ldots,\mathrm{I}-2)\)  
Step 4: For a specific window having center (k,l) the pixel values are r\({}_{k-2,\mathrm{I}-2}\), \(\ldots\); r\({}_{k,\mathrm{I}}\); \(\ldots\) r\({}_{k+2,\mathrm{I}+2}\);  
Step 5: If (I \({}_{\mathrm{r}_{k-2,\mathrm{I}-2}}-\) \(-\) r\({}_{k\mathrm{I}}\)\({}^{1}\)\(\geq\) T) where T = \(\sigma\) then f\({}_{r(k-2,\mathrm{I}-2)}\) = 1 else f\({}_{r(k-2,\mathrm{I}-2)}\) = 0, where, selected region's standard deviation is represented as \(\sigma\). Step 6: Thereafter, If (I \({}_{\mathrm{r}_{k+2,\mathrm{I}+2}}-\) r\({}_{k\mathrm{I}}\)\({}^{1}\)\(\geq\) T) then f\({}_{r(k+2,\mathrm{I}+2)}\) = 1 else f\({}_{r(k+2,\mathrm{I}+2)}\) = 0  
Step 7: By following this procedure, updated binary flag images will be generated from the Green (f\({}_{\mathrm{g}}\)) and Blue (f\({}_{\mathrm{b}}\)) planes. These flag images will be used to create the final binary flag image (f\({}_{\mathrm{f}}\)) using the following operation. Step 8: If the condition (f\({}_{r}\)(a,b) && f\({}_{g}\)(a,b) && f\({}_{b}\)(a,b)) == 1) is satisfied, then f\({}_{\mathrm{f}}\)(a,b) will be set to 1, indicating the presence of the segmented region in the pre-processed image. The border line of the segmented region can be identified by performing the following operation: If f\({}_{\mathrm{f}}\)(a,b) = 0, mark the region; otherwise, continue the process. Here, a = (1, 2,..., I) and b = (1, 2,..., J). Figure 3: Illustrates the pre-processing of a skin lesion, showcasing the following stages: (**a**) the original dermoscopic image (arrows shows hairs on skin lesion), (**b**) the removal of hair using the Dull Razor algorithm (arrows reflect to same points where hairs are removed digitally), and (**c**) the image enhancement achieved through histogram equalization (the contrast of the lesion is increased and the outer skin is brightened in this enhanced image such that a visual distinction between skin and malignant lesion can be drawn). Figure 4 illustrates the visual depiction of the initial stage of segmentation for an example image.