1 Introduction

Cancer is one of the world’s deadliest diseases, claiming the lives of countless people. A genetic variant causes cancer, which allows the cells to develop irregularly. Cancer can occur in numerous ways, including leukaemia, lung cancer, meningioma, melanoma, and several others [5]. The importance of skin elements in the human being is shown by the fact that even little changes in their functioning can have an impact on other body parts and organs [64]. Skin is exposed to the environment. As a result, skin infections and contamination are more common. Skin cancer caused by melanoma affects millions of people [24].

Skin cancer is caused by harmful ultraviolet radiations and the abnormal growth of skin cells called melanocytes [71]. Melanocytes produce colour pigments known as melanin in their specific cells known as melanosomes, which are then transferred to the adjoining epidermis through the use of the dendritic process [39]. During the growth period, melanocytes grow from the neural crest and move to different spots throughout the skin during the growth processes [70]. Skin cancer can be categorized into melanoma and non-melanoma skin cancer. As per the report of the American Cancer Society, the approximated increase in the prevalence of melanoma in 2018 is 91,270, with a death rate of 9320 [63]. According to WHO, every year, approximately 3 million non-melanoma and 130,000 malignant melanomas occur worldwide [7]. As per a new study on Asian skin cancer trends, fair-skinned people had a three-fold higher risk of skin cancer than those with darker skin [68]. Melanoma is categorised into 5 stages from stage 0 to Stage 4 as shown in Fig. 1 [27, 33].

  • Stage 0: This is the first stage of melanoma and specifies that the cancerous cells are present but only in the epidermis layer of the skin and have not grown to any other part of the body.

  • Stage 1: This stage indicates that cancer has reached outside the epidermis but not to any other part of the body, and it lies between 0.8 mm and 2.0 mm in thickness.

  • Stage 2: In this stage, the thickness of the melanoma is bigger than 2.0 mm but less than 4.0 mm, just like in stage 1. This also does not spread to any other part.

  • Stage 3: The cancer cells have started to grow in the dermic layer and have taken place into contiguity with the nerves at this point. The thickness of melanoma at this stage is greater than 4.0 mm.

  • Stage 4: This stage indicates that the melanoma has grown in other organs of the body. At this stage, it is arduous to treat melanoma [6].

Fig. 1
figure 1

Stages of skin cancer [33]

Early diagnosis of this disease can provide appropriate treatment for melanoma. In recent years, several diagnostic techniques have been designed to help with identifying skin cancer outside of clinical examination [26]. Tests and procedures to identify skin cancer include biopsy, imaging tests, adhesive patch biopsy, electrical impedance spectroscopy, multispectral imaging, ultrasonography, optical coherence tomography, reflectance confocal microscopy, photoacoustic imaging, Raman spectroscopy, other radiological techniques like computed tomography (CT), magnetic resonance imaging (MRI), and many others are among them [12, 30, 52]. Since skin lesions and healthy cells are so similar, visual examination during a physical screening of skin lesions might lead to an incorrect diagnosis [45]. During the past few years, dermoscopy has been used to assist doctors in improving the screening for melanoma skin lesions [48]. Dermoscopy is a non-invasive imaging technique that uses polarized light to create a high-resolution image of a skin lesion [36]. It removes the skin’s surface reflection, allowing you to examine the morphology’s underlying features. Even though the technique enhances diagnosis accuracy over the visual examination, dermatologists still find it difficult to screen through dermoscopy images attributed to the prevalence of artefacts and reflections in the images [11]. Since many cancer boundaries are undetectable or hazy, visual identification is challenging, time-consuming, subjective, and error-prone [69].

Computer-Aided Diagnosis (CAD) has become critical in removing all of these obstacles, assisting specialists in incorrectly interpreting images and reaching the correct diagnosis conclusion [59]. Over the last two decades, there has been a surge of interest in the automated evaluation of digitised images to assist doctors in distinguishing early melanoma from benign skin lesions [46]. Additionally, such systems abbreviate the duration it takes to identify a problem and improve the accuracy of the final results [54]. As a result, automated computerised diagnostic tools for skin lesions are critical in assisting and supporting dermatologists in making decisions [47]. It has been seen that melanoma early identification increases a patient’s chance of survival. In cases where it is not caught early, its death rate has also dramatically increased. If discovered and treated promptly, malignant melanoma is always curable. On the other hand, an illness with a late diagnosis is harder to treat and may even be fatal because it has the potential to advance and spread to other body areas.

1.1 Novelty of proposed system

  • Proposed a novel system for skin cancer classification and detection using image processing.

  • During pre-processing bottom hat filter is applied to tackle noise in terms of hairs, and DCT and Color space conversion are used for performing image enhancement

  • Background subtraction method is implemented along with mid point analysis to enhance the system performance during segmentation.

  • A novel differential analyser approach has been proposed in this paper to enhance the performance of the proposed system during feature extraction using slope-based mechanism for retaining as well as rejecting the features from skin cancer images.

This work focus on the development of a novel system for skin cancer classification and detection. The several disciplines included in this study—image pre-processing, segmentation, feature extraction and classification—all contribute significantly to the extraction of the skin lesion, its classification and detection. The rest of the paper is organized as under section 2 presents Dataset and Tools used, section 3 gives a brief review of the related work, section 4 gives the proposed model and phases of the proposed approach, and section 5 gives the evaluation of the proposed system and section 6 is the last section conclude the overall work.

2 Dataset and tools

The dataset used is SIM ISIC [20], a published dataset corresponding to skin cancer detection as shown in Fig. 2. The test results are also available with the dataset. This means a predefined training model can be applied to test the accuracy of the system. The images contained within the dataset have both affected and non-affected skin tissues. The coordinates of the affected skin were also specified within different files. Simulation is conducted within Math works Mat lab 2018b. To design our proposed system, we used the visualization tools provided within the Mat lab. Visualization tools help in building an interactive interface that is quite easy to use.

Fig. 2
figure 2

Sample dataset [47]

3 Related work

In recent years, different skin cancer (melanoma) detection techniques have been developed by segmenting and extracting multiple dermoscopic features. Melanoma detection in dermoscopic images typically involves four stages. The first stage is preprocessing, which removes all artefacts, hair, and other noisy effects from the image. For this purpose, various filters can be used. The second stage is segmentation, which divides the input image into lesion regions and normal skin. In other words, this stage determines the correct boundary in the given image. The extraction of features is the third stage. It gathers the various characteristics or features of the lesion, such as shape, colour, texture, and so on. Classification is the last stage. The classifier had to select whether the given lesion is benign or malignant at this point. In the upcoming section, a brief review of the related study is presented year-wise.

Lee et al., 1997 [41] Dull Razor hair removal is proposed as a new technique that employs a bilinear interpolation method to eliminate hair pixels. This technique comprises three basic steps: (1) morphological closing operation to locate the location of dark hairs; (2) bilinear interpolation to replace hair pixels; and (3) an adaptive median filter to smooth the final output. Celebi et al., 2009 [17] have demonstrated a method for dermoscopy image enhancement. The approach finds the ideal weights to translate existing Color images to the analogous grey-level image by maximising Otsu’s histogram bimodality measure. Zhou et al., 2011 [1] have developed a new mean shift-based gradient vector flow (GVF) technique for directing inner and outer dynamism in the right direction. The calculation of force vectors in the imaging domain is the starting point for the energy force. The mean shift of the pixels in the region constrains the deformation of the region enclosed by the evolving border. To accomplish the segmentation process in images, they integrated a mean-field term within the standard GVF objective function. Barata et al., 2012 [21] have developed a new method for extracting melanin regions from dermoscopy images that requires a series of steps. The dermoscopy image is first subjected to a preprocessing technique. A set of directed filters and linked component analysis (CCA) are then used to identify the pigmented network “lines”. Finally, attributes from the discovered region are retrieved and applied to train an AdaBoost algorithm to identify each lesion in terms of the melanin region’s presence. Abbas et al., 2013 [2] have demonstrated a hair removal technique that identifies and removes hair in the CIE L*u*v* colour space using morphological operations and thresholding. On these fine systems that are based on their illuminance, a hair mask was constructed using a defined thresholding method. Finally, a morphological operation replaced each masked pixel with an average of its non-masked neighbours.

Aswin et al., 2014) [56] have presented a novel approach for detecting melanoma based on a genetic algorithm (GA) and ANN methods. The dull-Rozar technique is used for removing hair from the images, and regions of interest (ROI) have been obtained using the Otsu thresholding technique. In addition, the GLCM method was used to retrieve distinctive features from segmentation results. Following that, a hybrid ANN and GA classification algorithm was used to classify lesion images into malignant and benign classes. Lee and Chen, 2014 [44] have described a technique for finding an ideal threshold value and correctly delineating malignant boundaries from skin scans based on the fuzzy c-mean approach (FCM) and a type-2 fuzzy set algorithm. Throughout the preprocessing stage, they also used the 3D colour constancy method to reduce shadows and the impacts of skin tone changes in images.

Giotis et al., 2015 [16] proposed MED-NODE, a unique expert system for computer-assisted cancer detection. Their objective is to use simple digital photographs of tumours and three types of features to distinguish melanoma from nevocellular naive. Collected descriptors about the texture and colour of tumours are combined with a set of subjective observations about additional visual aspects of the lesions to determine if a tumour is cancerous or non-cancerous. Abuzalegah et al., 2015 [49] proposed a system to recognize and eliminate the hairs from the lesion. To remove the hairs, the authors created directional filters by deducting the Gaussian filter from the isotropic filter. The hair gap is then filled with the mean of edge pixels, which is consequently saved as a pixel value at the gap’s location. Dhane et al., 2015 [75] performed a comparative analysis of five different filters to remove the impulse/random noise using mathematical morphological procedures. The goal of this paper is to choose the ideal filter for the pre-processing of digital wound images taken with a camera 75 randomly chosen wound photos from the generated image collection and the online chronic wound image database were subjected to these five filters.

Premaladha et al., 2016 [10] has developed a new segmentation method called Normalized Otsu’s Segmentation (NOS), which regulates the issue of constant luminance to separate the damaged skin tissues from the normal tissues. In the same year, Premaladha et al. [10] implemented the Contrast Limited Adaptive Histogram Equalization (CLAHE) approach and a median filter to enhance the image contrast. Dhane et al., 2016 [72] proposed a novel technique for scar detection by using digital photographs acquired with a portable optical camera. The method for clustering that is suggested uses a spectral approach and is based on an affinity matrix. The spectral clustering (SC) process entails creating a Laplacian similarity matrix based on the Ng-Jorden-Weiss method. Premaladha et al., 2016) [10] have developed classification techniques, such as Deep Learning-based Neural Networks and Hybrid Ad Boost-Support Vector Machine (SVM) algorithms, are fed with fifteen features developed and extricated from the ROI of images.

In the 2017 year, a simple weighted Otsu thresholding method based on the Otsu threshold was proposed by Zortea et al., [25]. The first threshold is intended by considering all of the testers in the image as well as cross-diagonal testers weighted by an independent estimate derived from skin pixels in the peripheral region. The method is straightforward and effective for lesions obscured by coarse hairs. Xie et al., 2017 [22] have proposed a self-generating neural net to separate skin lesions. Coloured edges and texture-based features from the lesion are extracted. The proposed work divides skin cancer into two categories: cancerous and non-cancerous.

Xie et al., 2017 [22] introduced a skin lesion classification system that divided lesions into noncancerous and cancerous groups. The proposed paradigm is divided into three stages. Initially, a self-generating NN was employed to recover diseases from images. The data on boundary, appearance and colour details were retrieved in the second phase. The dimensionality of the features was reduced using principal component analysis (PCA), permitting the optimal amount of characteristics to be determined. In the last step, lesions were classified using a NN ensemble approach. In the same year, Satheesa et al. [76] presented a non-invasive computerized dermoscopy system for diagnosing skin lesions that take into account the predicted depth of lesions. It is proposed to use 2D dermoscopic pictures to rebuild a 3D skin lesion. The adaptive snake technique is applied to obtain ROI from the data. The calculated depth map is fitted to the existing 2D surface to produce the 3D reconstruction. The depth and 3D form features are extracted based on the generated 3D tensor structure. Feature selection is used to inspect the impact of quality and combinations of features on decision-making. Choudhary and Biday, 2017 [40] has suggested an ANN-based skin cancer diagnosis model which employs a maximum entropy thresholding approach to segment images. To retrieve distinctive properties of melanomas, a grey-level co-occurrence matrix (GLCM) was used. The input images were categorised into either malignant or benign stages of melanoma by employing a feed-forward ANN.

To determine the optimum technique for chromatic aberration, RGB pictures of skin ulcers were analysed in a comparative analysis of colour constancy approaches and found that the weighted grey edge method is best (Maity et al. 2018) [8]. A unique segmentation approach based on full-resolution convolutional networks (FrCN) was presented by Al-Masni et al., 2018 [5]. The recommended FrCN technique captures full-resolution features from each pixel in the input data without any intermediate steps, eliminating the need for pre-or post-processing processes such as artefact removal, illumination, or additional strengthening of the segmented skin lesion boundaries.

A system for melanoma and non-melanoma classification was proposed by Savy Gulati et al., 2019 [61] in which preprocessing measures are first carried out to clarify and improve dermoscopic images by eliminating unwanted artefacts. Then, using active contour-based segmentation, the primary area of interest is constructed. Moreover, colour, structure, and texture are retrieved and fed into the classification model (SVM) for efficient and precise malignant and non-malignant tumour categorization. Carrera and Dominguez, 2019 [43] have implemented a histogram equalization approach to enhance image contrast, and a dilation approach is applied to eliminate hairs or skin defects.

In 2020 year, Monika et al. [18] implemented a dull razor approach proposed by [41] to eliminate all unnecessary hair elements from the affected skin, and then the image is smoothed with a Gaussian filter. The median filter is applied for DE noise and to preserve the borders of the lesion. For skin lesion classification, a framework for extracting deep features from various well-developed and pre-trained deep CNNs was proposed by Mahbod et al., 2020 [28]. Deep features were generated using pre-trained Alex Net, ResNet-18, and VGG16, which were then input into a multi-class SVM Classification model. The results of the classifiers were then merged to classify the data. On the ISIC 2017 database, the proposed model was validated. Monika et al., 2020 [18] used Colour-based k-means clustering in the segmentation phase since colour is a significant characteristic in determining the kind of malignancy. Asymmetry, border, colour, diameter (ABCD), and grey level co-occurrence matrix (GLCM) are used to extract statistical and textural features.

Murugan et al., 2021 [51] have proposed work that uses an image processing approach for the classification and detection of skin melanoma. In the preprocessing phase, the median filter is applied to the region of interest (ROI), and the mean shift method is used to separate the ROI. To extract the features from ROI Moment Invariant features like Gray Level Run Length Matrix and Gray Level Co-occurrence Matrix were used. Classifying the malignant and non-malignant cells is achieved by using support vector machines, probabilistic neural networks, and random forests.

A comparative study of various techniques for skin cancer classification and detection on the different dataset are presented in Table 1. Satheesa et al. [76] used three different datasets ISIC, PH2 and ATLAS and applied an adaptive snake technique for segmentation, 3D reconstruction of dermoscopic images for feature extraction and SVM, AdaBoost and BOF for classification. Codella et al. [19] implemented FCN for segmentation and CNN, U-NET and DRN for classification on the ISIC dataset and achieved an accuracy of 76%. Zortea et al. [25] has used Microscopic images and applied SWOT for segmentation. Smaoui and Derbel [66] have applied Multi-threshold Otsu for segmentation, ABCD rule for feature extraction and TVD rule for classification on the PH2 dataset and achieved an accuracy of 90%. Carrera and Dominguez [43] have achieved an accuracy of 75% by applying the Optimal threshold for segmentation and SVM, and DT for classification on the ISIC dataset. Al-Masni et al. [5] have applied FCRN on the ISIC and PH2 data set for the segmentation of cancer images with 95% accuracy. Murugan et al. [50] has achieved an accuracy of 85% by applying the Watershed approach for segmentation, the ABCD rule for feature extraction and SVM, KNN, and RF for classification on the ISIC dataset. Thaajwer and Ishanka [3] have used the ISIC dataset and achieved an accuracy of 85% by implementing the Otsu segmentation and Watershed method for segmentation and NN, SVM, and CNN for classification. Khan et al. [38] have proposed an Improved K-means clustering for segmentation and SVM for classification on the DERMIS dataset and achieved an accuracy of 96%. Kassem et al. [35] have applied Google net for feature extraction and Multiclass SVM for classification on the ISIC dataset with an accuracy of 81%. Albert [4] has applied CNN and SVM on the Med Node dataset and achieved an accuracy of 91%. Hohn et al. [32] achieve an accuracy of 92% by applying deep learning CNN. Jiang et al. [34] applied DRA-Net on the Histopathological Image set and achieved an accuracy of 86%. Murgan et al. [51] have used the mean shift method for segmentation and SVM, probabilistic NN, and random forests for classification and achieved an accuracy of 89%.

Table 1 Comparative study of related work

In preprocessing, various challenges are observed in the literature. (i) The original datasets contain images with high resolution, which impose a high cost of calculation. As a result, images must be scaled because direct scaling can cause structural deformation in lesions. (ii) In cases where the lesion and skin tone are very similar, the images may have low contrast. It’s perplexing to identify the dissimilarity between an ordinary and a malicious mole in these instances. (iii) Another issue is the existence of noise in the images, such as hair and noise, which might make it difficult to analyse the imaged skin lesions properly. In segmentation, images exhibiting higher inconsistencies at the lesion centre compared to the boundary inconsistencies yields poor segmentation results. Furthermore, in some situations, a higher threshold value set for segmentation causes a regression area at the image centre, resulting in the false detection of lesions. Many features that aren’t required for classification complicate the classifier and increase computational time, lowering classification accuracy. The best aspects of the skin cancer photographs should depict the region’s characteristics. As a result, the finest method to identify lesion features is required. Therefore, a novel system is required to develop which can handle these all challenges and achieve better performance than the state-of-the-art methods. In the next section, the proposed system methodology will be discussed.

4 Proposed model

The proposed model for skin cancer classification and detection consists of five different phases. Each phase of the proposed model is explained in this section and the overall architecture is shown in Fig. 3.

Fig. 3
figure 3

Different phases of proposed model for skin cancer classification and detection

4.1 Image preprocessing

The image preprocessing in the proposed work is accomplished by applying an ensemble-based approach. This pre-processing phase consists of consists removing hairy parts, enhancing, and restoring the image. This is perhaps the most crucial to achieving high classification accuracy. A two-fold approach is used in the pre-processing. In the first part, long thin objects in the form of hairs will be identified and neighbourhood pixel colour and intensities will be replaced with the current pixel. This overall operation will be under the bottom hat filtering mechanism.

The overall operation of hair removal consists of reading the image and converting the RGB image into a grayscale. RGB images contain a lot of information about colour which we do not need during this operation. After conversion, the result is stored within [x,y]. The image will be evaluated corresponding to the region boundaries obtained with the cross-shaped structured element. P_size variable determines the maximum size of the allowed object. In case the maximum size (P_Size) is exceeded the threshold values, these values will be replaced with the neighbourhood intensity levels denoted with Object−1(x,y) by using algorithm 1.

Algorithm 1
figure a

Bottom_Hat(Image)

In the next part, image enhancement takes place. Image enhancement highlights the useful information present within the image and reduces the redundant information within the image as well. The proposed model used individual colour-checking and stretching mechanisms to introduce uniformity at each point within the image. To overcome the non-uniformity illuminations contrast enhancement strategy with discrete cosine transformation (DCT) [13] is applied to achieve the same. The overall operation of enhancement with DCT and contrast enhancement is given as under Fig. 4

  • Convert RGB image to HSV.

  • Apply DCT

  • Apply correction factor

  • H=CF*H

  • S=CF*S

  • V=CF*V

  • Apply inverse DCT

  • Convert HSV to RGB

Fig. 4
figure 4

a Original image b After hair removal

An RGB image will be converted to HSV colour space. The letters “R”, “G”, and “B” stands for red, green, and blue, which act as the primary colour. “H”, “S”, and “V” indicate a hue, saturation, and value. To apply DCT, the image is first portioned into orthogonal parts. This means the image is divided into 8 × 8 blocks. The standard work within DCT is from top to bottom and from inside to outside, scanning each block [14]. Overhead scanning of this sort requires overhead calculations, and boundary evaluation is an issue. In the proposed work, this scanning procedure is revered. Better boundary value identification is generated through this approach. The result generated from inside-outside scanning and the suggested approach are shown in Fig. 5.

Fig. 5
figure 5

a Original image b After inside-outside operation c With the proposed approach

After finding the boundary value the next step is image compression. For this, a quantization procedure will be applied to compress the blocks. During compression, frequencies that are less important are discarded. The correction coefficient for this purpose is required to be evaluated. This is given through the following equation

$$ CF=\max \left(\frac{\sum LL\underset{i}{\to }}{\sum L{L}_i}\right) $$
(1)

Here “CF” is the correction factor. \( LL\underset{i}{\to } \)is the similarity-valued matrix of the adaptive histogram equivalent image and LLi is the singular valued matric of the input image [57]. The correction factor (CF) will be multiplied by the colour channel. It is observed that the scale factor of “CF” gives better clarity and hence CF is used as the scale factor in contrast enhancement. The result corresponding to image enhancement is shown in Fig. 6.

Fig. 6
figure 6

a Original image, b After enhancement

4.2 Segmentation

Region separation is critical as it will be used for the analysis of individual regions for abnormalities. The novelty in the region separation phase is in terms of the direction of processing. Normally, processing in the region separation phase is performed through an inside-outside test classifying the edge within the image. The issues are discussed in [23] but in the proposed work this process is reversed. Contemporary region separation-based mechanism boundary identification is an issue. Thus, cancerous region extraction may not be appropriate. The extracted regions with the proposed approach are given in Fig. 7. The advantage of reversing the direction includes the minimum time in the identification of the region of interest in the proceeding pass in the segmentation. Starting the process from inside and moving towards the outside cannot be terminated until the boundary is encountered, but using the proposed approach, control will move from the boundary of the region and move inwards, towards the nucleus, establishing threshold points where variation in intensity levels occurs. If no deviation is detected while scanning 50% of the region, the entire region will be labelled as non-critical.

Fig. 7
figure 7

a Pre-processed image b after background subtraction c After the initial midpoint analysis d after final segmentation

Region separation phases initially identify the boundary (B) through the colour intensity (clr) levels. To identify the region (R), colour plays a vital role. The colour is identified using Eq. 2.

$$ {B}_{x_i,{y}_i}=\left\{\begin{array}{c} cl{r}_i!= cl{r}_i+1\kern1.75em R\_B\\ {}0\kern6.25em othrwise\end{array}\right. $$
(2)

The colour comparison with the neighbouring pixel identifies the region boundary (RB) and is stored within the Bx,y variable where B is the boundary. Since there are multiple regions, multiple boundaries corresponding to different regions will be detected. Therefore, we need the subscripted variable ‘I’ with the boundary variable.

The diameter of the region is estimated to obtain the dimension of the region. The dimension of the region will be divided by “2” to obtain the radius, and this will give the nucleus (Ni) of the region is determined using Eq. 3

$$ {N}_i=\left\{\begin{array}{c}\left(\mathit{\max}\left({B}_{x_i,{y}_i}\right)-\mathit{\min}\left({B}_{x_i,{y}_i}\right)\right)/2>0\\ {}\le 0\kern1.75em RB\ extraction\ not\ possible\ \end{array}\right. $$
(3)

The region’s boundaries will give the Centre of the region. The normal flow of the system will now be from the \( \max \left({B}_{x_i,{y}_i}\right)\ \mathrm{nucleus}. \)

The region extraction phase is critical in the process of proposed segmentation. The process first identifies the critically labelled segments. The region corresponding to the critical part has boundary values. A set of intensity (Int) values will be stored within a buffer (Bfi) corresponding to these boundary values. These intensity values corresponding to the region will be used in the background elimination and to extract the region of interest. The nucleus intensity values greater than 0 will be stored within the buffer for further processing and values less than or equal to 0 will be discarded. The primary equations used for the same region extraction are based on the valid nucleus determination given within Eq. 4.

$$ {Bf}_i=\left\{\begin{array}{c} Int\left(N>0\right),\kern4em Valid\ nucleaus\ values\ will\ be\ stored\ within\ buffer\\ {} Discard\ Int\left(N\le 0\right)\kern7.75em invalid\ intensities\ will\ be\ rejected\ \end{array}\right. $$
(4)

The result in terms of region separation and extraction is more accurate through improved inside-outside test and region extraction mechanism shown in Fig. 8.

Fig. 8
figure 8

a Original Skin Image b After initial segmentation c After overlapped object elimination

Using the proposed approach region overlapping issue is resolved. The properties extracted, and their information extracted are as under in Table 2.

Table 2 Region separation and extraction result

For the skin lesion segmentation, the object is represented individually by the centroid, major and minor axes. Figure 9 shows the outcome of this phase.

Fig. 9
figure 9

a Input image b First object extraction c Second object extraction

A background subtraction mechanism is used to remove the background (Bgi) colour and the foreground image is retained. The background colour with the skin image has a maximum of 255 intensity levels. The region extracted from the region separation and the intensities extracted from the region separation are used in the background subtraction process. This is expressed in Eq. 5.

$$ Witho\mathrm{u}{t}_{Bg_i}=\left\lfloor 255- Int\left(B{f}_i\right)\right. $$
(5)

This intensity will be subtracted from the rest of the image to obtain the image without a background. After subtracting the background, the region of interest is obtained. The highest correlated segments are obtained using a correlation-based mechanism. The most positively correlated segments will be retained, and the rest of the segments will be rejected. The relationship between the components is extracted using bwconncomp. The coordinates of the region having the highest correlation are obtained using Regionprops. The overall working of the proposed method is given below in algorithm 2.

figure b

Algorithm 2

4.3 Feature extraction and selection

The feature extraction from the image is the next phase in skin lesion detection. Feature extraction is accomplished with the help of the bag of feature approach. The novelty in this approach is introduced by first of all modelling the assignments of local descriptors. These are termed contributor functions. After this multiple assignment strategy is used for reconstructing local features using neighbouring visual words from the vocabulary. Reconstruction weights are calculated from quadratic programming. These weights will be used to form contributor functions. Features possessing the highest weight will be extracted and retained. Feature selection is accomplished by a novel differential analyser approach (DAA). Each feature is supposed to possess certain linearity. A differential approach used will try to fit the feature values over linear dimensions. Features not fitting the dimension will be rejected.

Color, shape, and texture features were discovered to be the most relevant for the detection of chronic melanoma images [60]. These features are mentioned below: Table 3 shows the different types of features and their counts that were retrieved from the image.

  • Shape Features: These represent an area, the length of the parameter’s major and minor axes, and some other features that differentiate the extracted lesion from other lesions.

  • Color Features: This is an important factor in distinguishing normal skin from abnormal skin lesions. As a result, the lesion can be distinguished using this feature.

  • Texture features: these are extracted from the image’s lesion only. Homogeneity, energy, colour, contrast, energy, entropy, variance, standard deviation, and so on are examples of these characteristics. Texture features are obtained at 0 and 90-degree angles.

  • Hybrid features: all of the features listed above are merged in this group.

Table 3 Feature type and count

To choose the relevant features, the differential analyzer approach (DAA) algorithm is used [37]. DAA is a meta-heuristic technique that works in the same way as genetic algorithms [58]. Each population unit can be either male or female. Every child is regarded as a potential solution to the problem. The male population is referred to as “X,” while the female population is referred to as “Y.” The number of repetitions required for integration is determined by calculating the Max and Min values from the extracted parameters, as shown in Eq. (6).

$$ {\displaystyle \begin{array}{c} dx={x}_{max}-{x}_{min}=\left\{\begin{array}{c}\max \left({X}_i\right), where\ {X}_i>0\\ {}\min \left({X}_i\right), where\ {X}_i>0\end{array}\right.\\ {}\kern0.5em dy={y}_{max}-{y}_{min}=\left\{\begin{array}{c}\max \left({Y}_i\right), where\ {Y}_i>0\\ {}\min \left({Y}_i\right), where\ {Y}_i>0\end{array}\right.\end{array}} $$
(6)

Where “I” is the size of the population, dx denotes the highest statistical variance between the maximum and minimum population of males, and dy represents the highest statistical variance between the maximum and minimum population of females. The total number of iterations allowed is calculated using Eq. (7).

$$ s=\left\{\begin{array}{c} dx,\kern0.5em if\ dx> dy\\ {} dy,\kern0.5em otherwise\ \end{array}\right. $$
(7)

The ‘S’ variable indicates the steps, the total number of repetitions after which the algorithm automatically terminates. To obtain offspring representing a possible solution, the crossover factor will be calculated from both the male and female populations. Equation (8) is used to compute the crossover factors represented by XC and YC.

$$ {\displaystyle \begin{array}{c}{X}_c=\frac{dx}{steps}\\ {}{Y}_c=\frac{dy}{steps}\end{array}} $$
(8)

The population’s selection for offspring is determined by XC and YC. Equation (9) is used to produce the next generation of offspring.

$$ {\displaystyle \begin{array}{c}{X}_n={X}_n+{X}_c\\ {}\ {Y}_n={Y}_n+{Y}_c\end{array}} $$
(9)

Xn and Yn are the next male and females selected to produce offspring. The fitness of these parameters is evaluated using a linear fitter equation, represented by Eq. (10) where “m” denotes the slope and “c” denotes the interceptor.

$$ f\left(x,y\right)=m\ast \left({X}_n,{Y}_n\right)+c $$
(10)

The objective function for retaining current offspring is in terms of error. This error rate is necessary to be less than the prescribed tolerance otherwise, the offspring is rejected. The error is evaluated using Eq. (11).

$$ erro{r}_{x,y}=\left\{\sum {f}_{m\mathrm{e} asured}\left({X}_n,{Y}_n\right)-{f}_{model}\left({X}_n,{Y}_n\right)\right. $$
(11)

If the produced offspring fulfils the optimization function, it is retained. Equation (12) represents the error rate required to be less than the prescribed tolerance.

$$ \varepsilon =\left\{\begin{array}{c} erro{r}_{x,y}, if\left( dx< pt\ and\ dy< pt\right)\\ {} NA,\kern0.5em Otherwise\end{array}\right. $$
(12)

ε’ is the specified tolerance, which must be less than 0.001. Otherwise, optimality is not attained, and the process is repeated.

The feature set extracted from the image equivalent to the specific region determines the optimal values that can be plotted linearly. For example, the range of values extracted from the region image has local maxima represented as dx = 10 and dy = 20. The minimum set of values obtained is given as (10,20) and the maximum value is given as (20,40). We calculate steps = dy = 20. The value of xincr will be 0.5, and the value of yincr will be 1. The range of values obtained through the DAA approach is listed in Table 4.

Table 4 The range of values obtained through the DAA approach

These values of X and Y are compared against the extracted values. Out of the range of values, values closely matched with the line coordinates are retained, and the rest of the values not satisfying the line coordinates are rejected. Optimal feature extraction will be achieved after the end of this algorithm.

This algorithm extracts shape, size, and texture features from region images. Following the extraction, each feature is subjected to some normalisation mechanisms. This process reduces the difference among feature values. For the evaluation process, the optimization function is used. The prescribed tolerance is predetermined, and the retrieved results will be compared to the prescribed tolerance to determine which offspring are the best. Each fittest offspring is labelled with a specific feature. The crossover factor is changed to the weight factor obtained in Eq. (8) to optimise the DAA. When compared to a standard genetic algorithm, the convergence rate of this approach is remarkable. The number of iterations varied between 10, 20, and 30, and reaches 100, which improved the DAA’s performance toward the best possible solution. The parameter setting for DAA is given in Table 5.

Table 5 Parameter settings for DAA

Since the amount of features extracted correlating to texture and shape is confined, the DAA algorithm is only implemented for colour and hybrid features. The texture and colour features before and after implementing DAA are specified in Table 6.

Table 6 Features before and after DAA

Each optimised feature can be classified as either male or female. The crossover factor determines which male and female will be used to produce offspring. This offspring is the best feature that is kept in the final feature matrix. Table 6 specifies that half of the features are rejected and half of the features are chosen using the DAA algorithm. Figure 10 represents the operation of DAA.

Fig. 10
figure 10

Mechanism of DAA Algorithm

4.4 Normalization

This phase is necessary to improve classification accuracy [65]. This phase closes the gap between the highest and lowest extracted feature values. To generate a feature matrix, three different normalisation mechanisms are used: depth-based, min-max, and grey-level scaling. Each of these strategies is used to ensure that the features extracted are satisfied in a linear fashion.

  • Depth-based Normalization: To compare two different feature sets, this step estimates the depth of sequencing.

  • Min-Max Normalization (MMN): This technique linearly adjusts the raw data to predetermined lower and upper bounds. Normally, the data is rescaled between 0 and 1 or − 1 and 1 [65].

  • Greyscale normalization: It can be performed by scaling the entire image to the range values from 0 to 1. It works by normalizing each column or row to a range of values from 0 to 1.

4.5 Classification

The proposed model represents the binary classification problem. In detection, there were only different possibilities: affected or not affected. Because the size and number of extracted features vary in the proposed system, different classification techniques are required for validation. KNN (K-nearest Neighbor) evaluates various neighbours using Euclidean distance [42], a support vector machine that uses several polynomial and linear functions [47], using a random forest method [50] for classifying malignant cells. a decision tree for developing classification rules over segmented skin image data [67]. The k-fold technique was used to assess the model’s performance. The entire dataset is divided into eightfold if the fold is taken to be 8. The primary detection process corresponds to affected and non-affected regions. The classification is accomplished with the help of KNN, SVM, Decision tree, naïve Bayes and random forest approach.

4.5.1 K- nearest neighbour

This is one of the popular classification techniques in which unknown instances are classified based on their similarity/distance with the records in the training set [42]. Either similarity or distance of a test record is computed with every record of the training set. Then, all the records are sorted according to the proximity function (similarity/distance) [9]. Afterwards, top-k records are chosen to be the k-nearest neighbours of the test record. If k-nearest neighbours (KNN) of a record contain instances of more than one class then the decision is made according to the majority vote [67].

4.5.2 Support vector machine

A support vector machine (SVM) is a non-probabilistic binary linear classifier used to analyse data for classification and regression analysis [73]. It belongs to the family of supervised learning models with associated learning algorithms. A model generated by an SVM training algorithm assigns new examples to one category of the two marked categories given a set of training examples [47].

4.5.3 Random Forest

As the name of this algorithm illustrates, a forest is a collection of trees. It comes under the umbrella of an ensemble classifier [15]. The training set is divided into several random subsamples spaces (sub-training sets). A decision tree is created for each training subset leading to several decision trees known as random forests. A test sample is assigned a class label by each decision tree. The final decision is made based on a majority vote of the decision trees [50].

4.5.4 Naïve Bayes classifier

A group of classification algorithms built on Bayes’ Theorem are known as naive Bayes classifiers [31]. It is not a single algorithm, but a group of algorithms that follow the same fundamental idea that each pair of features being classified is independent of the others [54].

4.5.5 Decision tree classifier

A decision tree (DT) is generated from a training dataset [51]. The leaf nodes represent the class labels while the intermediate nodes split the dataset into subsets. The division of the training set continues till all the records in the training set are covered by the decision tree [53].

The proposed approach used an ensemble-based approach in achieving the classification of test images. The best possible approach in terms of classification accuracy will be selected automatically through an ensemble-based approach. E.g. if used five classifiers give the result as (1,1,1,0,0), the overall result will be 1. As multiple classifiers predicted similar results, classification accuracy using an ensemble-based approach was high.

5 Experimental results and discussion

5.1 Evaluation of the proposed system

The proposed model first performs preprocessing in which hairy part removal is accomplished with the help of a lower hat filter. DCT and Color space conversion are used for performing image enhancement this enables the detection and separation of infected regions from the sample. The RGB cell image is transformed into greyscale for this purpose. Background subtraction is used to track only lesions from an image, and region props are used to segment skin images. The features are extracted from the segmentation results. Homogeneity, contrast, energy, correlation, and some hybrid features are among these. The differential analyzer approach (DAA) algorithm is used to select the relevant features in the third phase. In the final phase, various classifiers were used to certify the outcome of the proposed approach.

Different classification systems have advantages and disadvantages. It’s tough to say which classification approach is the best for a certain study. As shown in Tables 8, 9 and 10, different classification outcomes can be achieved contingent on the classifier(s) used in the dataset, the number of melanomas in the dataset, and the number of distinguishing characteristics. When choosing a classification technique to apply, various aspects must be considered, including diverse sources for collecting image datasets, accessibility of classification tools, cost factors, computational resources, and training data.

5.1.1 Metrics for performance evaluation

The suggested method is evaluated using three parameters: accuracy, sensitivity and specificity. They are discussed as follows.

Accuracy (Ac) refers to the overall performance of a system. Accuracy ensures that the results produced by the system are true and accurate to avoid misdiagnosis. It is calculated using Eq. (13).

$$ Ac=\frac{TP+ TN}{TP+ TN+ FP+ FN} $$
(13)

Sensitivity (Sn) denotes the capability of a system to recognize people who have the disease. It shows how good the system is in identifying the person with an actual disease, if the numerical data is high then the possibility of identifying the person with the disease also increases. It is calculated using Eq. (14).

$$ Sn=\frac{TP}{TP+ FN} $$
(14)

Specificity (Sp) denotes the capability of a system to recognize people who do not have the disease. It shows how good the system is in identifying an individual who does not have a disease, if the numerical data is high then the possibility of identifying healthy persons also increases. It is calculated using Eq. (15).

$$ Sp=\frac{TN}{TN+ FP} $$
(15)

TP means true positive rate (detection of abnormality in a person with disease), TN means true negative rate (in a healthy individual, no abnormalities are detected.), FP means false positive (identification of an anomaly in a healthy individual) and FN means false negativity (no abnormality detected in a person with disease).

5.1.2 Results of segmentation

Figure 11 depicts the experimental outcome of the segmentation phase. This is accomplished by implementing background subtraction with a midpoint and region prop mechanism.

Fig. 11
figure 11

Result of the segmentation phase

Figure 12 depicts the outcomes of the malignant and benign skin separation experiments. The Skin images and normal and abnormal separation mechanisms enclose the abnormal shape with boundaries. The grid structure is formed using boundary value analysis, and the outcome accurately separates lesions from normal skin.

Fig. 12
figure 12

Skin lesion separation results

The Jacobi index [55] is used to evaluate segmentation performance. The Jacobi index compares the true and estimated results. Jacobi index is given as under

$$ JI=\frac{TP}{TP+ FN+ FP} $$
(16)

The JI index ranges from 0 to 1. True positive values were set to 1 if both the estimation and the fact were 1. In the incident of an inappropriate prediction, the false-positive and negative values are determined to 1. The proposed method has TP = 25, FN = 1, TN = 1, and a segmentation accuracy of 92.0. In some cases, the accuracy is even greater than 100%.

5.1.3 Result of normalization

This phase seeks to increase the accuracy of classification by merging all of the feature sets (colour, texture, and location) into a feature vector. We chose characteristics that assist the classification framework the most, rather than utilising traditional feature selection approaches that select features based on their performance in the original input feature space. Three normalisation techniques are employed in the feature matrix, each of which ranges the feature values to fit in a linear fashion. As a result, three distinct normalised feature matrices were generated: grey scaling, min-max, and depth based. Following the specified operation, the three normalisation matrices are shown in Table 7.

Table 7 Colour feature matrix after normalization

5.1.4 Result of different classifier

Evaluation of classification accuracy with the selected feature by the DAA approach with different normalization. The proposed approach performs three different normalizations and the best, average, and worst possible classification accuracy is recorded. The simulation results with different normalization mechanisms are recorded in Table 8, Table 9 and Table 10. The proposed approach used an ensemble-based approach in achieving the classification of test images. The best possible approach in terms of classification accuracy will be selected automatically through an ensemble-based approach. E.g. if used five classifiers give the result as (1,1,1,0,0), the overall result will be 1. As multiple classifiers predicted similar results, classification accuracy using an ensemble-based approach was high.

Table 8 Classification accuracy of DAA with Grayscale normalization
Table 9 Classification accuracy of DAA with Min-Max normalization
Table 10 Classification accuracy of DAA with Depth based normalization

The performance of the SVM classifier is better than all other classifiers as shown in Table 8, 9 and 10. The performance of the SVM classifier in the case of greyscale normalization is better than the min-man and depth-based normalization. Therefore, this classification result of SVM (accuracy 96.21%) in the case of DAA will be used in the next section for comparison with the state of the art techniques. The limitation of our work is that we have used only one dataset ISIC with two cases (melanoma and benign) for classification and detection. Results may very based on dataset to be used.

5.2 Result comparison with the state of art methods

The performance of the proposed system is compared with the state of art methods on publically available dataset ISIC data as shown in Table 11. Authors in [3, 35, 43, 50, 51] uses the ISIC dataset and applied different techniques for preprocessing, segmentation, feature extraction and classification and achieved the highest accuracy of 89% which is less than the proposed system.

Table 11 Result comparison with the state of art methods

5.3 Comparison of results with SVM

To evaluate the performance of the SVM classifier on the ISIC dataset in the proposed system comparison with the different existing classifiers on the same dataset is shown in Table 12. Authors in [28, 55, 62, 74] use the same dataset and different classifiers for melanoma classification and achieved the highest accuracy of 96.00%. Our proposed system is reliable, resilient, and efficient which achieves an accuracy of 96.21% on the same dataset.

Table 12 A comparative analysis of different classifiers with SVM

Almost every existing paper lacked optimization in feature selection. The selection ratio in the proposed work was 50%. The reduction can be furthered in the feature selection mechanism to determine variation. As seen from the result section, exponential variation was observed. There are the following reasons for the improvement in the results:

  • In this method, some important features are extracted and employed. Each element influenced a different aspect of skin lesion because each type of skin lesion has a distinct colour. Differentiation can be recognised using colour features, Shape features and textural features.

  • A digital differential analyser algorithm is used since it has the least calculation complexity. The extracted features were scaled to fit onto a line. Due to optimised space exploration, DDA ensures a better selection of features and avoids local minima. This model selects optimised features by verifying these features against optimised functions.

The experimental findings of dermoscopy images of the proposed approach are compared to the factual data in terms of qualitative evaluation. In addition to the qualitative evaluation, a comparison of numerous other methodologies is conducted. According to the evaluation metric, the method produced the best outcomes. As a result, we believe that our effective and reliable method can assist dermatologists in making a more accurate and timely diagnosis. To validate the efficiency of the proposed model, a classification accuracy comparison is made in Tables 11 and 12 with existing models working on the same dataset.

6 Conclusions and future scope

This article focused on the early diagnosis of acute skin cancer. The main goal is to identify and classify each type of skin cancer into cancerous and non-cancerous categories. The publically available ISIC dataset has been used to train and test the proposed system. The implementation of the proposed system has been done in different phases. In the first phase, preprocessing is performed in which image resizing, hair removal, and image enhancement is done. Segmentation is the next phase that divides the image into critical and non-critical sections background subtraction, region props, and separation has been used. The skin lesion separation mechanism identifies abnormal images with black-coloured boundaries. In the next phase, features are extracted from the segmented image. After that, three distinct normalization mechanisms have been used for the normalization of the features, and the best result obtained corresponds to grey-scaling normalization. The DAA approach is applied for the optimized feature selection and is completed based on offspring and functional suitability. The offspring represents the best possible solution selected and will be restrained if specified tolerances are not met. The final stage is the classification that determines whether the image is affected or not. The proposed model achieved a classification accuracy of 96% overall, which is enough to prove the validity of the results.

The results of this study suggest that researchers focus on increasing the accuracy of a suitable classifier and reducing false negative classifications in the future. Then a system like this can be useful as a medical assistant to assist with the manual examination and save a lot of time. More data sets with different skin cancer imaging sources are needed for further study so that we can improve the recognition reliability using results from certain classes.