1 Introduction

The coronavirus disease 2019 (COVID-19) is one of the newest viruses [1, 2]. It had arisen from a virus named SARSCoV-2. The first cases of COVID-19 were recorded in Wuhan, China, in December 2019 [3]. COVID-19 is a deadly pandemic that the world is currently facing. COVID-19 has impacted approximately 11 million globally, including over 500,000 people in Europe and the USA [4]. COVID-19 has become a worldwide pandemic because of an exponential growth rate and poorly understood transmission mechanism [5, 6]. Cough, fever, sore throat, headache, exhaustion, and discomfort in the muscles are the previously reported symptoms of COVID-19 [1]. This virus also contributes to pneumonia, an infection that inflames the lungs’ air sacs. COVID-19 influences countries’ health, and its effects (e.g., economic and psychological) are crucial. Early detection may be mirrored in early therapy. Accordingly, COVID-19 is an epidemic with a wide range of challenges to tackle. Based on the knowledge mentioned above, there is a need for tools to detect this fatal disease on time. One of the critical problems is using multiple tests to diagnose COVID-19. The real-time polymerase chain reaction is the most commonly used test. It is invasive and time-consuming, and the diagnosis is false-negative. Chest computed tomography (CT) is another test that plays an essential role in COVID-19 diagnosis [7].

CT offers a guide to pathophysiology, which might shed light on the diagnosis and development of specific disease stages. It evolves as a useful diagnostic method for the medical practice of lung disease associated with COVID-19 [5]. Preliminary studies suggested that chest CT has a high detection sensitivity for COVID-19 lung pathology. Several groups have demonstrated the capacity for diagnosis based on CAD systems, with accuracy as high as 95% [7]. Medical imaging has been used recently for multiple diagnoses of the disease. Medical imaging methods may be used as a critical diagnostic to guide a possible disease.

Image segmentation is considered a critical process in image processing. It plays a significant role in image research in different applications such as computer vision, pattern recognition, and medical images [8, 9]. The classification system may fail if the segmentation result is incorrect. Segmentation aimed to split the image into several homogeneous regions or segments containing similar features, such as texture, color, brightness, contrast, form, and size, regarding a specific thresholding value(s) [10]. Several methods (e.g., edge-based, regional-based, threshold-based, and feature-based clustering) have been suggested to solve the current problems and improve research quality in the literature.

Thresholding is extremely important in the image segmentation domain. It is categorized into two types: bi-level and multilevel thresholding. The simplest thresholding technique is bi-level thresholding segmentation that divides an image into two classes by searching a single thresholding value. Multilevel thresholding divides the image into several distinct parts by establishing several threshold values [11]. Multilevel thresholding is the most common image segmentation method that attempts to group the pixels that share characteristics into a finite number of pixels and segment an image into more than two regions based on pixel intensity [12].

Most image segmentation based on multilevel thresholding methods uses the image histogram as an input to determine the thresholds by maximizing or minimizing the objective functions [13], for example, fuzzy entropy [14], Kapur’s entropy [15], Tsallis entropy [16], and Otsu’s method [17].

However, multilevel thresholding segmentation methods have some limitations in computational costs. The computational time will increase for multilevel thresholding problems with increasing thresholding values as they search for the best thresholding values exhaustively to optimize the objective function. There are two types of approaches for finding the appropriate threshold values in multilevel thresholding segmentation: parametric and nonparametric. A parametric approach assumes that each class of the image can identify by using probability density distributions. These classes are all used to represent the pixels in an image. This approach takes a long time to compute. However, the nonparametric methods use discriminated rules to separate the pixels into homogeneous regions. The threshold values are determined by a statistical criterion [18]. Otsu’s method [17] presented the maximization of the variance between classes to obtain the optimal threshold values. In this paper, we focused on a parametric approach, in which we measured the specific statistical parameters for each class in the image. To achieve the desired threshold values, we used Otsu’s method by maximizing between variances. Otsu suggested a common approach that can determine thresholds to optimize the class variance of the foreground and background intensity levels. It is one of the most suitable threshold selection methods for real-world images [19]. However, there were challenges in these approaches when achieving the desired threshold values for multilevel thresholding. The computational time is also expensive, which grows exponentially with the number of threshold values. The process of searching for optimum thresholding values for multilevel thresholding segmentation can be considered a constrained optimization problem. The optimization algorithms, especially the meta-heuristic methods, are commonly used in related research to solve these problems [20].

Optimization is the process of determining the best possible solution(s) for a particular problem. Trying to find the fastest road to get to a destination or coordinate work activities to minimize the idle time between each task are examples of optimization problems. Surely, everyone uses optimization daily. Optimization intends to reach a satisfying or optimal solution concerning different objectives for a specific problem. Optimization is received a huge increased concentration in the last decade since it has ubiquitous nature with all issues [21]. It appears everywhere and almost in every application like Computer Science, engineering problems [22, 23], and Finance, feature selection [24], fuzzy control systems [25], chemoinformatics, bioinformatics [26], engineering optimization problems [27], improving the collective construction systems [28], and image segmentation problems [29]. So many fields of science need optimization, different optimization methods have been developed. Optimization algorithms can be defined as processes where possible solutions are evaluated to choose the most suitable solution for the problem at hand. The quality of the optimized solution depends on the chosen algorithm to solve the problem. As a result, one needs to select the most appropriate algorithm to solve the problem at hand [30]. An optimization algorithm may start and perform the optimization process by single or multiple random solutions. In the first case, the optimization process begins with a single random solution, and it is iteratively improved over the iterations. In the second case, a set of solutions is created and enhanced during optimization. Many factors have an impact on the quality of the optimization algorithm, such as the number of features, diversity of training sets, the number of samples, and representativeness [31]. Optimization algorithms can be classified into two categories: deterministic and stochastic methods. Deterministic algorithms may be a good choice when the gradient is accessible. This variety of methods is based on predetermined calculations, implying that the optimization process is replicable. A reproducible process means that the optimization path and the final solution will be identical every time the algorithm is executed with the same initial states. In contrast, stochastic methods have random features that generate different optimization pathways, leading to other optimized solutions, even if the initial conditions are identical at each run. The main advantage of stochastic algorithms is that they do not need gradient information. Gradient information is hard to access due to the problems becoming more and more complex. Researchers have been developing stochastic algorithms in which no gradient information is needed. The development of more advanced stochastic methods has produced the category of meta-heuristics algorithms [30].

Meta-heuristics algorithms have gained enormous interest in multilevel image thresholding [32]. For the past years, researchers have widely demonstrated meta-heuristic algorithms’ ability to solve many kinds of difficult optimization problems in engineering, communications, transportation, industry, and social sciences because these algorithms have high performance and are easy to implement [33]. Researchers have proposed meta-heuristic algorithms to solve the multilevel thresholding problems by maximizing some specific criteria for research. Some of the most widespread meta-heuristic algorithms include a genetic algorithm (GA) [34], cuckoo search (CS) [35], grey wolf optimization (GWO) [36], social engineering optimizer (SEO) [37], differential evolution (DE) [38], colony optimization (ACO) [39], sine cosine algorithm (SCA) [40], Harris hawks optimization (HHO) [41], and moth flame optimization (MFO) [42]. Zhao et al. [43] introduced manta ray foraging optimization (MRFO) as one of the most recent additions. MRFO showed more high-quality results than several classical and the latest counterparts.

Most optimization algorithms recorded exemplary achievements in multilevel thresholding, as all can get the optimal threshold result; however, they meet particular challenges because of the trapping in local regions, early conversion, and missing global searchability. These lay grounds for researchers to propose modified and hybrid versions and improve techniques. For the optimization problems, evaluating a candidate and its opposite solution simultaneously can increase the convergence rate toward a globally optimal solution. Opposition-based learning (OBL) [44] is one of the healthiest approaches to enhance the search performance of the meta-heuristic algorithms [45]. In [46], OBL was implemented to increase the efficiency of meta-heuristic optimization methods. OBL has regraded the suggested solutions built through a stochastic repetition system and their “opposite solutions” located in the search space’s opposite regions. It has been combined with several bioinspired optimizations to provide smaller predicted distances to the globally optimal relative to randomly experimented solution pairs [47], such as cuckoo optimization algorithm [48], shuffled complex evolution algorithm [49], and fireworks algorithm [50]. In [51], the authors applied the OBL to enhance the Equilibrium Optimizer adopted for image segmentation using Otsu’s function to obtain the best threshold values for image segmentation.

A new meta-heuristic swarm optimization algorithm called MRFO algorithm has been applied in structural optimization [43]. Despite its efficacy in search mechanisms, certain areas can be improved to prove its efficiency on challenging optimization problems, like image thresholding, because the algorithm may miss some critical search regions. We integrated the MRFO algorithm with OBL (MRFO-OBL) to generate solutions from potential regions and explore search space more rigorously to address this issue. More importantly, we improved its local searchability with the help of solutions generated from around the promising regions, avoiding traps in local optima. Consequently, the proposed MRFO variant comes with a trade-off equilibrium among exploration and exploitation. We then applied the MRFO-OBL to a multilevel image thresholding problem.

The following are the contributions of this paper:

  • Boosted MRFO using OBL to solve image segmentation problems has been proposed.

  • We applied the proposed segmentation algorithm to COVID-19 CT images.

  • Different segmentation levels are used to assess the stability and the efficiency of the proposed method.

  • Several well-known meta-heuristics are compared with the efficiency of the proposed method.

  • Validate segmentation efficiency according to peak signal-to-noise ratio (PSNR) and structural similarity index (SSIM) values.

  • The proposed method can be generalized to different medical imaging diagnoses and applied to different benchmark images.

The rest of the paper is structured as follows: Sect. 2 explains some related works. Section 3 confers an overview of the used methods. Section 4 introduces the proposed method. The experimental results derived from the proposed method to address multilevel thresholding are discussed in Sect. 5. Section 6 concludes the proposed method and discusses future work.

2 Literature review

The image segmentation problem plays a crucial role in image processing and computer vision, which are present in many fields, such as medical diagnosis, object recognition, satellite image processing, and more. There are more methods used to solve the problem of image segmentation. Multilevel thresholding segmentation is considered the best one for solving the image segmentation problem. Due to the time complexity problem with the increased threshold levels, traditional techniques failed to solve the image segmentation problem. Thus, the meta-heuristic algorithms have been more used to solve these problems and overcome the time complexity. This section introduces an overview of the recent works for overcoming the image segmentation problem of medical imaging and standard imaging and shows some recent works of segmentation of COVID-19 medical imaging.

Table 1 summarizes some optimization algorithms used for image segmentation. Moreover, several researchers work on medical imaging segmentation using optimization algorithms; for example, in [52], the authors proposed a method MRI image segmentation using the LASHED optimization algorithm. The statistically verified results demonstrate that the suggested approach improves consistency and segmentation quality. Furthermore, [53, 54] also using the optimization algorithms for medical image segmentation. The researchers in [55] proposed a multilevel thresholding method for medical image segmentation based on a partitioned and cooperative quantum-behaved PSO. The proposed method was tested with four stomach CT images and compared with two modified PSO algorithms. In [56], the authors presented an evolutionary grey gradient algorithm-based multilevel thresholding technique for brain MRI image segmentation (EGGA). To improve the fitness function, they used an adaptive swallow swarm optimization (ASSO) technique. They evaluated the ASSO using twenty-five MR scans, which revealed that it performed better than the original SSO. While in [57], the authors presented an enhanced method of the FPA algorithm to tackle the problem of medical image segmentation. They applied Otsu’s method as an objective function and tested the proposed method using eight CT images. This method outperformed several meta-heuristics algorithms (the original FPA, PSO, GA, and DE). In [58], the authors proposed a segmentation method for MRI brain images using the artificial bee colony algorithm (ABC). They enhanced the ABC algorithm by using the mean best-guided approach. They test the proposed method on 20 MRI images.

Table 1 List of some algorithms that work for the problem of image segmentation

Also, the multilevel thresholding has been used for COVID-19 medical imaging segmentation. Therefore, in this paper, some methods for COVID-19 imaging segmentation are presented. In [7], the authors proposed a segmentation method for CT-COVID-19 images based on marine predators algorithm (MPA) and MFO algorithm using the fuzzy entropy fitness function for multilevel thresholding segmentation. They enhanced the MPA algorithm using the MFO algorithm and used 13 CT images to test its performance. In [59], the researchers presented a multilevel thresholding segmentation method for COVID-19 chest X-ray images by hybridized two meta-heuristics algorithms (Slime mould algorithm and WOA algorithm). They applied the Kapur method as an objective function and compared it with five optimization algorithms. Also, in [60], the authors applied the MPA algorithm to diagnose the COVID-19 X-ray images and obtain a good performance. While the authors in [61] proposed a model to predict the COVID-19 using the machine learning techniques with the nature-inspired algorithms. The proposed method was compared against more existing methods and tested on the same datasets.

As conferred from the previous researches mentioned above, image segmentation of medical images, especially in COVID-19 images, is critical to detect the infection with COVID-19.

3 Materials and methods

This section discusses the materials and methods needed for developing the proposed method. The basic MRFO algorithm and its structure are clarified, and some fundamental concepts of the OBL strategy and the objective function are described.

3.1 Image thresholding method: Otsu’s method

This subsection explains the standard method’s mathematical model used in image thresholding; namely, Otsu’s method [17]. The segmentation method is based on the image histogram [75], which carries the pixel’s distribution over the image. This method takes the image histogram as the input and then finds the optimal threshold values to its criteria. Otsu’s method is one of the segmentation methods used to achieve the image’s best threshold values by maximizing the variance between classes and determining the optimum values for the thresholds that divide the image into many classes. This method identifies the gray image intensity levels \(L_v\) and determines the probability distribution in Eq. (1) [8].

$$\begin{aligned} {h_i} = \frac{{{h_i}}}{{PN}},\sum \limits _{i = 1}^{PN} {P{h_i} = 1} \end{aligned}$$
(1)

where \(i_l\) is the intensity level specified in \((0 \le i_{l} \le L_{v}-1)\), PN represents the total number of pixels, \(h_i\) denotes the intensity number \(i_l\) in the image histogram. The histogram has standardized in \(Ph_i\). Depending on the probability distribution or thresholding value (th), the classes for bi-level segmentation have determined as:

$$\begin{aligned} {C_1} = \frac{{Ph_1}}{{\omega _0(th)}},\ldots ,\frac{{Ph_{th}}}{{\omega _0(th)}} \text { and } {C_2} = \frac{{Ph_{th + 1}^c}}{{\omega _1(th)}},\ldots ,\frac{{Ph_L}}{{\omega _1(th)}}\mathrm{{ }} \end{aligned}$$
(2)

where \(\omega _0(th)\) and \(\omega _1(th)\) are additive probability distributions for \(C_1\) and \(C_2\), respectively, as shown in Eq. (3).

$$\begin{aligned} \omega _0(th)=\sum _{i=1}^{th}Ph_i \text { and } \omega _1(th)=\sum _{th+1}^{L}Ph_i \end{aligned}$$
(3)

It is mandatory to find the average intensity levels \(\mu _0\) and \(\mu _1\) using Eq. (4). When these values have been calculated, the Otsu-based between-class \(\sigma _B^{2}\) is defined in Eq. (5).

$$\begin{aligned}&\mu _0=\sum _{i=1}^{th} \dfrac{ iPh_i}{\omega _0(th)} \text { and } \mu _1=\sum _{i=th+1}^L \dfrac{iPh_i}{ \omega _1(th)} \end{aligned}$$
(4)
$$\begin{aligned}&\sigma _B^{2}=\sigma _1+\sigma _2 \end{aligned}$$
(5)

In Eq. (5), \(\sigma _1\) and \(\sigma _2\) are the \(C_1\) variances specified as follows:

$$\begin{aligned} \sigma _1=\omega _0 (\mu _0 +\mu _T)^2 \text { and } \sigma _2=\omega _1(\mu _1 +\mu _T)^2 \end{aligned}$$
(6)

where \(\mu _T=\omega _0\mu _0+\omega _1\mu _1\) and \(\omega _0+\omega _1=1\) based on \(\sigma _1\) and \(\sigma _2\). Equation (7) defines the objective function:

$$\begin{aligned} F_{otsu}(th)=\max (\sigma _B^{2}(th)) \text { where } 0 \le th \le L-1 \end{aligned}$$
(7)

where \(\sigma _B^{2}(th)\) is the Otsu’s variance for a specified th value. The objective function \(F_{otsu}(th)\) in Eq. (7) is updated for multiple thresholds as:

$$\begin{aligned} F_{otsu}(TH)=Max(\sigma _B^{2}(th))\text { where } 0 \le {th_{i}} \le L-1 , i=[1,2,\ldots ,q] \end{aligned}$$
(8)

where TH=\([th_1,th_2,\ldots ,th_{q-1}]\) is a vector containing multiple thresholds and L denotes maximum gray level. The variances are calculated by Eq. (9).

$$\begin{aligned} \sigma _B^{2}=\sum _{i=1}^q \sigma _i = \sum _{i=1}^q \omega _1(\mu _1 -\mu _T)^2 \end{aligned}$$
(9)

where i defines a particular class and \(\omega _i\) and \(\mu _j\) are the probability of occurrence and the mean of a level. For multilevel thresholding, such values are obtained as follows:

$$\begin{aligned} \omega _{q-1}(th)=\sum _{i=th_q +1}^L Ph_i \end{aligned}$$
(10)

for mean values:

$$\begin{aligned} \mu _{q-1}=\sum _{i=th_{q}+1}^L \dfrac{iPh_i}{\omega _1(th_q) } \end{aligned}$$
(11)

3.2 Opposition-based learning (OBL)

OBL is a useful search strategy in bypassing stagnancy in candidate solutions [44]. Tizhoosh [46] proposed the OBL’s basic idea, which improves the search mechanism’s exploitation worth. Generally, when the initial solutions are near the optimal location in meta-heuristic algorithms, convergence happens instantly; otherwise, late convergence is expected. Here, the OBL strategy obtained better solutions by considering opposite search regions closer to the global optimum. The OBL works by searching both directions in the search space. One of the original solutions is used in these two ways, whereas the opposite solution defines the other direction. The OBL then takes the most suitable solution from all solutions [76].

  • Opposition number The idea of opposite numbers can be described by explaining OBL. An opposition-based number can be identified as follows: Consider \(z_0\) is a real number on an interval: \(z_0 \in [q, w]\). The opposite number of \(Z_0\) is defined by Eq. (12) [76]

    $$\begin{aligned} \overline{z}_{0}={q + w} - {z_{0}}. \end{aligned}$$
    (12)

    Moreover, the opposite number in D-dimensional space is determined by Eqs. (13) and (14)

    $$\begin{aligned} z= {z_{1},z_{2},z_{3},\ldots \ldots ,z_{D}} \end{aligned}$$
    (13)
    $$\begin{aligned} \overline{z}= {[\overline{z}_{1}, \overline{z}_{2}, \overline{z}_{3}, \ldots ,\overline{z}_{D}]} \end{aligned}$$
    (14)

    The values of all items in \(\overline{z}\) are calculated using Eq. (15)

    $$\begin{aligned} \overline{z}_{k}={q_{k}+w_{k}} - {z_{k}}\;\text {where}\; k = {1, 2, 3, \ldots , D} \end{aligned}$$
    (15)
  • Opposition-based optimization In the optimization process, the opposite point \(\overline{z}_{0}\) is substituted by the corresponding solution \(z_0\) as regards the fitness function. If \(f(z_0)\) is better than \(f(\overline{z}_{0})\), then \(z_0\) does not alter, oppositely, \(z_0\) = \(\overline{z}_{0}\). So, the solutions are updated as regards the best value of z and \(\overline{z}\) [77].

3.3 Manta ray foraging optimization algorithm

Zhao et al. [43] designed the MRFO algorithm, a bioinspired optimizer. MRFO assumes the actions of manta rays in catching the prey. MRFO utilizes three foraging procedures of manta rays: chain foraging, cyclone foraging, and somersault foraging. Chain foraging mimics the process of necessary food searching. Foraging manta rays systematically grasp up to capture the disappeared or undetected prey in the chain by the last manta ray. Cyclone foraging occurs when the collection amount of the prey is significant. The head is paired with the manta ray’s tail, making a spiral to create an edge in a cyclone’s eye. In somersault foraging, manta rays perform backward rotation and circle movements throughout as the prey planktons move them into their open lips [78]. Like various meta-heuristic algorithms, MRFO’s initialization start is defined randomly to generate random positions for a set of agents X, followed by getting the most desirable agent \(X_{best}\) with the best fitness value. The agents are updated according to the aforementioned three strategies. The following are the mathematical models of these strategies.

  1. 1.

    Chain foraging In this process, the agent \(X_{k}\) is updated at iteration k using Eq. (16)

    $$\begin{aligned}&x_{k}^{t + 1} =\left\{ \begin{array}{ll} x_{k}^{t} + r*\left( {x_{best}^{t} - x_{k}^{t} } \right) + \alpha \left( {x_{best}^{t} - x_{k}^{t} } \right) &{} k = 1 \\ x_{k}^{t} + r*\left( {x_{k - 1}^{t} - x_{k}^{t} } \right) + \alpha \left( {x_{best}^{t} - x_{k}^{t} } \right) &{} k = 2,\ldots ,N \end{array}\right. \end{aligned}$$
    (16)
    $$\begin{aligned}&\alpha = {2 * r * \sqrt{\left| {\log \left( {r } \right) } \right| }} \end{aligned}$$
    (17)

    where \(x_{k}^{t}\) is the \(k_{th}\) position in time k, r is a random vector in [0, 1], \(\alpha\) is the weight coefficient, and \(x_{best}^{t}\) is the high-concentration plankton [43].

  2. 2.

    Cyclone foraging In this process, the agent \(X_k\) is updated following Eq. (18)

    $$\begin{aligned} x_{k}^{t + 1} &= \left\{ \begin{array}{ll} x_{best}^{t} + r*\left( {x_{best}^{t} - x_{k}^{t} } \right) + \beta \left( {x_{best}^{t} - x_{k}^{t} } \right) &{} k = 1 \\ x_{best}^{t} + r*\left( {x_{k - 1}^{t} - x_{k}^{t} } \right) + \beta \left( {x_{best}^{t} - x_{k}^{t} } \right) &{} k = 2,\ldots ,N \end{array}\right. \end{aligned}$$
    (18)
    $$\begin{aligned} \beta= 2 \cdot \exp \left( r \cdot \frac{K_{\max }-k+1}{K_{\max }}\right) \cdot \sin \left( 2 \pi r\right) \end{aligned}$$
    (19)

    where \(\beta\) is the weight coefficient. Furthermore, based on a random position provided in the search space, the cyclone foraging step agents can change their position to improve the MRFO’s exploration. Thus, the current agent location is updated using the following equation:

    $$\begin{aligned} x_{k}^{t + 1} &= \left\{ \begin{array}{ll}x_{{{\text {rand}}}}^{k} + r *\left( {x_{{{\text {rand}}}}^{t} - x_{k}^{t} } \right) + \beta \left( {x_{{{\text {rand}}}}^{t} - x_{k}^{t} } \right) &{} k = 1 \\ x_{{{\text {rand}}}}^{t} + r *\left( {x_{k- 1}^{t} - x_{k}^{t} } \right) + \beta \left( {x_{{{\text {rand}}}}^{t} - x_{k}^{t} } \right) &{} k = 2,\ldots ,N \end{array}\right. \end{aligned}$$
    (20)
    $$\begin{aligned} x_{{{\text {rand}}}}^{t}= {\text {Low}}+ r*\left( {{\text {Up}} - {\text {Low}} } \right) \end{aligned}$$
    (21)

    where Low and Up are the lower and upper limits of the search space.

  3. 3.

    Somersault foraging The mathematical formulation used to update the agent in this phase is defined in the following equation:

    $$\begin{aligned} x_{k}^{t + 1} = x_{k}^{t} + s * \left( {r_{1}. x_{best}^{t} - r_{2}. x_{k}^{t} } \right) \end{aligned}$$
    (22)

    where s is the somersault factor equal to 2, and \(r_1\) and \(r_2\) are the random numbers in [0, 1].

To conclude, the MRFO algorithm is initialized by generating a random population within specified permissible boundaries. The position-update procedure depends on the individual manta ray at the front of the recent one and the estimated pivot position. Changing from exploration to exploitation phase depends on the (itr/maxitr) ratio value. The exploitation phase is determined when \((itr/maxitr < r)\), in which the current most suitable position is recognized as a pivot position. The algorithm moves to the exploration phase when \((itr/maxitr > r)\). Furthermore, the algorithm can shift between chain foraging and cyclone foraging based on a randomly generated number. Somersault foraging then takes steps to update the individuals’ current status through the current best approach. These three distinct foraging mechanisms are conducted interchangeably to simultaneously achieve the optimization problem’s optimal global solution and meet the predefined end criterion.

4 The MRFO-OBL algorithm

This section discusses in detail the implementation of the proposed MRFO-OBL algorithm for segmenting the CT chest for COVID-19. The MRFO-OBL model is illustrated in detail in the flowchart presented in Fig. 1. In the proposed method, the OBL is used to boost the convergence of the MRFO toward the global solution. OBL is a local search technique aimed to avoid the random population’s disadvantages and increase the algorithm’s convergence by enhancing the variety of its solutions. Consequently, the smaller steps enable the complete quest to scan the promising area rigorously. The proposed MRFO-OBL multilevel thresholding image segmentation method has explained with more details in the following phases:

  1. 1.

    Initialization phase The first step in the proposed method is to read the input image from the COVID-19 dataset and store it as the gray-scale image. It then obtains the input image histogram and calculates the probability distribution following Eq. (1). The next step initializes the MRFO-OBL parameters, such as maximum iterations \(it_{max}\), population size N, and problem dimensions D. Like many other meta-heuristic algorithms, MRFO-OBL starts with the first population’s random initialization \(x^0\) and saving results. The OBL strategy can be applied to the MRFO in the initialization phase to improve the search process as follows:

    $$\begin{aligned} Opp_i = lb_j+ub_j-x_i, i\in {1,2,\ldots ,N} \end{aligned}$$
    (23)

    where \(Opp_i\) is a vector maintaining solution generated by applying OBL and \(lb_j\) and \(ub_j\) are the lower and upper bounds of the \(j^th\) component of a vector X.

  2. 2.

    Apply OBL phase OBL is used to find the opposite solution of each solution in the previous step. The OBL concept is then utilized to calculate the \(Opp_{i}\) vector of the initial population using Eq. (23).

  3. 3.

    Optimization phase This process begins by evaluating the \(x_i\) and \(Opp_{i}\) populations using Otsu’s method in Eq. (8), followed by comparing the fitness of \(x_i\) and \(Opp_{i}\) and saving the best solution with the highest fitness. The optimization process is split into three main phases of optimization, as discussed in Sect. 3.3. After applying the three phases of the optimization, the proposed method calculates and compares the fitness of \(x_i\) and \(Opp_{i}\) after using Otsu’s method Eq. (8) and updates the global best solution found so far.

  4. 4.

    The best solution phase The steps of the two previous phases are performed again until the stop conditions are reached. The proposed method uses the total number of iterations as stop condition. The proposed method selects the best solution according to the better threshold values. Select the best thresholding values and apply them to the CT image in grayscale. Algorithm 1 illustrates the pseudo-code of the proposed MRFO-OBL method.

Fig. 1
figure 1

Flowchart of the proposed method

figure a

4.1 Evaluation criteria

It is important to check the pixel classification’s accuracy for multilevel segmentation. The metrics used in this paper to measure the quality of the segmented images include the peak signal-to-noise ratio (PSNR) and the structure similarity index (SSIM). These metrics are defined briefly as:

PSNR It is applied to validate the similarities among the original and segmented images using the Root Mean Square Error (RMSE) [79] of each pixel. PSNR and RMSE are represented as:

$$\begin{aligned}&PSNR=20\,{\log }_{10}\left( \frac{255}{RMSE}\right) ,\left( \mathrm {dB}\right) \end{aligned}$$
(24)
$$\begin{aligned}&RMSE=\sqrt{\frac{\sum \nolimits _{i=1}^{r_{ro}}\sum \nolimits _{j=1}^{c_{co}}\left( {I}_{og}\left( i,j\right) -{I}_{segg}\left( i,j\right) \right) ^2}{r_{ro}\times c_{co}}} \end{aligned}$$
(25)

where \(I_{og}\) is the original image, \(I_{segg}\) is the segmented image, while \(r_{ro}\) and \(c_{co}\) are the maximum numbers of rows and columns of the images, respectively.

SSIM It is another measure of the similarity among the original and segmented image [80]. It is identifiable as follows:

$$\begin{aligned} SSIM(I_{og},I_{segg})= \dfrac{(2\mu _1 \mu _{segg} + c_1)( 2\sigma _{1,segg} +c_2 )}{(\mu _I^2 + \mu _{segg}^2 + c_1)(\sigma _I^2 + \sigma _{segg}^2 +c_2)} \end{aligned}$$
(26)

where \(\mu _I\) and \(\mu _{segg}\) are the mean intensities of the original image \(I_{og}\) and the segmented image \(I_{segg}\), \(\sigma _I\) and \(\sigma _{segg}\) are the standard deviations of \(I_{og}\) and \(I_{seg}\). \(\sigma _{I_{og}, I_{segg}}\) is the covariance of \(I_{og}\) and \(I_{segg}\), and \(c_1\) and \(c_2\) are constants. Moreover, to validate the quality of threshold values, the fitness value is used.

To statistically illustrate the significance of the proposed method, the Wilcoxon rank-sum test has been utilized to determine the difference between MRFO-OBL and all other methods used in the comparison [81]. It is a nonparametric test to compare the outcomes of each pair of methods [82]. This test is based on two assumptions: (i) null assumption, which designates no difference between the ranks of a pair of algorithms extracted from the results, and (ii) alternative assumption, which affirms a discrepancy between the results’ ranks produced by a pair of algorithms. It is based on a \(5\%\) significant level. According to the P values, if \((P>0.05)\), then the null assumption is true. If \((P<0.05)\), then the alternative assumption is true.

5 Experimental results and discussion

In this section, the experiments have conducted to verify the proposed MRFO-OBL method’s performance and compare their performance with some of the state-of-the-art algorithms and the original MRFO algorithm to tackle the image segmentation problem. The experiments were conducted on a set of chest CT COVID-19 images, namely CT-image1, CT-image2, CT-image3, CT-image4, CT-image5, CT-image6, CT-image7, CT-image8, CT-image9, and CT-image10 as shown in Fig. 3. The proposed method was evaluated in terms of the fitness function, also to assess the quality of the segmented image, we used a set of performance metrics, including the PSNR and SSIM. The reminder of this section is organized as follows: Sect. 5.1 shows the dataset used in the experiments. Section 5.2 explains the environmental setup. Section 5.3 describes the experimental settings. Section 5.4 shows Otsu’s fitness, PSNR, SSIM, and Wilcoxon rank-sum test results.

5.1 Dataset description

In this paper, computed tomography (CT) images for COVID-19 from [83, 84] datasets used to test the proposed method. The CT COVID-19 dataset has 349 CT images containing clinical findings of COVID-19 from 216 patients. The COVID-19 images were collected from patients with ages ranging from 40 to 84 of both genders. Figure 2 shows case study of samples of the CT COVID-19 dataset and metadata for each sample. The proposed method evaluates ten test images from this dataset for different patients to test the proposed method’s performance. The test images are labeled as CT-image1, CT-image2, ..., CT-image10. Figure 3 displays the selected test images and their corresponding histograms.

Fig. 2
figure 2

Some images of the CT COVID-19 dataset [83] and its metadata

Fig. 3
figure 3

COVID-19 CT test images and their corresponding histograms

5.2 Experimental setup

The efficiency of the proposed method is compared to six meta-heuristic algorithms which are MFO [42], whale optimization algorithm (WOA) [85], SCA [40], slap swarm algorithm (SSA) [86], equilibrium optimization (EO) [87], and the original MRFO [43]. The COVID-19 CT images are segmented with 7, 8, 9, and 10 thresholds. Also, the proposed method’s assessment is achieved according to fitness, PSNR, and SSIM. Both algorithms have been coded and run on MATLAB R2016b on a computer running Windows 10 (64 bit), Intel Core I7, and 8 GB RAM.

5.3 Parameter settings

Table 2 presents the default parameters values of each algorithm that are applied in the experiments. As mentioned in [88], default parameter values is a fair parametrization. Moreover, employing default values reduce comparison bias risks as no algorithm could be advantaged with a better parametrization. To ensure fair benchmarking comparison, the proposed and counterparts algorithms are evaluated over 30 independent runs with a maximum number of 500 iterations for each test image, and the population size is set to 30.

Table 2 Parameter settings for MRFO-OBL and the compared algorithms

5.4 MRFO-OBL results and discussion

This subsection displays and discusses the proposed method results. The Otsu’s method in Eq. (8) has been used as an objective function. Tables 3 and 4 show the segmented COVID-19 CT images obtained from the MRFO-OBL with different numbers of thresholds nTh = 7, 8, 9, 10 outlined over histograms.

Table 3 Segmented images and threshold values acquired by the proposed method over the test images' histograms
Table 4 Segmented images and threshold values acquired by the proposed method over the test images’ histograms

Table 5 shows the gained threshold values at level 7 outlined over the CT-image3 histogram and the segmented images at the same level acquired by the compared algorithms. Table 6 shows the gained threshold values at level 9 outlined over the CT-image10 histogram and the segmented images at the same level acquired by the compared algorithms.

Table 5 Segmented image and its histograms acquired by the compared algorithms over CT-image3
Table 6 Segmented image and its histograms acquired by the compared algorithms over CT-image10

Tables 7, 8, and 9 include the mean results of fitness, PSNR, and SSIM evaluation matrices, respectively. A higher value means a more reliable and more effective algorithm. In summary, the following observation from the experiments are worth mentioning:

  • In terms of fitness values Table 7 shows the fitness values for each level in the comparison of MRFO-OBL with all other algorithms. The best values are presented in bold. Higher fitness values were achieved using the MRFO-OBL and MRFO algorithms, but one gave better results than the other for a set of test images. For CT-image6, CT-image9, and CT-image10 images, the MRFO-OBL algorithm values are the best for all or at least three levels. Moreover, for CT-image1, CT-image4, CT-image5, and CT-image8, MRFO-OBL has higher values for only two levels, while the CT-image3 image obtained only one higher value for level 9. In MRFO, the CT-image7 image acquired higher values for each level, and the CT-image2 image acquired higher values for three levels (level 8, 9, and 10). Also, for CT-image4, CT-image5, and CT-image8, the MRFO algorithm has higher fitness values at only two levels comparing with other algorithms, while for images CT-image1, CT-image3, and CT-image9 has obtained higher values at only one level. The best values were acquired for level 7 and level 8 at only three test images in the SSA algorithm. On the other hand, the EO, WOA, SCA, and MFO algorithms have not produced any best value in either image. In general, the MRFO-OBL and MRFO outperform all algorithms.

  • In terms of PSNR values Table 8 shows the algorithms’ PSNR values. It provides an estimate of the similarity between the segmented image and the original, as mentioned above, where a higher value represents better quality segmentation. Higher PSNR values were generally achieved using the MRFO-OBL and EO algorithms, but one gave improved results than the other for a set of test images. In MRFO-OBL, the PSNR obtained for the CT-image2 image gives higher values for all levels than the compared algorithms, while the CT-image3 and CT-image4 images show the best results compared to the other algorithms for all levels except level 10. Also, in CT-image1 and CT-image10, it has higher values for only two levels (level 9, level 10), and (level 8, level 9), respectively. For CT-image7 and CT-image9, the MRFO-OBL has only one higher value at level 10 and level 9, respectively. In EO, the images CT-image6, CT-image7, and CT-image9 acquired higher values for three levels, while the images CT-image1 and CT-image8 have higher values for only two levels (level 7, level 8) and (level 8, level 10), respectively. In CT-image3, CT-image4, and CT-image10, the EO has higher values than other comparable algorithms at only one level. In WOA, the CT-image5 image acquired for all levels than the compared algorithms, while in CT-image10 has only one higher value at level 10. The best PSNR values were achieved in the SSA algorithm for two levels only in the CT-image8 image. In the MRFO algorithm, the higher PSNR value is achieved only one at level 8 for image CT-image6. The MFO and SCA algorithms do not give any high PSNR results in any of the images. As a result, the highest PSNR values are generated through the MRFO-OBL and EO algorithms, displaying the most tested images’ greatest efficiency, indicating a great affiliation between the original and the segmented image.

  • In terms of SSIM values According to the SSIM values in Table 9, it was perceived that the obtained SSIM values in the MRFO-OBL are better than those all algorithms compared, implying significance in most images, particularly in the CT-image1, CT-image2, CT-image3, CT-image4, CT-image6, CT-image7, and CT-image10. In the EO algorithm, the SSIM higher values were obtained for image CT-image9, while for image CT-image5, the SSIM higher values were achieved by the WOA algorithm. The MFO algorithm has only one high SSIM value for CT-image4 image at level 10. The MRFO and SCA algorithms do not have any higher SSIM values at any test image.

Table 7 Comparison between MRFO-OBL and all other algorithms according to the fitness mean values
Table 8 Comparison between MRFO-OBL and all other algorithms according to the PSNR mean values
Table 9 Comparison between MRFO-OBL and all other algorithms according to the SSIM mean values

The following points can be observed from this analysis: Table 10 shows the Wilcoxon rank-sum test results for the best values applied on PSNR between MRFO-OBL and each counterpart. As mentioned above, according to the P values, if \((P>0.05)\), then the null assumption is true. If \((P<0.05)\), then the alternative assumption is true. To clarify the discussion of these values, the symbols ++ and − are involved. The \(++\) symbol means a significant difference at level \((P < 0.05)\), which implies MRFO-OBL performs better than the compared algorithms, while − means MRFO-OBL performance is similar or worse than the compared algorithms. According to this table, the numbers of \((P < 0.05)\) are 17 (MRFO-OBL vs. MFO), 27 (MRFO-OBL vs. WOA), 40 (MRFO-OBL vs. SCA), 31 (MRFO-OBL vs. SSA), 11 (MRFO-OBL vs. EO), and 17 (MRFO-OBL vs. MRFO), respectively. So, it is feasible to recognize that the MRFO-OBL has a significant difference from the compared algorithms.

Particularly, the major outcomes of the results reported in Table 10 are summarized as follows: the proposed MRFO-OBL method has a better quality for segmentation.

Table 10 Comparison of P values acquired by the Wilcoxon signed-rank test between the pairs of MRFO-OBL versus the counterparts for PSNR results

6 Conclusion and future work

With the spread of COVID-19 worldwide since December 2019, the entire world has moved to find techniques to help distinguish infected persons from normal ones. After many efforts and confirmation by the medical specialists, CT images could significantly identify whether the suspected patients have been infected. Various segmentation methods are applied to extract regions of interest from CT images essential to improve the classification methods. Medical image segmentation considers a crucial step for many medical applications that need to be done correctly for practical image analysis. One of the most primary and essential techniques for image segmentation is thresholding. In this paper, finding the optimum thresholding values in multilevel thresholding image segmentation was considered an optimization problem where Otsu’s method has been used as an objective function. So, a new enhanced version of the MRFO algorithm has been introduced to solve this problem. This algorithm aims to determine the best threshold values that maximize Otsu’s function. This method depends on the OBL strategy to improve MRFO’s ability to reach the optimum threshold value. The proposed method has been used for COVID-19 CT image segmentation. The performance evaluation of MRFO-OBL is evaluated using 10 COVID-19 CT images with threshold numbers nTh from 7 to 10 and compared to six meta-heuristic algorithms: MFO, WOA, SCA, SSA, EO, and the original MRFO. The proposed method’s performance has been assessed based on three measures, the best fitness values, PSNR, and SSIM metrics. The results showed that the proposed method gets good results compared to the other competed algorithms. In the future, we will extend the proposed method to test in other applications such as feature selection and color image segmentation and increase the number of thresholds to attain more reliable results. We will also hybridize the proposed method with different meta-heuristic optimization algorithms to improve the segmentation results and applied more activation functions such as Kapur entropy and Fuzzy entropy.