Abstract
In order to improve the accuracy and performance of traditional image threshold segmentation algorithm, this paper proposes a multithreshold segmentation method named improved Harris hawk optimization (IMHHO). Firstly, IMHHO adopts Tent map and elite opposition-based learning to initialize population and enhance the diversity. Secondly, IMHHO uses quadratic interpolation to generate new individuals and enhance the local search ability. Finally, IMHHO adopts improved Gaussian disturbance method to disturb optimal solution, which coordinates the local and global search ability. Then, the performance of IMHHO is tested based on 14 benchmark functions. In image segmentation, different algorithms are tested to compare the comprehensive performance based on Otsu and Renyi entropy. Experiments show that IMHHO performs better in the three kinds of benchmark functions; the segmentation effect is directly proportional to the number of thresholds; compared with other algorithms, IMHHO has better comprehensive performance.
1. Introduction
Image segmentation is the basic prerequisite step of image recognition and target detection [1, 2]. The quality of image segmentation directly affects the effect of subsequent image processing. The traditional threshold segmentation method has bad real-time performance, with large amount of computation. How to accurately and quickly search the best thresholds is the challenge and key of image segmentation.
Intelligent optimization algorithm [3–5] has been proved to be effective in solving parameter optimization problems [6–8] and has a good research and development prospect, including Sailed Fish Optimizer (SFO) [9, 10], Butterfly Optimization algorithm (BOA) [11, 12], Equilibrium Optimizer (EO) [13, 14], and Pathfinder Algorithm (PFA) [15, 16].
In the field of image segmentation, deep learning [17–19], intelligence optimization algorithm, and other methods [20–22] have been conducted in some research. Due to the excellent characteristics of search range, flexibility, and convergence, intelligence algorithm has a good prospect. Houssein et al. [23] proposed an efficient multithresholding images segmentation approach by an improved Equilibrium Optimizer algorithm and applied it to COVID-19 CT images segmentation. Houssein et al. [24] proposed a novel Black Widow Optimization algorithm in the field of multilevel thresholding image segmentation, which achieved good results. Tran and Wu [25] adopted PSO improved by neighborhood search method and applied it to image segmentation problem. Wang et al. [26] improved Salp Swarm Algorithm (SSAl) by using Levi flight, which enhanced the development ability and search ability. Krishnamoorthy et al. [27] used GWO algorithm and multilevel image thresholding selection method and applied it to image segmentation. Houssein et al. [28] improved Tunicate Swarm Algorithm and applied it in the field of global optimization and image segmentation. Other algorithms [29–31] have also made some results in the field of image segmentation.
Based on the foraging behavior of seabirds in nature, Heidari and others proposed a Harris hawk optimization (HHO) [32]. With high accuracy and certain global search ability, HHO simulates the predatory behavior of the Harris hawk population and has been successfully used in solving function optimization problems and other engineering application fields [33]. However, similar to other intelligent optimization algorithms, the single search method of HHO leads to lack of flexibility and mobility, and it is difficult to jump out of the local optimization. Moreover, HHO adopts the way of directly aggregating to the global optimization value, and the overall search is insufficient. In the follow-up research, Heidari et al. [34] compared the performance of HHO with other algorithms and verified the ability of HHO in solving problems such as pressure vessel design and rolling element bearing design. Bao et al. [35] proposed HHO-DE algorithm based HHO in image segmentation, which combined HHO and differential evolution (DE). In HHO-DE, the population was divided into two subpopulations, which will be assigned to HHO and DE. Then, HHO and DE operated to update the positions during the iterative process in parallel.
In order to improve the performance of HHO, this paper proposes a new algorithm named IMHHO. Firstly, IMHHO proposes a method of combining Tent map and elite opposition-based learning for population initialization; secondly, IMHHO uses the quadratic interpolation to generate new individuals and enhance the local search ability; thirdly, IMHHO uses improved Gaussian disturbance method to improve the local and global search ability. Then, in this paper, IMHHO is applied in the field of image segmentation. Experiments show that IMHHO can find the best threshold more stably, accurately, and efficiently and has better comprehensive performance.
2. Harris Hawk Optimization
The HHO is a swarm intelligence optimization algorithm proposed by Mirjalili in a short time and has novel theory. The algorithm simulates the hunting behavior of Harris hawk, including three stages: search stage, transformation stage, and development stage.
In the search stage, the population has a high degree of internal dispersion whose individuals randomly inhabit in some positions, and the strategy of individuals for hunting is given as the following functional equation:where , , , , and are random numbers within [0,1], is the number of iterations, is a random individual position, and are the upper and lower limits of the search space, is the prey position with the best fitness value, is the average position of all individuals. is a proportional coefficient, and once approaches 1, it will further increase the randomness of the strategy.
In the transformation stage, HHO can convert different states according to the escape energy of prey. During the escape of prey, its escape energy will gradually decrease. The functional equation of escape energy is given as follows:where is the initial energy of prey, which is a random number with [−1,1], and will be updated automatically at each iteration. is the current number of iterations. is the maximum number of iterations. When , HHO enters the search stage, and when , HHO enters the development stage.
In the development stage, HHO adopts four strategies. R is defined as a random number within [0,1], which is used to select different development strategies.
When and , HHO uses soft attack strategy to update the position, and the functional equations are given as follows:where is the difference between prey position and individual position and is a random value between [0,2].
When and , HHO uses hard attack strategy to update the position. The functional equation is given as follows:
When and , HHO uses the soft encirclement strategy of asymptotically fast subduction to update the position. The functional equations are given as follows:where is the fitness function, is a 2-dimensional random vector whose elements are random values within [0,1], and is the mathematical expression of Lévy flight.
When and , HHO uses the hard encirclement strategy of asymptotically fast subduction to update the position, The functional equations are given as follows:
The processes of HHO are depicted in Figure 1.

3. Improved Harris Hawk Optimization
3.1. Tent Map and Elite Opposition-Based Learning: In the Later Stage of Optimization
The population diversity of HHO decreases, and the probability of falling into the local optimal position increases, resulting in insufficient convergence accuracy. In this paper, a Tent map and elite opposition-based learning method is proposed to initialize the population and enhance the population diversity.
Chaotic map is based on nonlinear theory, which means that, in a deterministic system, there is a seemingly random irregular motion. It can traverse all states according to the characteristics in a certain range, with the characteristics of ergodicity, nonlinearity, randomness, and universality.
At present, logistic map and Tent map are the most common chaotic map methods. Research [36] shows that Tent map has better ergodicity than logistic map. Tent map is a piecewise linear map in the field of mathematics, with good correlation and uniform distribution function. The chaotic sequence of Tent map has uniform interval distribution and fast iteration speed. The functional equation of Tent map is given as follows:where is the chaotic value generated during iterations, is the constant belonging to , and is the maximum number of iterations. In this paper, .
Figure 2 depicts the sequence distribution histogram of Tent map, in which the maximum number of iterations is 500, and the number of intervals is 20. As can be seen from Figure 2, the Tent map is evenly distributed.

The basic idea of opposition-based learning (OBL) [37] is to calculate the opposite value according to the current value and the rules. The research shows that OBL can effectively improve the population diversity and the ability of jumping out of local optimal location.
The elite opposition-based learning (EOBL) method further improves OBL. It uses a certain proportion of dominant individuals to create their reverse populations and effectively improves the population diversity. If is an ordinary particle, and the corresponding extreme value is elite particle , then the functional equation of elite opposite value can be defined as follows:where , is a random number subject to normal distribution and is the spatial range of the dimension. The functional equation of and is given as follows:
In the functional equation (9), the spatial range boundary is dynamically adjusted according to the search iteration, and the spatial range of the reverse value is gradually reduced, which improves the convergence speed of the algorithm. When the reverse value is outside the boundary range, the reverse value is reset to a random value.
This paper proposes a Tent map and EOBL strategy. The new strategy firstly initializes the population according to the Tent map and then generates the reverse population according to EOBL. Then, all individuals of the two populations are ordered according to the fitness values, and the best individuals are selected as the final initialization population, which improves the quality of the whole population. The processes are summarized as follows:(1)Within the upper and lower limits, positions are initialized according to the Tent map as the initial population positions(2)Reverse populations are generated according to EOBL(3)The initial and reverse populations are merged, the fitness values after merging are reordered, and the first individuals are selected as the final initial populations
3.2. Quadratic Interpolation
In this paper, quadratic interpolation (QI) is used to improve the local search ability of HHO. QI uses the curve to fit the shape of the quadratic function. It is a local search operator to fit the optimal value of the function with the calculated curve extreme points.
Supposing and are the two random positions of the population in the D dimension problem, the current global optimal position is , and the functional equation of parabola passing through , and is as follows:
, , , the fitness values of , and are , and respectively, and is the subscript of the dimension.
The functional equations of second-order polynomial are as follows:
Based on the functional equations (11), (12), and (13), , , and are solved, and the functional equation is given as follows:
If , the quadratic interpolation method creates a new position according to the following functional equation:
Based on the functional equation (15), a new individual is created.
After the new population is created by quadratic interpolation, all individuals are reordered according to the fitness values, and the best individuals are left.
3.3. Improved Gaussian Disturbance
In this paper, an improved Gaussian disturbance strategy is adopted to disturb the optimal position, which enhances the search ability and convergence accuracy of the algorithm. In the iterations, Gaussian disturbance is applied to the current optimal position. The functional equation of Gaussian disturbance before improvement is as follows:where is the current global optimal position, is the position after Gaussian disturbance, then the fitness value after disturbance is calculated, and the optimal individual is selected according to the fitness values before and after disturbance.
In order to coordinate the global and local search ability of Harris hawk optimization, in the original functional equation is improved to dynamic Gaussian radius . The improved functional equations are as follows:where is the current number of iterations, is the maximum number of iterations, and decreases nonlinearly during the iteration process. In the early stage of the algorithm, is large, and the algorithm has strong global exploration ability. In the middle and later stages, gradually decreases, and the algorithm will do more sufficient local search.
3.4. The Processes of IMHHO
Firstly, after the parameters are set, the initial population is created by Tent map method, and the reverse population is created by EOBL; then, the initial population and reverse population are reordered by fitness values, and the first individuals are selected as the final initial population. Secondly, IMHHO is executed based on parameters and initial population, then Quadratic interpolation is adopted to generate new individuals, and the optimal position is disturbed based on the improved Gaussian disturbance method. Thirdly, when the number of iterations is equal to , the algorithm jumps to the next step; otherwise, it starts the next iteration. Finally, when the maximum number of iterations is reached, the algorithm ends and stores the fitness value and the optimal position. The processes of IMHHO are depicted in Figure 3.

4. Image Multithreshold Segmentation Based on IMHHO
4.1. Multithreshold Segmentation
In the field of image segmentation, threshold segmentation method is a typical method. In this paper, the threshold segmentation methods based on OTSU and Renyi entropy are extended to multithreshold segmentation method.
The principle of multithreshold segmentation is to determine the threshold group according to certain rules, and to divide the image into part according to the threshold group.
For the image with gray level ( is 256), is the current gray level, the probability of gray level is , and the total number of pixels is . If the number of thresholds is , the image is divided into parts, whose pixel probabilities of each part are to respectively.
In 1979, a threshold segmentation method named Otsu [38] was proposed. Otsu dynamically determines the threshold based on the maximum inter class variance. In this paper, a multithreshold segmentation method is realized based on Otsu, and the gray mean value of each part is to respectively, and then the functional equations are given as follows:
The functional equation of interclass variance of image is given as follows:where is the gray mean of image level.
The functional equation of optimal threshold vector based on Otsu is given as follows:
The Renyi entropy [39] quantifies the value of entropy and maximizes the sum of entropy between segmented target and background. In this paper, a multithreshold segmentation method is realized based on Renyi entropy, and the gray mean value of each part is to respectively, and then the functional equations are given as follows:where is an adjustable value of [0, 1].
The functional equation of Renyi entropy is given as follows:
The functional equation of optimal threshold vector based on Renyi entropy is given as follows:
4.2. Multithreshold Segmentation Algorithm Based on IMHHO
If the threshold vector is , which satisfies , and its subvalues are all positive integers, then the image will be segmented according to this vector. In IMHHO, OTSU and Renyi entropy are used as objective functions, respectively; if the vector conforms to the functional equations (20) or (23), then it is the target threshold vector. The processes of multithreshold segmentation method based on IMHHO are depicted in Figure 4.

5. Experimental Method, Results, and Analysis
In order to verify the performance of IMHHO, this paper designs the comparative experiments. The benchmark functions can test the general performance of the algorithm, and the comparative experiment of image multithreshold segmentation can test the image segmentation performance of the algorithm. The experiments in this paper are operated on the PC with 1.19 GHz CPU and 16 GB memory, python development language and PyCharm development software. The operating system is windows 10 and 64 bit.
5.1. The Experiments of Benchmark Functions
14 benchmark functions [40] were tested in the experiments. The parameters are depicted in Table 1, and the benchmark functions are depicted in Table 2.
In Table 2, F1–F5 are unimodal functions, F6–F9 are high-dimensional multimodal functions, and F10–F14 are low-dimensional multimodal functions. The unimodal function can verify the convergence speed and accuracy; the high-dimensional multimodal function can verify the global search ability; and the low dimensional multimodal function can verify the development ability of the algorithm. In the experiment, the population of each algorithm is 100, the number of iterations is 500, and each algorithm runs 20 times independently. The Standard Deviation (STD) and MEAN are selected as the experimental indicators. The STD can reflect the robustness, and the MEAN can reflect the optimization accuracy and exploration ability.
The experimental results of IMHHO, HHO-DE, SFO, BOA, EO, PFA, and HHO are depicted in Table 3. In unimodal functions, MEAN and STD of IMHHO are several orders of magnitude ahead of other algorithms. In high-dimensional multimodal and low dimensional multimodal functions, the MEAN and STD of IMHHO are all the best. The overall performance of IMHHO is significantly better.
In the experiment, except that IMHHO’s STD and MEAN are better than those of HHO-DE, and IMHHO’s actual execution time is much less than that of HHO-DE. Compared with HHO-DE, IMHHO’s comprehensive performance is better.
Figure 5 depicts the convergence diagram of the benchmark functions. Due to the limited space, the convergence diagrams of F1, F2, F6, F7, F12, and F14 benchmark functions are selected in this paper. In Figure 5, IMHHO performs better about convergence values. In terms of convergence speed, for F1 and F2, compared with IMHHO, although the convergence speed of BOA and SFO is faster, the convergence value is much worse than that of IMHHO, while IMHHO has a fast convergence speed, and the convergence value is obviously better than that of other algorithms; for F6, F7, F13, and F14, the convergence speed and value of IMHHO are the best.

(a)

(b)

(c)
5.2. Ablation Experiments
IMHHO combines Tent map and EOBL for population initialization, uses the quadratic interpolation to generate new individuals, and proposes improved Gaussian disturbance method to improve and coordinate the global and local search ability.
In this paper, the ablation experiments are designed to verify the effect of each improvement of IMHHO. The bench functions used in ablation experiments are the same as those in Table 2. The experimental results are depicted in Table 4. As shown in Table 4, with the addition of every improvement, the MEAN and STD are better and better.
5.3. Comparative Experiments of Different Algorithms
Cameraman, Lena, Baboon, and Peppers in the classical threshold segmentation data set are selected as the detection images. At the same time, in order to further verify the effect of IMHHO on image segmentation, the above experimental images are rotated and translated based on affine transformation, and the better perfect data set is obtained. The functional equation of affine transformation is as follows:where the matrix on the left is the transformation matrix, X and y are the original coordinates, and are transformed coordinates, and are constraints of different base transformations. The functional equation of affine transformation of this paper is as follows:where is the angle of counterclockwise rotation, is the horizontal coordinate translation, and is the vertical coordinate translation.
Figure 6 depicts the images after being rotated and translated.

The comparative algorithms are IMHHO, HHO-DE, SFO, EO, and PFA, The population size is 100, the number of iterations is 100, and each algorithm runs independently for 20 times. Peak Signal-to-Noise Ratio (PSNR) and Standard Deviation (STD) are used as experimental indicators, and the functional equations are as follows:where is the number of independent executions; is the best fitness value for the execution; is the average value of the best fitness values; and MSE is the mean square error, and the functional equation is given as follows:
Table 5 depicts the experimental results based on Otsu. Compared other algorithms, IMHHO has better convergence stability and PSNR value. Only when threshold is 3 of Lena, and threshold is 3 of Baboon, the PSNR value is less than that of SFO and EO. The overall performance of IMHHO is better.
Table 6depicts the experimental results based on Renyi entropy. Compared with SFO, EO, and PFA, IMHHO has better experimental indicators.
The segmentation effect of IMHHO based on OTSU and Renyi entropy is shown in Figures 7 and 8, respectively. As can be seen, the segmentation effect is directly proportional to the number of thresholds. With the number of thresholds increasing, the detailed processing and segmentation quality are better.


6. Conclusion and Future Work
In order to improve the performance of HHO, this paper proposes IMHHO and applies it in multithreshold segmentation. IMHHO adopts Tent map and EOBL to initialize the population, quadratic interpolation method to reselect the dominant individuals, and the improved Gaussian disturbance to disturb optimal solution, which improves HHO’s ability in population diversity, global exploration, and local development.
Experiments show that IMHHO performs better in the three kinds of benchmark functions, and its performance is ahead of most orders of magnitude; the effect of image segmentation is directly proportional to the number of thresholds; compared with other algorithms, IMHHO has obvious advantages in overall segmentation performance. Compared with HHO-DE, IMHHO’s comprehensive performance is better in benchmark functions tests and image segmentation, and IMHHO’s actual execution time is much less than that of HHO-DE. In the follow-up research work, the performance of IMHHO will be further optimized and applied to other research fields.
Data Availability
The (figure) data used to support the findings of this study are available from the corresponding author upon request.
Conflicts of Interest
The authors declare that there are no conflicts of interest regarding the publication of this paper.