1 Introduction

To identify the variety of colors, present in the scene, color-based image segmentation became an essential step. Image segmentation is an essential stepping stone for extraction of key image features which helps in various pattern recognition and object detection activities. An issue arises in image segmentation involves the division of a given image in different regions in such a way, that each region remains homogenous but not the two adjacent ones. Color has been maintained as an intuitive feature, so that it is easier to utilize an effective representation through it. Thus, color similarity can be established by evaluating the homogeneity creation value. Each pixel is compared to its immediate neighboring regions. If the homogeneity creation fulfills, the tested pixel is made belonged to that particular region, followed by updating all the attributes of the region. The process continues until all the image pixels are merged in regions as homogenous as possible [16].

The needs of filtering and organizing the extensive growing image and video data are continuously evolving. With such a huge collection of data the text descriptions to images is enormously time consuming. It was studied that theories of object recognition usually blends towards the shape evidence and essentially disregarding the potentials of color evidence [17]. The Biederman’s RC model, hypothesized that the objects are represented as an elementary geometric blocks ‘geons’ [4]. The hypothesis that identification of an object depends on the definition of the object’s geons and their relations is made, which in turns provides an access to function, meaning and respective object name. Majorly, to notice that neither the geons nor their relations were associated with color information. Huge functional neuroimaging and neurophysiological body, experimentally provides with the evidences that advocates the effect of color statistics in the field of object recognition. Therefore, contribution of colors must be unified in object recognition models and it is very essential to detect the respective colored region from the image so that it can be effectively be used for object recognition [34].

Single color detection from the image has been covered in the literature. The deep study over the role of colors in identifying and retrieving the objects is covered in this paper. It has been studied that in single color detection, a proper allocation of the extracted color in every category of images has always been a major issue of concern. The identified limitations in the state-of-the-art are: 1) existing methods lacks in proper localization of the target colors; 2) fails in obtaining results in every category of the images; 3) does not acquire an accurate detection of colors in less computational time. Due to these limitations color as an effective feature for object detection has not been considered till date. Therefore, a need to develop an effective color detection approach became necessity. Thus, a contribution is made in the field by proposing an algorithm in this study which complies the following conditions: 1) The algorithm should have less execution time; 2) Outcomes should be accurate and should be able to detect the target colors (individual or multiple) in all sorts of images such as complex, blur, two dimensional and low quality; 3) The robust outcomes on both colored and grayscale images are targeted to be attained.

Section 2 discusses the prior work done in the present state of the art. Section 3 describes the respective problem formulation. Section 4 discusses the proposed algorithm. Section 5 represents the simulated outcomes. Lastly a conclusion together with imminent chore is discussed in Section 6.

2 Prior work

The work reported here, summarizes and extends the contribution of novel researches of the respective color segmentation field. As noted by Powell and Murphy in 1999, the use of color segmentation work in identifying road boundaries using color for vehicle navigation or evaluating distance from artificial landmarks. It was observed that the majority of efforts restrict the lightening conditions. They worked in HSI color space which leads to limitation in effective localization of real time mobile robot tracking processing. Thus, in 2000 Hyams et al. [15] used Spherical Coordinate Transform (SCT) color space in combination with nearest-neighbor segmentation scheme to localize vehicles but lacked in effective obstacle identification. It was later effectually solved by Parang et al. in [3] by adopting color stereo homographic concept which accurately results on both flat and rough same color areas. In 2002, Chen et al. [6] developed a color based image segmentation algorithm to deal with an issue of low resolution images. Threshold evaluation was made under considerations to overcome the respective limitation and same for noisy image in [22]. Color has always been an important attribute to facilities road signs and improving driving condition. Therefore, Mohammad was the first to step forward in development of vehicle with single system which had an ability to identify and localize the road signs [18]. Later in 2004, Yinguhua et al. [14] proposed an algorithm for effective dealing with shadow scenes and localization. By the year 2005, research tilted towards the effective and accurate color segmentation outcomes in all weather conditions using the concept of ROI and thresholds [7] but lacked in computational power, which was then overcame in [21, 33] by working on an HSI color model within ROI for target detection and then clustered using Fuzzy c-mean algorithm. The over-segmentation restriction was identified and resolved by Ming et al. [38] through k-mean clustering segmentation. By the year of 2007 the new seed region growing based color segmentation technique was introduced and implemented. From the experiments more effective results were observed in comparison to pixel based segmentation with high computational time [37]. To handle the above restriction Palus et al. [23] developed an algorithm which works without prior region knowledge and which later results in better outcomes and insensitivity towards the shadows. Simultaneous to these segmentation techniques, colorimetrical similarity and spatial proximity based novel cloud segmentation algorithm was introduced which handled the balance under- and over-segmentation issues effectively for optimized outcomes [41].

In the year 2010, Alsultanny et al. [1] worked over region growing algorithm for segmentation using RGB and HSI color model which obtained very operative and robust outcomes on various dilations. But results in sensitivity to Hue over which work has to attempt yet. The limitations of conventional image segmentation techniques using region growing such as computational cost and execution time are resolved in [36] by Om Prakash et al. by working over single seeded region growing algorithm. The above work was carried forward using thresholds over RGB channels by Rajesh et al. [13]. Later Genetic Algorithm was introduced in color image segmentation which attained both better and effective results. The enrichment with accuracy and lesser computation time in above outcomes is made in [31]. A work in collaboration with clustering was introduced by Fatima et al. [43] which results in effective runtime operations. In the recent era, the segmentation of RGB and multi-spectral images are getting additional attention of researchers. Ghamisis et al. [10] developed a new heuristic-based segmentation technique for hyper spectral color images classes. Simultaneous to it, Su et al. [32] discussed self-adaptive differential evolution algorithm based color image quantization technique. In [27], V. Rajinikanth et al. worked over non-parametric segmentation approach. Here, the RGB color image histogram is measured to resolve multilevel thresholding issues. Currently, a new attempt is made in color segmentation method by collaboration with neural network [8]. Being new approach comparatively fast outcomes is observed and more optimization needs to be an endeavor. In the year 2016, Romi et al. [26] developed a skin color segmentation approach using threshold. The proposed approach is the amalgamation of chrominance channels of three-color spaces, HSV, YCbCr and normalized RGB respectively. From the experiment it is concluded that the outcomes from approach are correct but still more improvement is required in the images having variation in light conditions. By the year 2017, Md. Rakib Hassan et al. [9] start working on image segmentation using clustering approach with an aim to present that even though K-Means clustering algorithm generates good outcomes, still major improvements are required for optimized results. Like [9] Ramaraj et al. [29] performed segmentation using Fuzzy c-means and K-means clustering. Here Fuzzy c-mean approach is applied for defining the pixel belongingness to a uniform region and K-means approach is applied for partitioning the data points. From the simulation it is observed that the above method has affinity to be ensnared with local minima, due to which clustering directly dependable on cluster center distribution. In [12] an attempt is made in color segmentation using threshold approach. From the experiment it is identified that the above work limits in the case where two objects are overlapped and therefore considered as a single object; which lead a decrease in optimization of the method. Li Xuan et al. made an attempt to undergo color segmentation in underwater using RGB color channel fusion [39].

The proposed method depends on weights estimations of RGB channel fusion with an aim to achieve grayscale image having high background-foreground contrast. Accurate results in less time computation are observed from experiments. The limitation of overlapping in [12] overcome to an extent in [30] using Fuzzy c-mean (FCM) approach. Simulations shows that high information with better segmentation is achieved but with the increase in cluster centers an increment in execution time with data complexity is observed and if the cluster center count reduces, the overlapping in cluster will be witnessed. Francisco A. Pujol et al. [25] applied FCM over real time application for face detection by skin color segmentation. The method is applied over various color spaces and concluded with better segmentation outcomes with requirement of higher optimization together with further implementations. By the year 2018, a new approach for color segmentation is proposed by C. Edgar et al. in [5]. The proposed work improves the unsupervised color segmentation using K-mean ++ algorithm. From the experiment more accurate segmentation with less invalid color identification are observed. In the field of medical color segmentation helped in better human life survivals. Using Ostu’s thresholding approach Syadia N. et al. [20] proposed an white blood cells (WBC) counting analysis from blood images using color segmentation. Earlier WBCs were counted manually, but now the proposed work lead to the advancement in the respective field with higher accuracy. The proposed approach limits itself by implementation over white blood cells only. Y. Zhenqiang et al. [42] has proposed an offset correction method for road detection task. It has been studied that Single materials have colors forming straight lines in RGB space. The work focuses on the detection and correction of the offset between the intersection and origin, by targeting the reason for forming that offset via an optical imaging model. And then presented a simple and effective way to detect and remove the offset. In 2020, F.L.M. Millota et al. [19] aims to the extension of the ARCA dataset (+453% images,+561% samples). Later conducted a generalization-test of color conversion for color specification by adopting a classification approach instead of a regression one. Lastly, synthetic images rendering proposed procedure those enables future deep learning approaches.

The major contributions in the respective field are compared based on approaches in Table 1. In assessment to above prior methods, the improved effectiveness has been conveyed in this paper by investigating each image pixel and segmenting them according to the selected color.

Table 1 Tabular representation of the major contributed papers in the field of color segmentation

3 Problem formulation

Thresholding is a technique of categorizing the pixels integrated to colored or grayscale images into sets on the basis of their respective intensity’s levels. Otsu proposed an image thresholding technique that provides a best threshold of an image by maximizing the variance function among the classes. The efficiency of the method has been proved on both color [11] and grayscale images [28].

Lemma 1

Otsu’s-based image thresholding technique is not computationally effective for colored images.

For given colored image (RGB), assume intensity levels g having an assortment from [0, 1, …, g-1]. Then, pdf \( {P}_i^D \) can be defined as:

$$ {P}_i^D=\frac{Q_i^D}{N_{um}}\kern1.75em {\sum}_{i=0}^{\mathrm{g}-1}{P}_i^D=1 $$
(1)

Here i is a particular intensity level from {0≤ i ≤ g-1} assortment for a color component D= {r, g, b}. Num is submission of image pixels, and \( \frac{Q_i^D}{N_{um}} \) is the pixels count for respective i intensity level in D.

Thus, the mean value of the respective image module is evaluated by means of \( {\mu}_T^D={\sum}_{i=0}^{g-1}{iP}_i^D=1. \)

M-1 threshold levels \( {\delta}_j^D \), j= 1, 2…., m-1 are presented by multi-level thresholding and implemented as:

$$ {F}^D\left(a,\beta \right)=\left\{\begin{array}{c}\kern2em 0,\kern4.00em {f}^D\left(\alpha, \beta \right)\le {\delta}_1^D\ \\ {}\frac{1}{2}\left({\delta}_1^D+{\delta}_2^D\right),\kern3.5em {\delta}_1^D\le {f}^D\left(\alpha, \beta \right)\le {\delta}_2^D\kern1em \end{array}\right\} $$

Here α and β represents the pixel’s width (Wth) and Height (Hth), of the image size Hth * Wth denoted by fD(α, β) with intensity level g for each component.

The occurrence probabilities \( {\upvarphi}_j^D \) of classes \( {V}_i^D \),\( \dots \dots ..,{V}_m^D \) are defined as:

The mean of each class \( {\upmu}_{\mathrm{j}}^{\mathrm{D}} \) can be evaluated from:

Lastly, Ostu’s each component between-class variance can be defined as:

$$ {\sigma}_B^{D^2}={\sum}_{j=1}^m\ {\varphi}_j^D{\left({\mu}_j^D-{\mu}_T^D\right)}^2 $$

The deduction in m-level thresholding is performed till making it reach to the optimization problem for searching\( {\delta}_j^D \), which leads to maximization of objective function (Jmax) for respective image module defined as:

$$ {\varPsi}^D={\mathit{\max}}_{1<{\delta}_i^D<,\dots .g-1}{\sigma}_B^{D^2}\left({\delta}_j^D\right)\ for\ D=\left\{R,G,B\right\} $$

This demonstrates the requirement of very high computational efforts mutually for bi-level thresholds and multi-level thresholds from colored images for resolving this optimization problem. To resolve this threshold issue algorithms based on color image segmentation using hue and background subtraction is then proposed, that led increment in computational efficiency to an extent but lacked in detection of multiple colors from the image.

Color information has always been an essential factor of human vision. Therefore, RGB values are considered as color information from colored images which can be acquired from the saliency map of communication channel separately. Image segmenting is a process of segregating an image into several fragments such that every fragment turns to homogenous while not combined to any two adjacent fragments.

Lemma 2

The previously proposed algorithms are not effectively operational for multiple color detection from an image.

The threshold issue aims to acquire the optimum threshold value to perform segmentation over various classes; such that it can encounter the presumed features. Let an image Img is selected for thresholding, having n number of pixels and Lg be units of gray levels. For segmentation, thresholds of (th1, th2, th3,..., thk)| th1 < th2 <…. < thk separate the Lg units of gray levels into (Cl1, Cl2, Cl3,….., Clk) units of classes [2].

Based on this approach, a simple color detection using hue was proposed. The algorithm functioned over the concept of thresholding and masking of the image pixels. The major aim of this approach was to attain the optimal threshold values that leads to the optimum outcomes [24].

In this case, there were three bands (R, G, B) unlike the greyscale images acquiring only one intensity channel. The algorithm worked over the HSV color space. Thus, the respective RGB colors from an image through the thresholds were computed by following mathematical equations:

  • Step 1: Assigning of minimum and maximum thresholds

$$ Thresholds=\left\{\begin{array}{c} Minimum\ Threshold=0\\ {} Maximum\ Threshold= greythresh\left(W\ image\right)\end{array}\right. $$
(2)

Where W = H, S, V

Here, \( greythresh=\left(\frac{\sum_{j=0}^m{\sum}_{i=0}^n\left(W\ image\right)}{m\ast n}\right) \)

  • Step 2: Perform color object masking. It was an array which was effectively converted in the data types of the respective W images; because multiplication of integers was only possible if they were of same data types.

The masking was endeavored using the equation:

$$ Colored\_ Object\_ Mask= cast\left( Colored\_ Object\_ Mask,^{\prime } like^{\prime }, rgbImage\right) $$

Using the above equation, create mask images for RGB. It masks out the colored-only portions of the RGB image.

$$ Masked\ Image(i)= Colored\_ Object\_ Mask\ast rgbImage\left(:,:,k\right) $$
(3)

Where i = R, G, B and k = 1, 2, 3

From the above simulations it is observed that the respective algorithm is capable of detecting only three RGB colors. The localizing accuracy of the color segmentation and the efficiency of the algorithm is quite low. Thus, is not acceptable for optimized usage in real time applications.

Unlike to the above, a color detection algorithm was proposed from the foreground segment of the image. This algorithm works over the background subtraction technique [35]. Here, original array was made subtracted each time from every RGB color array with an aim to detect the desired color from the image. The algorithm computes the outcomes using following equations:

  • Step 1: Conversion of colored image into grayscale

$$ gray- im= rgb2 gray\ (image) $$
  • Step 2: Perform the subtraction

$$ {\sum}_{j=0}^m{\sum}_{i=0}^n image\left[k\right]-{\sum}_{j=0}^m{\sum}_{i=0}^n gray- im $$
(4)

Where k = 1 ➔ Red, 2 ➔ Green, 3 ➔ Blue, respectively.

  • Step 3: Apply Median Filters to localize the colored portions from the image.

$$ Diff- im= medfilt2\ \left( gray- im,0.18\right) $$

Here, constant 0.18 has been considered as a threshold value for the conversion of filtered grayscale image into black and white image. If the threshold value is above or below this value then it will convert few pixels into white which should actually be considered as black, and vice-versa.

From the above simulations it is observed that the respective algorithm does not carries an ability to detect multiple colors present in an image; is not able to acquire the optimized outcomes on complex images and is applicable only over the image with geometrical shapes of single color which makes it capable to be applied over limited scenarios only. Due to which the above method cannot be applied in various problematic scenarios such as scene understanding and object detection.

Thus, to overcome the drawbacks of the above studied algorithms; a new optimal and effective multiple color detection algorithm has been proposed. The proposed algorithm, segments an image by giving each color pixel a probability to belong a cluster of other pixels.

4 Proposed method

The proposed algorithm provides a generalized classification to various similar shade colors with least time computation. A block diagram has been shown in Fig. 1.

Fig. 1
figure 1

Data flow diagram of the proposed algorithm

figure a

Technically, for certain target color the array prioritization is performed among Red, Green and Blue arrays; later over which simulations are performed for desired outcomes. The simulation outcomes are conversed in section 4.1. This segment provides information about the proposed algorithm.

The algorithm is as follows:

  • Step 1: For a color image Img, assume

The p = (p1, p2… pn) of n pixels, where pi = (S1i, S2i, S3i),

i ϵ [1,….., n], and Sj is the jth color component in the used color space.

The segmentation is described as an array

μ = (μ1,……,μn), μi ϵ [1,0]. Conveying a label to each image pixel, signifying its belonging to a particular cluster.

  • Step 2: Target Color Selection

The indexing of selected color is performed using the simulative formula for respective thresholds, once the desired color to be detected is selected. The respective mathematical formulas to detect the color are:

$$ \mu =\beta -\frac{\alpha }{\rho 1}\left(\mp \right)\frac{\delta }{\rho 2} $$
(5)

Here ‘ρ1’ and ‘ρ2’ is constant yet variates according to the selected color. It considers multiple shades of each color with variation in its value. If we deviate the values of ‘ρ1’ and ‘ρ2’, it will cause the identification of other near range shade color. For instance, if red is a target color then deviation in ‘ρ1’ and ‘ρ2’, might lead to detection of pink color as a red color.

Here β, α, δ are the R, G, B array respectively. The simulations in the above equation will lead to the formulation of multiple color selection formula which later will be applied in the proposed color detection algorithm for identification. The respective mathematical formulas computed from simulations over the Eq. (5) for various colors selection are discussed in below Table 2.

  • Step 3: On the identification of desired color location in the image. The presentation of the outcomes is attempted by evaluating the sum value of the shortlisted pixels. Technically, the computation of the main image and the sliding window is accomplished using the following mathematical formula:

Table 2 The mathematical formulas computed from simulations
$$ \mathrm{if}\ \left(\sum ara<255\ \left({\sum}_{i=1}^{\frac{n}{64}}{\sum}_{j=1}^{\frac{m}{64}}p\right)\ast \left(2\ast {10}^{-4}\right)\right) $$
(6)

Where ara is input array and m, n is number of rows and columns respectively.

Assign zero value to a certain window of output array, if the corresponding widow in ara array does not satisfy the threshold criteria.

$$ Assign\ value\ zero\ to\ pixel=\left\{\begin{array}{c}i\to i+\dim (1)\\ {}j\to j+\dim (2)\end{array}\right. $$
  • Step 4: The pixels those satisfied the condition of Step 3 are copied into the output array for final outcome. The analysis of the entire image is then pursued through the following mathematical equation:

$$ Assign\ value\ zero\ to\ pixel=\left\{\begin{array}{c}i\to i+\dim (1),\kern0.5em i=0\ to\ n\ \\ {}j\to j+\dim (2),\kern0.5em j=0\ to\ m\end{array}\right. $$
(7)
  • Step 5: The image pixels are scanned and if the pixels sum satisfies the criteria of exceeding the threshold value; an analysis is attempt to verify the scanning of the input image. On arise of situation where the complete image is scanned in once using the following mathematical equation the conversion to monochrome is made.

$$ {\displaystyle \begin{array}{l}\mathrm{If}\ \left(\mathrm{i}==\dim (1)\&\&\mathrm{j}==\dim (2)\right)\\ {}\kern0.6em \mathrm{Execute}\kern0.24em \mathrm{rgb}2\mathrm{bw}\\ {}\mathrm{else}\\ {}\kern0.73em \mathrm{Jump}\kern0.34em \mathrm{to}\kern0.37em \mathrm{Step}\;3\end{array}} $$
(8)
  • Step 6: After the desire colored area computation, blur the resultant image and localize the detected color portions. The dimensions of the rectangle are then computed for better observations. Finally, the whole result is presented. The complete flow diagram of proposed method in step by step has been shown below in Fig. 1.

The proposed algorithm aims at color detection from an image. From the study it is witnessed that the prior methods of color detection basically consider a single-color array from RGB, which leads to single target color detection. Whereas, the proposed algorithm works over the ranges of R, G and B. Practically, it utilizes all three RGB arrays, yet if we target on a specific color. Which therefore, lead to the detection of specific colors along with other nearby shades of the same. Technically, it subtracts all the remaining colors except the target color from image through mathematical formulations over matrices. This subtraction of the color region leads to the minimization of further processing. This minimization in processing of proposed algorithm helps in less time computation.

5 Simulation results and discussion

The proposed color detection algorithm is evaluated by both qualitative and quantitative analysis using DUTOMRON dataset [40]. Six sample images randomly selected from the benchmarked dataset are shown in Fig. 2. Our Color Detection algorithm (C_D) is compared with four mainstream models designed using hue, background subtraction (BS), Particle Swarm Optimization (PSO), RGB Segmentation (SEG) and Fuzzy c-Mean (FCM). Hue implement color detection using the threshold approach and aims to attain the optimal threshold for accurate outcomes [24]. BS [35] deals with effective color detection through background subtraction approach, it majorly focuses on the foreground section of the image and targets the objects with single color at a time. PSO [27] aims in optimal multi-level segmentation through improvement in particle swarm optimization. It is implemented by maximizing the Otsu’s class variance function for attaining the optimal threshold for every color component. SEG [13] deals with region growing based color segmentation. Basically, the approach is based on eight neighbor connectivity and aims in measuring the intensity between respective seed pixel and its neighboring pixels. FCM deals with the color segmentation using FCM clustering technique. It has been studied that FCM clustering technique extract more information and belongs to more than one cluster when collaborated with color images [30].

Fig. 2
figure 2

Detection of RGB color region of the images. Here a Chairs, b Letter box (R), c Forest, d Letter box (G), e Car and f Door

5.1 Qualitative evaluation

The color detection by the proposed algorithm and four state-of-the-art models is presented in Fig. 2. It is observed that the outcomes of the proposed algorithm are better in comparison to other four models. Various kind of results has shown in Fig. 2 applied on two-dimensional images, complex images, low quality images and blur images. To identify the localization of the detected color, each color has the same color rectangular box as the color itself, except for orange, which is represented by a light blue color and white color region by red color boundary.

Images with single color, most of existing model performs well enough to extract the color of medium quality. For example, the outcomes of the BS based algorithm are easily detected by another comparable model. However, for complicated image with many objects (such as second letter box example in column 3 from Fig. 2) or structurally complex edges (such as car in column 3 from Fig. 2), the proposed C_D algorithm overwhelms all the limitations more effectively than any other color detection algorithms. The outcomes from Hue failed in performing the color segmentation for RGB. As in column 2 of Fig. 2 majority of the images are obtained to be black, which does not lead to any outcome. The outcomes from SEG [13] still maintained the multiple segmentation from the complex images, whereas the outcomes from the PSO [27] obtains the non-acceptable color segmentations, as the extraction of inappropriate colors from the connected similar colored objects are acquired from the image. The outcomes from FCM techniques obtain acceptable segmentation for color Red and Blue but does not worked well for Green color. Furthermore, the proposed algorithm is also capable of detecting other colors i.e. Orange, Yellow and Pink except RGB in Fig. 3. The detection of the above additional colors, are obtained from the simulations in the proposed color formula, by making the variation in the composition of RGB color. Nevertheless, unlike other pre-posed models, the proposed algorithm carries an ability to detect the multiple colors present in the image in a single execution. The accomplishment of the algorithm is presented in Fig. 4 over Complex, Low quality and Blur images. The proposed algorithm is applied in medical field. Research on brain imaging is on its track. Therefore, for better analysis on MRI images proposed algorithm is applied over brain images through which multiple color segments are detected that can later be selected for specific region investigations. The outcome of proposed algorithm on MRI images is presented in Fig. 5. A healthy body carries a good immune system. And for analysis of the immune system, white blood cells (WBCs or Leukocytes) hold an important part. It has been investigated that the human body immune system is rigorously reducing because of bad environmental conditions. Therefore, for health care practitioner an accurate detected the WBCs become an essential chore. Thus, C_D is applied for the detection of white blood cells from the images, which can be used for better blood analysis during physical examinations. The comparative analysis of detected blood cells by C_D and prior methods is presented in Fig. 6.

Fig. 3
figure 3

The results of proposed algorithm for detection of a Orange color ROI, b Yellow color ROI, c Pink color ROI and d White color ROI

Fig. 4
figure 4

The results of proposed algorithm over a Complex image, b Low quality image and c Blur image

Fig. 5
figure 5

The results of proposed algorithm over brain MRI images

Fig. 6
figure 6

Detection of white blood cells using proposed algorithm

It is observed that the prior methods are unable to handle the noise from the images and therefore heading with unwanted localizations (as shown in case of PSO and FCM). But the proposed method is smoothly handling the present noises and leading to accurate detections. Similar to WBC analysis the experiment is performed over Glaucoma Eye image using color detection which leads to better nerves analysis approach in the medical world. The comparative analysis of detected red nerves from Glaucoma Eye image by C_D and prior methods is presented in Fig. 7. It is witnessed that the proposed algorithm has effectively localize the nerve regions where existing methods considered complete eye as a red region due to lack to color accuracy (as shown by results of Hue, BS and PSO). There are two images EYE_3 and EYE_5 which has generated a complete bounded box on the eye; this is because, the eye color in those respective images is complete red. The outcomes of FCM (EYE_3 and EYE_4) and SEG (EYE_2 and EYE_5) majorly identified the noises; which leads to bad detection of the nerve regions. Unlike to above the outcomes of C_D has outperformed the results of existing methods.

Fig. 7
figure 7

Detection of nerves from glaucoma eyes using proposed algorithm

5.2 Quantitative evaluation

The computational efficiency of the images of different methods is discussed in the section. It is clearly shown that the proposed method C_D outperformed these competitors by achieving the minimum execution time, for both images from DUTOMRON dataset and over medical images which is graphically presented in Figs. 8 and 9, respectively. It is observed that the computational time of SEG and FCM is quite high, because SEG lacks in noise handling and FCM extracts more information and belongs to more than one cluster when collaborated with color images which takes the high time complexity. In contrast to SEG and FCM, the computational time of Hue, BS and PSO are very less but is still higher than C_D, because the respective methods consider complete eye images as a single target rather than detecting the red objects only. Technically, BS focuses on foreground targets and PSO works over maximizing of Otsu’s class variance function which leads to complex computations and high computational timing. Whereas, C_D targets on optimal threshold approach for a specific color that leads easy computation. The experiment for Fig. 7 is set to detect only the red color regions, i.e. nerves, which have successfully been handled by the C_D algorithm, but not by SEG because it has also detected the yellow regions from the images (See images EYE_1 and EYE_3). SEG works over eight neighbor connectivity and targets in the calculation of intensity between seed pixel and neighboring pixels which therefore causes high computational time. The computational time of the C_D is minimal as it has a fast-computational processing because it works over matrix multiplication and has easy noise handling capability. Minimum execution time indicates the better efficiency and higher accuracy that can easily be observed from the achieved outcomes. Based on the above quantitative analysis, an outperformance of the proposed method in the state-of-the-art on benchmarking dataset is concluded.

Fig. 8
figure 8

Comparative analysis of the simulated results through computational time consumption

Fig. 9
figure 9

Comparative analysis of the simulated results through computational time consumption on medical images

6 Conclusion and future work

Object detection has always been a chief application and a major issue of concern in digital image processing. It faces various parametric difficulties such as type of image, intensity of illumination and many more.

Majorly, color information has not been openly used for object detection because of its parametric difficulties. To add a contribution towards the improvement of object detection through colors, a new color detection algorithm is proposed in this paper. From the simulative outcomes it has been observed that: 1) The proposed method can detect either individual or multiple respective colors from an image; 2) Simulated results are presented that shows, the proposed algorithm can identify the color location from variety of images such as two-dimensional, complex images, low quality images, blur images and medical images; 3) The method has accomplished high accuracy; 4) From simulated outcomes and time consumption analysis confirms that the proposed algorithm is better than prior algorithm.

The performance of proposed algorithm investigates and shows that the method C_D effectively handles limitations of existing techniques. The detection of dull colors from an image, the detection of intermediate shades of respective color and an improvement with an aim to enhance an outcome when there is a presence of shadow in an image, are the certain areas in which the future research can carry forward.

The work is likely to help and give direction for future research in the area of object detection. In future, the more color range will be made under considerations and more optimized algorithm with deep learning approach will be proposed.