Keywords

1 Introduction

Image segmentation is critical for the digital image processing, and is the first step to analyze image [1]. The quality of image segmentation directly affects the effect of the subsequent processing of image processing. The current methods of image segmentation mainly include threshold method, edge test [2], region growing method [3], morphology watershed method, and etc.

Image threshold segmentation is an important segmentation technology [4]. The basic idea regards the image as two parts: the object and background, using the gray value difference between the object and background, select a suitable gray value as a threshold, for each pixel in the image by gray value attributable to the object and the background of two parts.

Based on the maximum class square error method, Otsu proposes an algorithm to calculate the single threshold. Not related to the specific content of the image but based on pixel gray level statistics, So it has stronger robustness, and has been applied in many fields, such as medical [5], infrared image [6] and so on. Single threshold Otsu method only considers the gray information of the image, but does not take into account the spatial position of the pixels, the image segmentation effect is not obvious in double peak image. In 1979, a two-dimensional segmentation method was proposed, which became a hot issue in the study [7, 8]. As the single threshold is extended to multi-threshold, due to the increase of the dimension, the traversing method to select threshold is larger, and the computation complexity increases exponentially. Then how to efficiently calculating the optimal threshold value becomes the key of the algorithm. Swarm intelligence evolution algorithm is introduced to find the optimal threshold, such as the genetic algorithms [9], particle swarm optimization algorithm [10], and etc.

But for intelligent algorithms, the efficiency of the algorithm mostly depends on the configuration parameters and the initial solution. At the same time, intelligent algorithm is easy to fall into local optimum, and thus can not find the global optimal solution. Many scholars had done related work [11, 12] to improve the algorithm. Membrane Computing is a novel distributed parallel computing model. It is a abstract computational model based on the most basic unit of life cells, and first formally proposed by the European Academy of Sciences Gheorghe Păun in his research report at Turku computer center [13]. Since then, many scholars began to engage in related research [26,27,28,29] [30].

The purpose of membrane computing is to abstract a new calculation model from cells, particularly in the cell membrane, with its structure and function, called a membrane system [19, 20]. Membrane computing includes the three elements: membrane structures, objects and evolution of the rules [14, 21]. The object of tissue-like P systems is the mechanism in which multiple cells that each cell can have its own objects and evolutionary rules, through mutual cooperation and communication with each other, together to complete the calculation. This parallel multiple evolutionary mechanism provides a feasible solution to solve the problem: convergence to local optimal due to lack of population diversity. There is a wide range of applications, such as the gradient edge detection [15], multimodal image registration [16], coal sorting robots [17]and so on. There are some works [23,24,25,26,27] on evolutionary optimization.

2 Principle of Threshold Images Segmentation

For a digital image, the variance is a measure of the uniformity of the gray level distribution. Bigger the variance is, more evident the difference between the various parts of the image is. It means that in the image segmentation, as part of the target is divided into background or part of the background wrong into target, this will lead to the two part of the difference is smaller, so the maximum variance in image segmentation means that the probability of fault points minimum. Based on the principle, a threshold image segmentation algorithm is proposed by Otus. In later studies, to consider both grey value and the corresponding spatial location relationship, two-dimensional threshold image segmentation algorithm is proposed.

For a digital image with size \(M * N\), for each pixel, its pixel gray value and neighborhood gray value are L, define a binary array (ij), of which i is the pixel gray value, j is the average gray value of corresponding \((3 * 3)\) neighborhood; \(n_{ij}\) is the number of the pixel which have the same binary array (ij).

The relative probability is:

$$\begin{aligned} p _{i,j}= \frac{n_{i,j}}{M\cdot N}; \end{aligned}$$
(1)

Assume that the object and background as \(I_{0}\) and \(I_{1}\), s is the threshold of pixel gray value and t is the gray value threshold of neighborhood.

Two classes of the probability are:

$$\begin{aligned} P_{0}(s,t)= \sum _{i=1}^s\sum _{j=1}^t P_{i,j} \end{aligned}$$
(2)
$$\begin{aligned} P_{1}(s,t)= \sum _{i=s+1}^L\sum _{j=t+1}^L P_{i,j} \end{aligned}$$
(3)

Two classes of the corresponding mean vector are:

$$\begin{aligned} \mu _{0}= (\mu _{0i}\,\,\, \mu _{0j} )^{T} = ( \sum _{i=1}^s\sum _{j=1}^t \frac{i\cdot P_{i,j}}{P_{0}} \sum _{i=1}^s\sum _{j=1}^t \frac{j\cdot P_{i,j}}{P_{0}} )^{T} \end{aligned}$$
(4)
$$\begin{aligned} \mu _{1}= (\mu _{1i} \,\,\, \mu _{1j} )^{T} = ( \sum _{i=1}^L\sum _{j=1}^L \frac{i\cdot P_{i,j}}{P_{1}} \sum _{i=1}^L\sum _{j=1}^L \frac{j\cdot P_{i,j}}{P_{1}} )^{T} \end{aligned}$$
(5)

The population mean vector is

$$\begin{aligned} mu_{T}= (\mu _{Ti} \,\,\, \mu _{Tj} )^{T} = ( \sum _{i=1}^L\sum _{j=1}^L i\cdot P_{i,j} \sum _{i=1}^L\sum _{j=1}^L j\cdot P_{i,j} )^{T} \end{aligned}$$
(6)

Ignoring the influence of noise and other, we can do the assumptions as the following:

$$\begin{aligned} P_{0}+P_{1} \approx 1, \mu \approx P_{0}\mu _{0}+P_{1}\mu _{1} \end{aligned}$$
(7)

Use the trace of matrix Sb(s,t) as the discrete degree measure, then

$$\begin{aligned} R = P _{0} [ ( \mu _{0i}- \mu _{Ti} )^2 + (\mu _{0j}-\mu _{Tj} )^2] +P _{1} [ (\mu _{1i}-\mu _{Ti} )^2 + (\mu _{1j}-\mu _{Tj} )^2] \end{aligned}$$
(8)

So the best optional threshold value (s, t) should meet the following equation:

$$\begin{aligned} (s^{*},t^{*}) = arg \max \limits _{1\le s,t\le L} (R) \end{aligned}$$
(9)

How to ascertain the optimal threshold is the key for the algorithm. Due to the adoption of the two-dimensional data, the calculation amount and difficulty are increased. How to solve the large data optimization, based on membrane computing framework we proposed a hybrid evolutionary mechanism of two-dimensional segmentation algorithm. Using membrane parallel evolution and exchange of information, this work maintains the diversity algorithm object, and overcomes the algorithm falling into a local optimum.

3 Threshold Segmentation Membrane Algorithm

The 3-degree tissue-link membrane system is defined as [17, 21, 22]:

$$\begin{aligned} \prod = (O,\sigma _{1},\sigma _{2},\sigma _{3},syn,i_{0} ); \end{aligned}$$

Therein to,

  1. (1)

    O is a finite non-empty alphabet, and its elements is the object of membrane system, in this paper the object indicates the image grey value corresponding to the binary code set.

  2. (2)

    \(\sigma _{i}\) shows the ith cell as follows: \(\sigma _{i}\) = (\(Q_{i}\), \(R_{i}\)), \(Q _{i}\) shows the object of ith cell. \( R_{i}\) expresses the evolution rules, evolution rule of cell \(\sigma _{1}, \sigma _{2} \) is the particle swarm algorithm, and evolution rule of cell \(\sigma _{3}\) is the genetic algorithm.

  3. (3)

    Syn indicates the connections between cells, and this cells can communicate. Between three cells can be two-way information transmission, which form a network structure.

  4. (4)

    \( i_{0}\) shows the output cell label. Here \(i_{0}=0\), that means cells will send optimal solution to the environment.

  5. (5)

    System input is the parameters and initial solution configuration for various evolutionary algorithm; System downtime rule is to meet the maximum number of iterations; System output is the global optimal solution to the environment.

3.1 Object of the Tissue-Link Membrane System

The tissue-link P system is to solve the given optimization, so all the objects of the membrane system is feasible solution set. Considering the characteristics of digital image grey value, all objects in this work use binary coding.

Assume that the object number in the whole system is N, and the dimension of each solution is D, all objects in the cells constitute a \(N * D \) matrix:

$$\begin{aligned} \left( \begin{array}{cccc} pop_{11} &{} pop_{12} &{}\cdots &{} pop_{1D}\\ pop_{21} &{} pop_{22} &{}\cdots &{} pop_{2D}\\ \cdots &{} \cdots &{}\cdots &{} \cdots \\ pop_{N1} &{} pop_{N2} &{}\cdots &{} pop_{ND}\\ \end{array} \right) \end{aligned}$$

All objects are averagely assigned to three membranes. Membrane 1, 2 as the auxiliary membrane, is to increase the diversity of population; Membrane 3 as the main membrane, focuses on the local optimization. For each object, the relative object function value is its fitness value. In the iterative process, the optimal solution of whole system was sent to environment, called the global optimal, denoted as \(Z_{best}\).

3.2 Hybrid Evolutionary Rule and Communication Rules

Three membranes with intelligent optimization rules, due to their respective different purposes, are different in specific evolutionary rules. The main function of auxiliary membrane is used to keep the diversity of population, and expand the search space, then reduce the probability that fall into local optimum, and improve the ability of global optimization. The particle swarm algorithm is simple and can be quick calculated. Therefore parameter configuration can be used to expand the search space so as to maintain the population diversity. The main function of main membrane focuses on the strong local search ability, and this can effectively solve the optimal solution in the space.

Genetic algorithm has the strong optimal ability, through the parameter configuration, we can strengthen its local optimization ability. Through information exchange between the main membrane and the auxiliary membrane, the advantages of different algorithms are played, and the efficiency of the system can be great optimized by using the hybrid evolution rules.

The evolution rules of the membrane 1: The global PSO. The global particle swarm optimal intelligence algorithm is used as evolution rules of membrane 1. In the particle location update formula, as C1 = 0, the particles have not the cognitive ability, and become only a social model, called global PSO algorithm. The particle has the ability to expand the search space, and has the greatest protection for the whole population diversity.

Location update function is shown as follows:

$$\begin{aligned} \ V_{k+1} = c_{2}r_{2}(G_{best}-X_{k}) \; \end{aligned}$$
(10)
$$\begin{aligned} \ sig(V_{k})= \frac{1}{1+exp(-V_{k})} \; \end{aligned}$$
(11)
$$\begin{aligned} X_{k+1}=\left\{ \begin{array}{rcl} 0 &{} \,\, { sig(V_{k})< rand }\\ 1 &{} \,\, { sig(V_{k})\ge rand } \end{array} \right. \end{aligned}$$
(12)

Therein to, \(c_{2}\) is learning factor, and \(r_{2}\) is random number. \(G_{best}\) is the current optimal location of the global, \(X_{k}\) is the kth iterations of the particle position, \(V_{k}\) is the kth iterations of the particle velocity. After each iteration of the fixed number, Membrane 1 output to the membrane 3 T of the best particle, to the membrane 2 output T of the suboptimal particle. To ensure that the same size of the particles, before the next iteration, through the roulette way to select fixed particles into the next iteration.

The evolution rules of the membrane 2: PSO with inertia weight. At the international conference on evolutionary computation, some researchers corrected the basic location and velocity formula in 1998. Inertia weighting factor had been introduced. The value of inertia weighting factor is bigger, then global optimization capability is stronger, as well as local optimization ability weaker, and vice versa.

The 2th Membrane mainly give the diversity of particles to the main Membrane, so the weight sets up by using linear growth, then enhance global optimization ability, and consider the global optimal solution. The new formula of velocity is given as follows:

$$\begin{aligned} \ V_{k+1} = \omega \cdot V_{k}+ c_{1}r_{1}(P_{best}-X_{k})+c_{2}r_{2}(G_{best}-X_{k}) \; \end{aligned}$$
(13)
$$\begin{aligned} \ \omega = \omega _{ win } + n\cdot (\frac{\omega _{ max }- \omega _{ win }}{N} ) \; \end{aligned}$$
(14)

Particles location update formula same as membrane 1. After each iteration of the fixed number, membrane 2 give the number T of the optimal particle to the membrane 3, and give the number T of the suboptimal particle to the membrane 2. To ensure that the same size of the particles, before the next iteration, through the roulette way to select fixed particles into the next iteration.

The evolution rules of the membrane 3: The Standard GA. The rule of Membrane 3 is standard genetic algorithm: elite strategy choice, two-point crossover and random mutation. After each iteration of the fixed number, it accept 2T object from the auxiliary membrane, and with the original object which constitute a set of selected object. Keep the best T objects, and select the rest of the object through the form of the roulette wheel based on fitness values. So it can not only retain the best object of the whole system, but also keep the diversity of the population under large probability.

4 Experiment Analysis

4.1 Data Sets Used in the Experiments

The paper uses 3 typical images to carry out the experiment. Digital image corresponding to the experiment and the relative data characteristics are shown below (Table 1) (Fig. 1).

Table 1. Data sets used in the experiments
Fig. 1.
figure 1

There experiment images

4.2 Parameter Configuration in Experiments

The parameter configuration are as follows: each membrane has 50 objects, the largest number of iterations is 300; Membrane 1 uses the global particle swarm optional algorithm, C1 = 2; Membrane 2 use the global particle swarm optional algorithm, C1 = C2 = 2; The crossover probability and mutation probability of the genetic algorithm is \(p_{c}\) = 0.8 and \(p_{m}\) = 0.003. Each iteration 5 times, an information communication is active.

4.3 Algorithm Analysis and Comparison

In order to evaluate the characteristics of the algorithm, the two kinds of measure factors used in this work are the diversity and convergence. Population diversity is mainly used to evaluate the individuals difference degree, in the iteration of the algorithm, the diversity of population is important for preventing the algorithm from falling into local optimum.

Based on the Statistical diffusion theory, the function used to measure the particle diversity is [18].

$$\begin{aligned} \ D_{bc}=\frac{1}{n-1}( \frac{\sum _{i}S_{i}^{2}}{L}-\frac{s^2}{L\cdot n}) \; \end{aligned}$$
(15)

Therein to, n is the population number, L is the dimension of the particles; \(S_{i}\) is the number of 1 in the binary digits for the ith particle; S is the number of 1 for all particles in the binary. \(D_{bc}\) relative change rate reflect species diversity change rate.

Convergence is one of the important factors that determines the algorithm performance. In this paper, we use the best individual fitness and the average individual fitness to test and analyze the convergence of the algorithm. The defines are respectively given as follows:

$$\begin{aligned} \ C_{fb}= max(f_{i}(x)) (i=1,2,\cdots , n) \; \end{aligned}$$
(16)
$$\begin{aligned} \ C_{fa}= \frac{\sum _{i=1}^n f_{i}(x)}{n} \; \end{aligned}$$
(17)

The numerical change shows the capabilities of exploration and development (Fig. 2).

Fig. 2.
figure 2

The segmentation image

5 Conclusion

Focused on the contradiction between selective pressure and population diversity in the optimization algorithm, using hybrid evolutionary mechanisms, this paper proposes a membrane image threshold segmentation algorithm based on the idea of membrane computing. The proposal uses a hybrid tissue P system consisting of OLMS membranes in which GA and PSO are used as evolution operator. The proposed algorithm uses the communication rules and transfer rules to establish the interactions among the membranes, and then enhances the diversity of population in the system and improves the convergence of the algorithm. After comparing with the conventional methods, simulation results and dynamic behavior analysis show that the proposal evidently improve the validity and feasibility of the image segmentation algorithm.

There are several further problems which deserve be considered. An interesting and important research line is how to proved the advantage of the membrane computing than others.