1 Introduction

Image matching is a popular research area in pattern recognition, image analysis, remote sensing and computer vision. The purpose of the image matching is to convert the template image to a position in the original image and evaluate the match between the template image and the original image by maximizing the similarity measure of the two images. That is, image matching is a technique that determines the small regions of an image that match another image. The existing image matching methods mainly include the following: intensity-based methods and feature-based methods [31, 32]. Intensity-based methods match the position in the original image by moving the template image and maximize the similarity between the matching image and the original image. Feature-based methods use certain features, such as edges, contours, textures, entropy, energy, color and corners, as the basic unit of the image for matching. Computer vision and image matching technology are closely related. Unmanned underwater vehicles (UUVs) with vision systems have been widely used to collect underwater image information and perform data processing and analysis for image information [15, 24, 26, 28]. The three-dimensional model of a UUV equipped with a vision system is given in Fig. 1. Underwater image matching is not only the premise and foundation of image processing and machine vision but also an important operation for feature extraction, recognition and target tracking. The purpose of underwater image matching is to match the relevant position in the original image according to the template image, and the matching accuracy and matching success rate are used as important criteria. Whether the feature extraction and matching of binocular images taken underwater can be performed quickly and accurately becomes the core and difficulty of the research. Therefore, underwater image matching is one of the important research topics. Recently, many optimization algorithms have been proposed to solve the image matching problem, such as the bat algorithm (BA) [29], biogeography-based optimization (BBO) [21], the imperialist competitive algorithm (ICA) [11], particle swarm optimization (PSO) [13], the sine cosine algorithm (SCA) [18], the spotted hyena optimizer (SHO) [8], and states of matter search (SMS) [7].

Fig. 1
figure 1

Three-dimensional model equipped with a vision system

Yang et al. proposed an image matching algorithm based on a convolutional neural network to aid in AUV navigation, and the feasibility and veracity have been verified [30]. Chen et al. present a novel feature descriptor for visible and infrared image matching based on log-Gabor filters, and the result was that the method was effective [6]. Bürgmann et al. demonstrated a deep learning approach to solve the matching of terra SAR-X derived ground control points to optical image patches, and automatically and reliably obtained matches with pixel-level localization accuracy [5]. Yan et al. proposed a hybrid matching algorithm of QPSO and gray relational analysis to solve vision-guided AUV docking, and the results showed that the proposed algorithm gained the best matching position [27]. Dou et al. conducted a robust image matching algorithm based on the wavelet transform and scale-invariant feature transform, and the results showed that the proposed algorithm improved the matching accuracy [9]. Xu et al. present real-time stall detection of a centrifugal fan based on symmetrized dot pattern analysis and image matching, and the results showed that the proposed algorithm can meet the need for timely and accurately rotating stall detection of a centrifugal fan [25]. Wu et al. developed a robust and efficient multisource image matching method based on the beat-buddies similarity measure, and the results showed that the method can achieve higher computational efficiency and better matching performance [23]. Sun et al. proposed underwater image matching with efficient refractive-geometry estimation in glass-flume experiments, and the results demonstrated that the proposed method was effective and significantly improved the underwater image matching accuracy [20]. Jung applied the k-center algorithm to solve hierarchical binary template matching, and the results showed that the algorithm obtained better detection and strong stability [12]. Luo et al. present a hybrid spotted hyena optimizer based on lateral inhibition to solve image matching, and the results indicated that the proposed algorithm is more effective and feasible than other algorithms [17]. Abualigah designed a feature selection and enhanced krill herd algorithm to solve text document clustering, and the experimental results showed that the method was effective and feasible [1]. Abualigah et al. applied the improved krill herd algorithm for the text clustering, and the results showed that the proposed method obtained promising and precise results [2]. Abualigah et al. proposed a new feature selection method based on the particle swarm optimization algorithm to improve document clustering, and the results showed that the proposed method enhanced the effectiveness of the text clustering technique [3].

The whale optimization algorithm (WOA) [19] is inspired by the bubble-net hunting strategy, which simulates encircling prey, the bubble-net strategy and the search for prey to obtain the global optimal solution. The WOA has high calculation accuracy and strong robustness. The Lévy flight strategy [4] improves the exploration ability of the WOA. The lateral inhibition is effective for solving image enhancement and edge extraction [14]. The proposed algorithm is applied to solve the underwater image matching problem, which can effectively balance the global search ability and the local search ability to avoid falling into the local optimum. Ten underwater images are used to verify the effectiveness and feasibility of the proposed algorithm. The experimental results show that the overall optimization performance of the proposed algorithm is superior to those other algorithms. Meanwhile, the proposed algorithm has higher matching accuracy and stronger robustness. This research work will lay a solid foundation for pattern recognition and image analysis.

The remainder of this article is divided into following sections: Section 2 discusses the basic principle of the whale optimization algorithm. Section 3 describes the Lévy flight strategy whale optimization algorithm. Section 4 details the lateral inhibition mechanism. Section 5 presents the hybrid LWOA and lateral inhibition. The experimental results and analysis are conducted in Section 6. The results and discussions are provided in Section 7. Finally, conclusions and future research are given in Section 8.

2 The basic principle of the whale optimization algorithm

Taking inspiration from the bubble-net hunting strategy for global optimization, the whale optimization algorithm is a novel nature-inspired meta-heuristic optimization algorithm that mimics the social behavior of humpback whales including encircling prey, the bubble-net attacking strategy and the search for prey to effectively search in the solution space [19]. When finding prey, the humpback whales first gradually shrink the area in a conical logarithmic spiral motion around the prey and swim towards the prey. Finally, the prey is captured within a certain range. The model of bubble-net feeding behavior is given in Fig. 2.

Fig. 2
figure 2

Bubble-net feeding behavior of humpback whales

2.1 Encircling prey

Humpback whales can quickly surround prey after finding prey and continuously update the position. The best hunting position of the humpback whales is the location of the target prey or close to the best target prey. The location update is expressed as follows:

$$ \overrightarrow{D}=\left|\overrightarrow{C}\cdotp \overrightarrow{X^{\ast }}(t)-\overrightarrow{X}(t)\right| $$
(1)
$$ \overrightarrow{X}\left(t+1\right)=\overrightarrow{X^{\ast }}(t)-\overrightarrow{A}\cdotp \overrightarrow{D} $$
(2)

where t denotes the current iteration, X denotes the position vector of the optimal solution, X denotes the current position vector, || denotes the absolute value, and ⋅ denotes element-wise multiplication. \( \overrightarrow{A} \) and \( \overrightarrow{C} \) denote coefficient vectors and are respectively expressed as follows:

$$ \overrightarrow{A}=2\overrightarrow{a}\cdotp \overrightarrow{r}-\overrightarrow{a} $$
(3)
$$ \overrightarrow{C}=2\cdotp \overrightarrow{r} $$
(4)

where \( \overrightarrow{r} \) denotes a random vector in [0, 1], and \( \overrightarrow{a} \) denotes the control parameter that linearly decreases from 2 to 0 during the iteration.

2.2 Bubble-net attacking strategy (exploitation phase)

The bubble-net attacking of humpback whales is achieved according to the shrinking encircling mechanism and the logarithmic spiral position updating. The shrinking encircling mechanism is defined by Eq. 2, where \( \overrightarrow{A} \) is a random vector in [−a, a]. The logarithmic spiral position updating is used to capture the prey by calculating the distance between the humpback whale and the prey, which effectively enhances the local search ability. The location update is expressed as follows:

$$ {\overrightarrow{D}}^{\prime }=\left|\overrightarrow{X^{\ast }}(t)-\overrightarrow{X}(t)\right| $$
(5)
$$ {\overrightarrow{X}}^{\prime}\left(t+1\right)={\overrightarrow{D}}^{\prime}\cdot {e}^{bl}\cos \left(2\pi l\right)+\overrightarrow{X^{\ast }}(t) $$
(6)

where \( \overrightarrow{D^{\hbox{'}}} \) denotes the distance of the ith whale to the prey, l denotes a random value in [−1, 1], and b denotes a constant for defining the shape of the logarithmic spiral.

Assume that there is a probability of 50% of choosing between either the shrinking encircling mechanism or the logarithmic spiral position updating. The model is expressed as follows:

$$ \overrightarrow{X}\left(t+1\right)=\left\{\begin{array}{c}\overrightarrow{X^{\ast }}(t)-\overrightarrow{A}\cdotp \overrightarrow{D\kern0.1em }\kern6.199996em if\kern0.4em p<0.5\\ {}{\overrightarrow{D}}^{\prime}\cdotp {e}^{bl}\cdotp \cos \left(2\pi l\right)+\overrightarrow{X^{\ast }}(t)\kern1.6em if\kern0.3em p>0.5\end{array}\right. $$
(7)

where p denotes a random number in [0, 1].

2.3 Search for prey (exploration phase)

To ensure the global search ability of the WOA, if \( \left|\overrightarrow{A}\right|>1 \), we can randomly select one whale individual as the optimal solution to update the positions of other whales. The position is expressed as follows:

$$ \overrightarrow{D}=\left|\overrightarrow{C}\cdotp \overrightarrow{X_{rand}}-\overrightarrow{X}\right| $$
(8)
$$ \overrightarrow{X}\left(t+1\right)=\overrightarrow{X_{rand}}-\overrightarrow{A}\cdotp \overrightarrow{D} $$
(9)

where \( \overrightarrow{X_{rand}} \) denotes a random position vector (a random whale) selected from the current population.

To better describe the solution process, the pseudo code of the WOA is given in Algorithm 1.

figure a

3 Lévy flight strategy whale optimization algorithm (LWOA)

The Lévy flight strategy is a special random walk strategy that combines the local search using a short walking distance with an occasional global search using a longer walking distance [4]. To improve the calculation accuracy and avoid premature convergence, the Lévy flight strategy whale optimization algorithm (LWOA) is proposed. The Lévy flight strategy can expand the search scope, increase the population diversity and easily jump out of the local optimum. Therefore, the LWOA effectively balances exploration and exploitation to determine a global optimal solution. The Lévy flight strategy is introduced to update the position of the humpback whales after updating all positions. The position is expressed as follows:

$$ \overrightarrow{X}\left(t+1\right)=\overrightarrow{X}(t)+\mu sign\left[\mathit{\operatorname{rand}}-1/2\right]\oplus Levy $$
(10)

where \( \overrightarrow{X} \) denotes the position vector at iteration t; μ denotes a uniformly distributed random number; sign[rand − 1/2] has only three values of −1, 0 or 1; and ⊕ denotes the entry-wise multiplication.

The random step length of the Lévy flight is determined by a Lévy distribution:

$$ Levy\sim u={t}^{-\lambda },\kern0.9000001em 1<\lambda \le 3 $$
(11)

where λ denotes a power coefficient. The Lévy flight strategy has a heavy-tailed probability distribution, and the LWOA has a strong global search ability. Mantegna’s algorithm is used to calculate the generated random step length of the Lévy flight strategy.

$$ s=\frac{\mu }{{\left|v\right|}^{1/\beta }}\kern0.5em \mu \sim N\left(0,{\sigma}_{\mu}^2\right)\kern0.5em v\sim N\left(0,{\sigma}_v^2\right) $$
(12)

where s denotes the random step length, β is 1.5, and μ and v obey normal distributions. σu and σv are respectively expressed as follows:

$$ {\sigma}_u={\left[\frac{\varGamma \left(1+\beta \right)\cdot \sin \left(\pi \beta /2\right)}{\beta \cdot \varGamma \left[\left(1+\beta \right)/2\right]\cdot {2}^{\left(\beta -1\right)/2}}\right]}^{1/\beta}\kern0.5em {\sigma}_v=1 $$
(13)

where Γ denotes the standard Gamma function.

The combination of the Lévy flight strategy and the WOA can realize their complementary advantages to overcome the defect of falling into a local optimum. The overall performance of the proposed algorithm has been greatly improved. The pseudo code of the LWOA is given in Algorithm 2.

figure b

4 Lateral inhibition mechanism

Hartline et al. has proposed the lateral inhibition mechanism based on experimental research of electrophysiology for the limulus’ vision [14]. Each microphthalmia of the limulus’ ommateum is a receptor. The release of the surrounding receptors has a suppressive effect on the receptor. The inhibitory effect has a spatial superimposition on space. In general, the effect on a certain receptor is inversely proportional to the distance between them, which proves the inconsistency of the receptor activities.

There is an inhibitory field around every microphthalmia of limulus’ ommateum. The effect is mutual: each receptor is a proximity receptor of its neighbors. While suppressing its neighboring receptor, it is also inhibited by its neighboring receptor. Furthermore, it is found that each microphthalmia has maximum and minimum values where the light intensity changes significantly, that is, bright places seem to be brighter and dark places seem to be darker. The lateral inhibition is used to process the matching image and the original image, which enhances the spatial resolution and improves the efficiency and accuracy of image matching.

The classical lateral inhibition model is expressed as follows:

$$ {r}_p={e}_p+\sum \limits_{j=1}^n{k}_{p,j}\left({r}_j-{r}_{p,j}\right),p=1,2,\dots, n;j\ne p $$
(14)

To apply this mechanism to solve image processing, the model is defined as two-dimensional and grayscale, and the gray value of pixel (m, n) in images is expressed as follows:

$$ R\left(m,n\right)={I}_0\left(m,n\right)+\sum \limits_{i=-M}^M\sum \limits_{j=-N}^N{\alpha}_{i,j}{I}_0\left(m+i,n+j\right) $$
(15)

where αi, j denotes the lateral inhibition coefficient of pixel (i, j) to the central pixel, I0(m, n) denotes the original gray value of pixel (m, n), R(m, n) denotes the gray value of pixel (m, n) after being processed by lateral inhibition, and M × N denotes the scale of the receptive field. The schematic diagram of the lateral inhibition model under the condition that M = N = 2 is given in Fig. 3.

Fig. 3
figure 3

Schematic diagram of the lateral inhibition model under the condition that M = N = 2

The size of the selected receptive field is defined as 5 × 5. The competing coefficient of lateral inhibition is expressed as follows:

$$ {\displaystyle \begin{array}{c}R\left(m,n\right)={\alpha}_0\times {I}_0\left(m,n\right)+{\alpha}_1\left[\sum \limits_{i=-1}^1\sum \limits_{j=-1}^1{I}_0\left(m+i,n+j\right)-{I}_0\Big(m,n\Big)\right]\\ {}\kern3.599999em +{\alpha}_2\left[\sum \limits_{i=-2}^2\sum \limits_{j=-2}^2{I}_0\left(m+i,n+j\right)-\sum \limits_{i=-1}^1\sum \limits_{j=-1}^1{I}_0\Big(m+i,n+j\Big)\right]\end{array}} $$
(16)

The vision nerve cells are on the same input plane and the competing coefficients are close to zero. The lateral inhibition modulus satisfies:

$$ {\alpha}_0+8{\alpha}_1+16{\alpha}_2=0 $$
(17)

where α0 = 1, α1 = − 0.075, and α2 = − 0.025. The following matrix is selected as the modulus:

$$ U=\left[\begin{array}{c}-0.025\\ {}\begin{array}{c}-0.025\\ {}\begin{array}{c}-0.025\\ {}\begin{array}{c}-0.025\\ {}-0.025\end{array}\end{array}\end{array}\end{array}\kern0.5em \begin{array}{cc}\begin{array}{c}-0.025\\ {}\begin{array}{c}-0.075\\ {}\begin{array}{c}-0.075\\ {}\begin{array}{c}-0.075\\ {}-0.025\end{array}\end{array}\end{array}\end{array}& \begin{array}{cc}\begin{array}{c}-0.025\\ {}\begin{array}{c}-0.075\\ {}\begin{array}{c}1\\ {}\begin{array}{c}-0.075\\ {}-0.025\end{array}\end{array}\end{array}\end{array}& \begin{array}{cc}\begin{array}{c}-0.025\\ {}\begin{array}{c}-0.075\\ {}\begin{array}{c}-0.075\\ {}\begin{array}{c}-0.075\\ {}-0.025\end{array}\end{array}\end{array}\end{array}& \begin{array}{c}-0.025\\ {}\begin{array}{c}-0.025\\ {}\begin{array}{c}-0.025\\ {}\begin{array}{c}-0.025\\ {}-0.025\end{array}\end{array}\end{array}\end{array}\end{array}\end{array}\end{array}\right] $$
(18)

The modulus template U is combined with R(m, n), and it obtains a new grayscale of the image. The edge of the image is extracted by the following equation:

$$ F\left(m,n\right)=\left\{\begin{array}{c}0\kern2.2em R\left(m,n\right)\le T\\ {}255\kern1.4em R\left(m,n\right)>T\end{array}\right. $$
(19)

where T denotes a user-defined threshold value according to practical situations, and F(m, n) denotes the final gray value of pixel (m, n).

5 Hybrid LWOA and lateral inhibition

5.1 The fitness function of LI-LWOA

The search strategy and similarity measurement play important roles in the image matching. The fitness value is defined to calculate the fitness value of each search agent according to different situations and real practices. If the image is relatively large, the calculation of the fitness value is extremely time-consuming. The schematic diagram of the template process is given in Fig. 4.

Fig. 4
figure 4

Schematic diagram of the template process

To overcome this shortage, the fitness function based on the lateral inhibition image processed is expressed as follows:

$$ f\left(m,n\right)=\frac{1}{PQ}\sum \limits_{i=0}^{P-1}\sum \limits_{j=0}^{Q-1}I\left(m+i,n+j\right) $$
(20)

where P × Q denotes the size of the template image (m, n), and it is the coordinate of the pixel in the original image; and I(m + i, n + j) denotes the processed gray value of pixel (m + i, n + j) via Eq. (19). If P × Q denotes the size of the template image and A × B denotes the size of the original image, the scopes of the coordinates in the original image for image matching are 1 ≤ m ≤ A − P + 1 and 1 ≤ n ≤ B − Q + 1, respectively. The maximum value f(m, n) denotes the best solution of the image matching.

5.2 The procedure of LI-LWOA

The LWOA has a stronger exploration ability and higher search efficiency, and the lateral inhibition mechanism can obviously perform background suppression and target enhancement. The LI-LWOA realizes complementary advantages between the LWOA and the lateral inhibition mechanism to solve the image matching problem. The main procedures of the LI-LWOA are given in Algorithm 3. The detailed flow chart of the LI-LWOA for image matching is given in Fig. 5.

Fig. 5
figure 5

Flow chart of the LI-LWOA for image matching

figure c

6 Experimental results and analysis

6.1 Experimental setup

The numerical experiment is set up on a computer with an Intel Core i7-8750H 2.2 GHz CPU, a GTX1060, and 8 GB of memory running on Windows 10.

6.2 Parameter setting

To verify the effectiveness and feasibility of LI-LWOA, the proposed algorithm is applied to solve the underwater image matching problem. Meanwhile, the LI-LWOA is compared with other algorithms, such as the LI-BA, LI-BBO, LI-ICA, LI-PSO, LI-SCA, LI-SHO and LI-SMS. The superiority of the LI-LWOA is determined through experimental comparison. The control parameter settings for each algorithm are given in Table 1. These important control parameters of all algorithms are representative empirical values and are derived from the original papers.

Table 1 Control parameter settings for each algorithm

7 The results and discussions

For each algorithm, the size of the population is 100, the maximum number of iterations is 300 and the number of independent runs is 30. The stopping criterion has been carefully selected to assure compatibility with similar works reported in the literature [10, 16]. Ave and CR represent the average value and correct rate, respectively, and they are used as an important criteria to assess the success of underwater image matching. To reflect the overall optimization performance of the LI-LWOA, the proposed algorithm is compared to other algorithms according to average value and correct rate. The threshold for image edge extraction is set as T = 110, and the purpose of optimization is to successfully match the template image to the original image. The coordinate information of the template image fixed in the original image determines whether the image matching is successful. The comparative optimization results obtained using the LI-LWOA and other algorithms are given in Table 2. The optimal average values and the best correct rates are expressed in bold.

Table 2 Comparative optimization results obtained using the LI-LWOA and other algorithms

The WOA has stronger robustness and better optimization performance, which can effectively switch between exploration and exploitation to obtain the optimal solution in the search space. The Lévy flight strategy has a strong global search ability to avoid premature convergence, and it is introduced into the WOA to further improve the calculation accuracy. The lateral inhibition mechanism can enhance the image characters and improve the matching accuracy. The LI-LWOA is applied to solve the underwater image matching problem, and it seeks to obtain a larger average value and a higher correct rate. A larger average value indicates that the optimization algorithm has higher calculation accuracy. A higher correct rate indicates that the optimization algorithm can obtain the matching position information in the original image according to the template image. To verify the optimization effect of the LI-LWOA, the proposed algorithm is compared to other algorithms based on the average value and correct rate. Table 2 gives the comparative optimization results. For images 1, 2, 3, 4, 8 and 9, the average value and correct rate of the LI-LWOA are better than those of other algorithms, and this shows that the LI-LWOA is able to obtain better functional target values and a higher matching effect. For image 5, the average value and correct rate of the LI-LWOA are consistent with those of the LI-SHO, and the correct rate is optimal. Meanwhile, their average values and correct rates are significantly better than those of the LI-BA, LI-BBO, LI-ICA, LI-PSO, LI-SCA and LI-SMS, which shows that the LI-LWOA can obtain the best average value and correct rate. For images 6 and 10, the average value and correct rate of the LI-LWOA are the best among those of all algorithms. The correct rate of the LI-LWOA and the correct rate of the LI-ICA are the same, which shows that the LI-LWOA has better experimental results and stronger robustness. For image 7, the average value of the LI-LWOA is superior to those of other algorithms, but the correct rate of the LI-ICA is worse than that of the LI-ICA, which shows that the LI-LWOA has higher calculation accuracy. To summarize, the LI-LWOA not only has a better average value, a higher correct rate and stronger robustness but also is an effective and feasible method for solving the underwater image matching problem.

The p value Wilcoxon rank-sum test is used to verify whether there is a significant difference between the two sets of data [22]. Table 3 gives results of the p value Wilcoxon rank-sum test. If p < 0.05, this indicates difference between two sets of data is very significant. If p ≥ 0.05, this indicates difference between two sets of data is not significant. N/A indicates “not applicable”, which means that the test cannot be performed because both algorithms successfully obtain the optimal value in all runs. The p values of the Wilcoxon rank-sum test are applied to ensure the robustness and effectiveness of the data. The data obtained by the LI-LWOA are compared with those of other algorithms. The p value is less than 0.05 in most cases, which indicates that there is a significant difference between the LI-LWOA and other algorithms and the data are not obtained by chance. The LI-LWOA is a better optimization algorithm for solving the underwater image matching problem.

Table 3 Results of the p value of the Wilcoxon rank-sum test

The goal of image matching is to match the template image to the original image by maximizing the similarity measure of the two images. Underwater image matching research not only provides a clear research direction for feature extraction, recognition and target tracking but also lays a solid foundation for pattern recognition and image analysis. The comparative results with the original images are shown in Figs. 6a, 7a, 8a, 9a, 10a, 11a, 12a, 13a, 14a and 15a and the template images are shown in Figs. 6b, 7b, 8b, 9b, 10b, 11b, 12b, 13b, 14b and 15b. The original images and the template images processed by the lateral inhibition are given in Figs. 6c, d, 7c, d, 8c, d, 9c, d, 10c, d, 11c, d, 12c, d, 13c, d, 14c, d and 15c, d, respectively. The lateral inhibition mechanism is used to preprocess the original images and the template images, which can improve the resolution of the main matching background, ameliorate the distortion of the sensory information and enhance the edges of the images. Therefore, the lateral inhibition can effectively improve the matching success rate and efficiency of the template images. The final template matching results obtained by the LI-LWOA are given in Figs. 6e, 7e, 8e, 9e, 10e, 11e, 12e, 13e, 14e and 15e. The WOA uses the bubble-net hunting strategy to perform global optimization, which results in higher calculation accuracy and a better matching effect. The Lévy flight strategy enhances the exploration to a certain extent. Meanwhile, the lateral inhibition mechanism has the ability to enhance the characters of images. The proposed algorithm is applied to solve the underwater image matching problem and has important experimental value. For all algorithms, the size of the population is 100, the maximum number of iterations is 300 and the number of independent runs is 30. The LI-LWOA can successfully obtain the position information that needs to be matched in the original image, which indicates that the proposed algorithm has strong robustness and stability. Table 2 shows that the LI-LWOA has better average values and correct rates compared with other algorithms, which indicates that the LI-LWOA has high optimization efficiency to obtain a better matching effect. The evolution curves of comparative results for images are given in Figs. 6f, 7f, 8f, 9f, 10f, 11f, 12f, 13f, 14f and 15f. The LI-LWOA has higher calculation accuracy compared with those of the LI-BA, LI-BBO, LI-ICA, LI-PSO, LI-SCA, LI-SHO and LI-SMS. The results show that the LI-LWOA has superior exploration and local maxima avoidance to solve the image matching problem efficiently and accurately under different environments.

Fig. 6
figure 6

Comparative results for Image 1. a Original image (900 × 598). b Template image (186 × 77). c Original image processed by the lateral inhibition. d Template image processed by the lateral inhibition. e The final template matching result obtained by LI-LWOA. f Evolution curves of comparative result for Image 1

Fig. 7
figure 7

Comparative results for Image 2. a Original image (720 × 469). b Template image (78 × 78). c Original image processed by the lateral inhibition. d Template image processed by the lateral inhibition. e The final template matching result obtained by LI-LWOA. f Evolution curves of comparative result for Image 2

Fig. 8
figure 8

Comparative results for Image 3. a Original image (1000 × 500). b Template image (116 × 93). c Original image processed by the lateral inhibition. d Template image processed by the lateral inhibition. e The final template matching result obtained by LI-LWOA. f Evolution curves of comparative result for Image 3

Fig. 9
figure 9

Comparative results for Image 4. a Original image (774 × 580). b Template image (123 × 75). c Original image processed by the lateral inhibition. d Template image processed by the lateral inhibition. e The final template matching result obtained by LI-LWOA. f Evolution curves of comparative result for Image 4

Fig. 10
figure 10

Comparative results for Image 5. a Original image (552 × 448). b Template image (58 × 59). c Original image processed by the lateral inhibition. d Template image processed by the lateral inhibition. (e) The final template matching result obtained by LI-LWOA. f Evolution curves of comparative result for Image 5

Fig. 11
figure 11

Comparative results for Image 6. a Original image (1024 × 578). b Template image (101 × 80). c Original image processed by the lateral inhibition. d Template image processed by the lateral inhibition. e The final template matching result obtained by LI-LWOA. f Evolution curves of comparative result for Image 6

Fig. 12
figure 12

Comparative results for Image 7. a Original image (800 × 640). b Template image (85 × 128). c Original image processed by the lateral inhibition. d Template image processed by the lateral inhibition. e The final template matching result obtained by LI-LWOA. f Evolution curves of comparative result for Image 7

Fig. 13
figure 13

Comparative results for Image 8. a Original image (1024 × 768). b Template image (138 × 70). c Original image processed by the lateral inhibition. d Template image processed by the lateral inhibition. e The final template matching result obtained by LI-LWOA. f Evolution curves of comparative result for Image 8

Fig. 14
figure 14

Comparative results for Image 9. a Original image (800 × 533). b Template image (57 × 56). c Original image processed by the lateral inhibition. d Template image processed by the lateral inhibition. e The final template matching result obtained by LI-LWOA. f Evolution curves of comparative result for Image 9

Fig. 15
figure 15

Comparative results for Image 10. a Original image (940 × 612). b Template image (100 × 90). c Original image processed by the lateral inhibition. d Template image processed by the lateral inhibition. e The final template matching result obtained by LI-LWOA. f Evolution curves of comparative result for Image 10

Statistically, the WOA simulates encircling prey, the bubble-net strategy and search for prey to obtain the optimal fitness values. The WOA has a strong exploration ability and exploitation ability. The Lévy flight strategy expands the scope of the spatial search and enhances the global search ability, which improves the calculation accuracy and optimization efficiency of the WOA. The LI-LWOA is used to solve the underwater image matching problem. It not only obtains better matching accuracy and fitness values but also can accurately match the template image to the original image. The LI-LWOA solves underwater image matching for the following reasons. First, the LWOA has the advantages of a simple structure, few control parameters and an easy implementation. Second, the logarithmic spiral updating position is based on the distance between the humpback whale and prey to capture prey, and so the LWOA has a strong local search ability. The position updating mechanism of the humpback whale is used to update the position according to the optimal whale’s position, and so the LWOA has a strong global search ability. Third, for control parameter \( \left|\overrightarrow{A}\right| \), if \( \left|\overrightarrow{A}\right|>1 \), the humpback whale will search for prey randomly to avoid premature convergence. This parameter can effectively adjust the global search ability and the local search ability to enhance the optimization performance. In addition, the underwater image matching problem requires that the algorithm has a higher exploitation ability to avoid falling into the local optimum in the whole optimization process. This is because the search space of each image is different in image matching. The LI-LWOA can obtain a better average fitness value and a higher matching success rate when solving the image matching problem.

8 Conclusions and future research

The purpose of image matching is to obtain the position that needs to be matched in an original image based on a template image by maximizing the similarity measure of the two images. In this paper, the Lévy flight strategy is introduced into the whale optimization algorithm to improve the calculation accuracy and the optimization performance. The combination of the WOA based on the Lévy flight strategy and the lateral inhibition mechanism is proposed, which can effectively achieve complementary advantages to avoid premature convergence and obtain the global optimal solution. To verify the overall optimization performance of the LI-LWOA, the proposed algorithm is applied to solve the underwater image matching problem. The average value and the correct rate are used as important evaluation indicators. Compared with other algorithms, the LI-LWOA obtains a better average value and a higher correct rate. The experimental results indicate that the LI-LWOA can effectively balance the exploration and exploitation to obtain the global optimal solution. Meanwhile, the LI-LWOA has stronger robustness and stability than other methods, and its effectiveness and feasibility have been verified to solve the underwater image matching problem.

In future work, the LI-LWOA will be used to solve the imaging problems of complex noisy marine environments, such as complicated patterns, real-world images, stereo matching and feature tracking. The proposed algorithm can be achieved using a parallel embedded processor. We will conduct an experiment to localise a certain target in an image different from the original one. In addition, we will pay more attention to the theoretical analysis and further study the convergence and application of the LI-LWOA to the image matching problem.