Abstract

Template matching is a basic and crucial process for image processing. In this paper, a hybrid method of stochastic fractal search (SFS) and lateral inhibition (LI) is proposed to solve complicated template matching problems. The proposed template matching technique is called LI-SFS. SFS is a new metaheuristic algorithm inspired by random fractals. Furthermore, lateral inhibition mechanism has been verified to have good effects on image edge extraction and image enhancement. In this work, lateral inhibition is employed for image preprocessing. LI-SFS takes both the advantages of SFS and lateral inhibition which leads to better performance. Our simulation results show that LI-SFS is more effective and robust for this template matching mission than other algorithms based on LI.

1. Introduction

Template matching is a way of getting a measure of similarity between two image sets that are superimposed on one another. It is a hot issue in the field of face recognition [1], pulmonary nodules detection [2], handwriting identification [3], and road detection [4]. Template matching techniques involve the translation of the template to every possible position in the original image and the evaluation of the match between the template and the source image at that position [5, 6].

The existing template matching techniques can be divided into two categories: the intensity-based approach and the feature-based approach [7]. The intensity-based method can be regarded as an optimization process of finding the maximum similar degree between the template and the original image. On the other hand, feature-based method matches the basis of image feature such as border, unique point, texture, entropy, and energy [8]. Compared with the feature-based method, the intensity-based method provides better performance and is widely used as it is independent of extensive feature extractions and has superior ability to restrain noise [9].

In recent years, researchers have gradually shifted their interests towards the utilization of intelligent algorithms, such as artificial bee colony (ABC) [10], internal-feedback artificial bee colony (IFABC) [11], balance-evolution artificial bee colony (BEABC) [12], states of matter search (SMS) algorithm [13], and imperialist competitive algorithm (ICA) [7] which have been proposed for this template matching problem. Although these algorithms aim to reduce the computation load of the global optimums searching, none of them can completely guarantee the derivation of suboptimal matching results. It is important to note that most intelligent algorithms are generally suitable for the optimization of convex or nearly convex functions [11, 12]. However, the template matching field contains a finite number of feasible matching locations. Such a discrete function is not smooth, but extremely ill-conditioned actually. In other words, the solution surface may drastically oscillate along the domain, which critically restricts the advantages of such intelligent algorithms. Therefore, it needs a new way to modify these existing intelligent algorithms in order to accommodate the discreteness and oscillation in the objective function.

In our paper, we utilize a recently proposed SFS, which was inspired by random fractals. SFS was firstly proposed by Salimi [14] who used such algorithm to solve the continuous optimization problems. By using the diffusion phenomenon that reveals fractals, SFS offers a new insight to solve complex optimization problems with fast convergence rate and high search accuracy. Because of these merits, SFS is attracting more and more attention and it has been successfully used for frame structure optimization problems [15, 16], target recognition [17], precise trajectory optimization [18], distributed database queries optimization [19], and so on.

Moreover, LI approach is utilized to preprocess the original and template images before using SFS for matching. The hybrid method is named LI-SFS. Lateral inhibition mechanism is firstly discovered and verified by Hartline and his research group when they conducted an electrophysiology experiment on the limulus’ vision [20]. This mechanism, which provides great help to detect object in cluttered background, can enhance the contrast of sensory information and reduce low-frequency noises [10]. Experimental results confirm that SFS is more capable than several intelligent algorithms such as IFABC [11], BEABC [12], SMS [13], and ICA [7] in this LI-based template matching scheme. The rest of the paper is structured as follows.

Section 2 discusses the principles of SFS. Section 3 describes lateral inhibition mechanism. Section 4 details the implementation procedures of the hybrid method LI-SFS. Then, several cases of comparative experiments have been conducted in Section 5. Finally, Section 6 concludes the study and advises some directions for future studies.

2. The Basic Principle of SFS

SFS [14] algorithm is a new metaheuristic optimization method, which is proposed by Salimi and inspired by random fractals. Two main processes to perform the SFS are the diffusion process and the update process. In the first process, each particle diffuses around to current position so as to ensure exploitation ability. With this process the chances of achieving global optimal increase and being trapped in local optimal is prevented. For SFS we consider a static diffusion process that means that only the best particle generated from diffusion process is considered, and the rest of the particles are discarded. Moreover, SFS utilizes some random update processes that results in exploration properties. To generate new particles from the diffusion procedure, a statistical method called Gaussian walk is applied, which is more promising in finding global optimal solution. A series of Gaussian walks proceeding in diffusion process is as follows:where and are uniformly distributed random numbers restricted to , is the position of the best point, and is the th point in the group. are Gaussian parameters where is exactly equal to ; also is equal to . The standard deviation is shown as follows:In order to encourage a more localized search as individuals and get closer to the solution, in (3) is used for decreasing the size of Gaussian jumps with the increase of the number of generations.

Assume that our optimization problem is dimensional problem; thus each individual particle is based on dimensional vector. In time of initialization, each particle is initialized randomly on the basis of problem constraints. In our problem each individual particle is a vector whose length is equal to 2; namely, . Initialization equation of th point, , is addressed as follows:where and are the lower and the upper bounds of problem constrained vectors, respectively.

After initialization, the fitness function of each point is calculated to obtain the best point . In accordance with exploitation ability in the diffusion process, all the points roam around their current position to exploit problem search space. In addition, two statistical procedures are considered to increase the better space exploration. The first statistical method is applied to each individual vector index, while the second method performs on all points. In the first statistical procedure, at first, we sort all the points based on the fitness value of each individual. Each point in the group is then assigned a probability through the following formula:where is regarded as the rank of point among the other points in the group and is the number of all points in the group. According to this approach described in (5), the individual with a higher rank will have a larger probability to be selected.

Equation (5) serves two main functions. The first is used to increase the chance of changing the position of points that have not obtained a good solution. In the second generation, the good solutions will increase. For each point in group, if , the jth component of is updated using (6); otherwise it remains invariant. where is the new modified position of , and are random selected points in the group, and is a random number in .

The first update statistical procedure is carried out on the components of the points, while the second statistical update is applied in which the position of a point is changed considering the position of other points in the group. Through this property, the quality of exploration is improved and diversification property is satisfied. Before performing the second procedure, all points attained from the first update process are ranked according to (5). In the same manner as the first statistical procedure, if for a new point , the present position of is changed according to (7) and (8) as follows; otherwise there is no update.where and are random points selected from the first procedure and are generated by the Gaussian normal distribution. The new point is replaced by if its fitness function value is better than . A more detailed description of SFS method can be found in [14].

The standard SFS can be shown in Algorithm 1.

Initialize a population of points
While   < maximum generation  Do
  For  each Point in the system  Do
    Call Diffusion Process with the following process:
       = (maximum considered number of diffusion).
     For   to   Do
      If  (user uses Gaussian walk to solve the problem)
       Create a new point based on Eq. (1).
      Else  (user uses another Gaussian Walks to solve the problem)
      Create a new point based on Eq. (2).
  Call Updating Process with the following process
    First Updating Process:
    First, all points are ranked based on Eq. (5).
    For  each Point in the system  Do
     For  each component in   Do
      If  ()
       Update the component in based on Eq. (6).
      Else
       Do nothing.
    Second Updating Process:
    Once again, all points obtained by the first update Process are ranked based on Eq. (5).
    For  each new point in the system  Do
      If  ()
       Update the position based on Eqs. (7).
      Else
       Do nothing.

3. Lateral Inhibition Mechanism

Hartline et al. found that every microphthalmia of limulus’ ommateum is regarded as a receptor that is restricted by its adjacent receptors, and the inhibited effect is mutual and spatially summed [9]. The nearer the receptors are close to each other, the stronger the inhibited effect is.

In retinal images, intensively excited receptors in illuminatingly light area inhibit those in dark area more strongly than the latter to the former [21]. Therefore, lateral inhibition effectively increases the contrast and the distortion of sensory information. By this means, the important information of the image, namely, the edge of image including the intensity gradient in retinal image and the important characters of vision scene, is strongly strengthened. In this paper, we apply the mechanism to preprocess the template and the original images in order to improve the spatial resolution and increase the efficiency and accuracy of the template matching.

The classical lateral inhibition model is shown as follows:

In order to apply this mechanism to image processing, the model is modified into a two-dimensional and gray form. Gray value of the pixel in image is expressed with the following equation:where is the lateral inhibition coefficient of the pixel to the central pixel, represents the original gray value of pixel , and is the gray value of pixel after being processed by lateral inhibition. A schematic instance of such a receptive field under the condition that is shown in Figure 1.

In this paper, for the convenience of analysis, it is set to . Recalling (9) yieldswhere and , respectively, denote location sets of the surrounding 16 and 8 pixels as shown in Figure 1. Because there is no expectation whether or not when , it is unbiasedly expected that which implies balanced inhibition energy. So, Therefore, in order to ensure an unbiased preprocessing result, a natural constraint on lateral inhibition coefficients is satisfied as follows.

Some parameters of LI model are set following the similar works reported in [7, 9, 10]. In detail, and the matrix that contains lateral inhibition coefficients are set as follows:

The modulus template is combined with and then a new gray scale of the image is obtained. Finally, the image’s edge is extracted by the following equation.where is a user-defined threshold value according to practical situations and is the final obtained gray value of pixel .

4. Hybrid SFS and Lateral Inhibition

4.1. Template Matching Principle and the Fitness Function of LI-SFS

Image template matching aims to concern about locating a given template image over an original image, so that they can best match each other. In this section, the template matching is converted to a numerical optimization problem, during which the lateral inhibition mechanism is implemented to promote the subsequent matching process. It is generally assumed that the predefined template image and original image are given in RGB format. Figure 2 shows how a template image is overlapped onto an original image at a candidate location . The template matching scheme can be expressed as finding an optimal location for the gray template image so that the similarity between template and original image is maximized within the feasible searching region.

In Figure 2, the pink box denotes original image (); the small blue box represents template image (). The red dotted lines surround the searching region where all feasible solutions exist. The template image is shifted across the original image by an offset by using the origins of the two images as reference points. The dimensions of the original image () and the template image () determine the maximal feasible searching region for the comparison.

In this paper, the proposed LI-SFS is introduced to conduct the searching task. The fitness function is defined to calculate the fitness of every agent according to different situations and real practices. Template matching based on gray cross-correlation measurement has strong ability to suppress noise and the performance of simple calculation, while it is time-consuming [22]. Our work follows the custom of criterion selection as in [22, 23]; the fitness value of template matching is shown in Algorithm 2.

Begin
 For
  For
   If then
    
   End If
  End For
 End For
End

increases by 1 only when , where is the similar degree between the template and the pattern whose starting point is pixel in the original image. So the maximum denotes the best solution of the template matching problem. The similarity measurement can reduce the calculation time and is easy to program. and , respectively, represent the coordinates of the pixel in the original image and the template image. and are the gray values of pixel and pixel processed by (15). The scope of the coordinates in the original image for matching is and .

Therefore, we define in our experiments.

4.2. The Procedure of LI-SFS

The proposed LI-SFS absorbs the efficiency of SFS and the accuracy of lateral inhibition mechanism. The main procedures of the LI-SFS are given as follows.

Step 1 (image preprocessing). We obtain the original image and the template image and transform both of them into gray scale format. Then, we filter images to suppress noises and apply lateral inhibition mechanism to preprocess these images according to (10)–(15) and save the new matrixes of images.

Step 2 (initialize the LI-SFS parameters). We initialize the size of the population , the dimension of the problem , and the maximum function evolution number (MaxFEs) which is defined to terminate the process. In this paper, is defined as two, that is, the dimension of images.

Step 3 (diffusion process). In this step the maximum diffusion number in SFS algorithm is set to 1.

Step 4 (Gaussian walk method). Note here that in this step we apply the first Gaussian walk to solve the problem. By using this Gaussian walk method to solve the problem, the new position of search agent is defined.

Step 5 (updating process). In this step the position of search agents is updated. In starting stage all search agents are ranked as per their optimum position. After that, using two updating processes, the best search agent is identified. These search agents are given the optimum location of particles.

5. Experimental Results

In this section, we verify the performance of our proposed algorithm through a series of comparative experiments with those produced by the IFABC method [11], BEABC method [12], SMS method [13], and ICA method [7]. Simulations have been executed across seven images 1–7 that are shown in Figures 39, respectively. All the simulations were carried out in a Matlab R2012a environment and executed on a 4-core Intel Core i5-4590 CPU with 4 GB RAM running at GHz under Windows 7 operating system. In this work, all images are from Google Earth®.

In this test, the population size is set to 100. The maximum function evolution numbers (MaxFEs) are set to 300. Such a standard of stopping has been carefully selected to assure compatibility between similar works reported in the literature [8, 13].

Initial parameters for each algorithm that is used in the comparison are listed as follows.

(1) LI-IFABC. The parameters are set to and .

(2) LI-BEABC. The parameters are set to .

(3) LI-SMS. The parameters are set in gas and ; in liquid and ; in solid and .

(4) LI-ICA. The parameters are set to NumOfCountries = 100, NumOfImper = 10, and NumOfColony = 90.

(5) LI-SFS. The algorithm has been configured by using maximum diffusion number .

The threshold for image edge extracting was set to . These experiments are designed to successfully match the template image to the original image. The coordinate of the template image fixed in the original image determines the success of matching. The experimental results are listed in Table 1. The results are averaged over 50 independent runs, and the best results are denoted in bold type. The comparisons are analyzed considering four performance indexes: the average (Avg), the converged iteration, the correct rate, and the average CPU Time. The average indicates the mean fitness value. The converged iteration exhibits the times of iterations that have been visited during a single experiment. The correct rate represents the number of executions in percentage for which the algorithm successfully locates the optimal detection point. The average CPU Time indicates the time in seconds which is employed during the execution of each single experiment. All these performance indexes are averaged considering a determined number of executions, aiming to assure statistical consistency.

To improve the performance evaluation of evolutionary algorithms, statistical tests should be conducted [24]. In order to determine whether the results of LI-SFS differ from the best results of other algorithms in a statistical method, a nonparametric test which is known as Wilcoxon’s rank-sum test [25, 26] is performed at 5% significance level. The calculated values in Wilcoxon’s rank-sum test comparing LI-SFS and other algorithms over all the simulation cases are given in Table 2. In Table 2, N/A indicates “not applicable” which means the statistical test cannot be done because both algorithms found the optimum successfully in all the runs. Usually, values < 0.05 can be considered as sufficient evidence against the null hypothesis.

Table 1 shows the results for all images. As can be seen in this table, the LI-SFS outperforms the other algorithms on images 1-2 and images 4–7 in terms of the Avg, converged iteration, and correct rate. For image 3, it turns out that the converged iteration of LI-SFS is 67, while LI-IFABC is 106, LI-BEABC is 94, LI-SMS is 291, and LI-ICA is 133, apparently showing that the proposed LI-SFS has the fastest convergence. From image 3, we see that, on Avg and correct rate, LI-BEABC and LI-SFS are well capable of providing the best values. From above analyses about images 1–7, we can conclude that the proposed LI-SFS demonstrates superiority in solving template matching optimization problem.

In addition, LI-SFS usually consumes less time than the other algorithms. This is because LI-SFS neither adds complicated outside-world strategy nor changes the conventional algorithm framework.

According to the values in Table 2, LI-SFS achieves significant improvement in images 1, 2, 4, and 6 compared to other algorithms. For images 3, 5, and 7, the values show that the results of LI-SFS are significantly better in three out of four groups. Therefore, this is evidence that LI-SFS results are statistically significant and that it has not occurred by coincidence.

The results of the experiment with the original images shown in Figures 3(a)9(a) and the template images shown in Figures 3(b)9(b) are given. Original and template images processed by the lateral inhibition are shown in Figures 3(c)9(c) and Figures 3(d)9(d), respectively. It is obvious that the edges of these images are enhanced. So we can say that lateral inhibition has the ability to enhance the characters of image, which can improve the success rate of template matching. Figures 3(e)9(e) illustrate matching results for all images. From the matching results, it is clear that LI-SFS method can successfully find the precise location of the template fixed in the original image. Further experiments are given in Figures 3(f)9(f) to investigate the advantage of LI-SFS.

Figures 3(f)9(f) illustrate the averaged evolution curves of all algorithms dealing with all images over 50 independent runs. As can be seen from Figures 4(f) and 6(f)9(f), the LI-SFS has the fastest convergence rate. Through carefully looking at Figures 3(f) and 5(f), LI-ICA has a fast convergence initially towards the known maximum; however, it is outperformed by LI-SFS after 50 generations and 60 generations, respectively. As the procedure proceeds, LI-SFS gets closer and closer to the maximum, when the Li-ICA becomes premature and trapped into local maximum.

According to this comprehensive study, the superior exploration and local maxima avoidance of SFS are able to solve complicated template matching problem efficiently and accurately under different environments.

6. Conclusions and Future Works

Template matching is a fundamental and important problem in pattern recognition, image analysis, and computer vision. The central problem in template matching is to determine an efficient and effective approach to characterize image features and measure the degree of similarity between two images. In this work, the innovation of our approach rests with applying SFS to dispose the LI-based template matching problem. Experimental results clearly demonstrate the efficiency of SFS in comparison with other intelligent algorithms involved in this work.

Moreover, theoretical analyses have proved that it is necessary for using LI model in template matching [12]. Such a preprocessing procedure is theoretically inefficient or misleading when the original reference image suffers from two kinds of nonuniform illumination changes. In particular, when a reference image is distorted by Gaussian noise, LI model will make the situation even worse.

Our future work will focus on adopting SFS to deal with more complicated applications in the field of aeronautics and astronautics. Besides that, we will pay more attention to theoretical analyses in order to thoroughly reveal the advantages/disadvantages of LI model in template matching problem.

Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.

Acknowledgments

This work is supported by Innovation Project of Guangxi Graduate Education under Grant no. gxun-chxzs2016100, National Science Foundation of China under Grants nos. 61463007 and 61563008, and the Guangxi Natural Science Foundation under Grant no. 2016GXNSFAA380264.