Color UAV Image Edge Detection Based on Improved Fireworks Algorithm

Image edge detection plays a crucial role in image analysis and recognition. However, when dealing with color images captured by unmanned aerial vehicles (UAVs), there are certain limitations, such as large operations, multiple noise sources, easy distortion, and missing information in edge detection. To address these shortcomings, this study proposes a UAV color image edge detection method based on an enhanced ﬁ reworks algorithm. In this method, the color image pixels of the UAV are represented using quaternions. The explosion amplitude formula of the ﬁ reworks is divided into two categories based on the mean value of the number of ﬁ reworks explosions. For each category, an explosion formula is proposed, and the explosion mutation operator of the ﬁ reworks algorithm is improved accordingly. By applying the proposed algorithm, the preliminary edges of a UAV color image are obtained. Additionally, a novel approach for color image edge re ﬁ nement is introduced. This approach involves classifying the edge points based on their degree of attachment, which leads to the formation of the edges in a UAV color image. Experimental results demonstrate that the algorithm proposed in this study o ﬀ ers several advantages, including fast calculation, strong denoising capability, and high-quality edge detection.


Introduction
The edge of an image is its most basic feature. The most valuable information about human vision and machine vision is contained in the edge. It occupies a key position in image detection and pattern recognition, especially in industrial machine defect detection [1,2]. A good detection algorithm can filter out the low-frequency information (flat area), retain the necessary high-frequency information (structural features), and greatly reduce the amount of data to be processed in the original image.
Edge detection is an optimization process that aims to identify discontinuities in image data. The gradient optimization algorithm is commonly used for this task. However, it faces challenges when dealing with nondifferentiable or discrete problems [3]. In this study, the obtained color image edges consist of discrete edge points. Consequently, a gradient-free optimization method is chosen to address this issue and handle the edge points effectively. A color image captured by an unmanned aerial vehicle (UAV) is different from the image generated by a traditional camera. Due to the constant movement of the UAV over the ground, the data characteristics of the obtained color image will vary in space and time due to the influence of internal and external factors such as climate conditions, material distribution, camera and imaging machine parameters, and data transmission. An increase in image noise, information leakage, and distortion inevitably degrades the performance of traditional algorithms [4,5]. To process the UAV images efficiently and accurately, finding an excellent edge detection algorithm is the most direct method. One early approach to edge detection involves converting the edges into binary form [6]. Subsequently, researchers explored the use of population-based algorithms, including ant colony optimization [7] and genetic algorithms [8,9]. However, these algorithms have rarely been employed in the context of image edge detection. There are many traditional image edge detection algorithms, but the effect of their direct application to a UAV color image is not ideal. In recent years, some researchers have conducted research on UAV color image edge detection [10,11] and have made some progress. For example, a previous study [12] proposed a UAV color image edge detection method based on the improved artificial bee colony algorithm. In the literature, a color image cuckoo edge detection algorithm based on quaternion was proposed [13]. Additionally, an improved whale optimization algorithm was presented as a color image edge detection method [14]. However, the advancements made by these methods in edge detection are not particularly remarkable. The ABC algorithm exhibits a slowdown in searching for the optimal solution and lacks strong optimization capabilities. Despite the improvements suggested in reference [12], the search speed remains sluggish, and the subsequent optimization abilities are not significantly enhanced. The cuckoo algorithm, known for its parameter simplicity and resistance to local optima, demonstrates good universality but suffers from slow convergence speed and a lack of robustness [13]. Similarly, the whale optimization algorithm suffers from slow convergence speed, low solution accuracy, and susceptibility to local optima. Despite the improvements proposed in reference [14], the convergence speed remains slow, and the problem of low solution accuracy is not significantly addressed. Consequently, these methods still fall short of meeting the ideal requirements. With the continuous development of quaternion theory [15][16][17], it has been playing an important role such as feature extraction and classification [18][19][20], fractional moment [21,22], and dynamic behavior analysis [23,24]. Unlike the traditional color image vector synthesis representation [25], the algebraic structure of a quaternion can efficiently maintain the spatial correlation of the color channels and avoid the loss of color information. However, it is still extremely weak in terms of processing. Thus, research on UAV color images and exploring and studying methods of applying the advantages of quaternion to UAV color image processing has important research value and significance.
In this study, the UAV color image pixels have been represented by quaternions [26]. The fireworks algorithm, as a swarm intelligence optimization algorithm, incorporates numerous advantages from existing algorithms while also possessing unique features such as explosiveness, instantaneity, simplicity, local coverage, emergence, distributed parallelism, diversity, scalability, and adaptability. In this study, an enhanced version of the fireworks algorithm [27] has been developed to further augment its performance. This improved algorithm has been introduced in UAV color image edge detection to obtain the preliminary image edge. To solve the problem of detecting the UAV color image preliminary edge, a new color image edge purification method based on the degree of attachment has been proposed. Results obtained from the experiment conducted using the proposed algorithm exhibit a good edge detection effect.

Quaternion Representation of UAV Color Image
The algebraic structure of a quaternion unifies the operation process of a color image. Thus, a quaternion can be regarded as a set of independent linear bases f1, i, j, kg, which is a four-dimensional vector space expanded in the real number field. A quaternion is defined as follows: where q 0 , q 1 , q 2 , q 3 ∈ R, i, j, and k are three pure imaginary units, respectively. When q 0 = 0, the quaternion is called a pure imaginary quaternion. A color image contains three color channels, which can be expressed as different color spaces, such as RGB, HSV, lab, and CMY [28]. Among them, the RGB mode is the most typical in color image representation. The three color channels of the image are represented by three imaginary parts of a pure imaginary quaternion and the real part as 0. Then, Equation (1) can be expressed as follows: where q 1 , q 2 , and q 3 represent R, G, and B color channels, respectively. In Equation (2), in the color image represented by RGB, each pixel value is a vector, its modulus represents brightness, and its direction represents the hue and saturation of the color pixels. Let R = e uθ = i + j + k be the axis of rotation. Then, RqR * is a pure imaginary quaternion [29]. For any two color image pixel vectors, q 1 and q 2 , Equation (3) can be used to judge whether q 1 and q 2 are the same points.
In Equation (3), if then ε is any positive number close to 0. If q 1 and q 2 are at the edge of the image, depending on how close ε is to the threshold of 0, these two points can be judged as the edge points.

UAV Color Image Edge Detection Based on the Fireworks Algorithm
Building upon the representation of color images using quaternions, the polar coordinate rotation principle is employed in this study. The fitness function, as defined in Equation (4), is utilized to identify qualified pixels through the application of the fireworks algorithm. Subsequently, the new edge point purification method, based on the attachment proposed in this study, is used for removing the noise points and pseudo edge points in the image. In this way, the edge detection of the UAV color image is achieved.
3.1. The Fireworks Algorithm and Improvement. The fireworks algorithm (FWA) is a swarm intelligence algorithm formed by simulating the search process of sparks generated by a fireworks explosion on the surrounding neighborhood space [30,31]. It mainly includes operations such as the explosion radius, the explosion number and displacement operation, fireworks variation, mapping rules, and selection mechanism. The efficiency of the fireworks algorithm is typically affected 2 International Journal of Aerospace Engineering by the fireworks explosion radius, the explosion quantity, and the fireworks variation. The fireworks explosion radius and the explosion quantity are expressed as follows: In Equation (5), w i represents the explosion radius (also known as explosion amplitude) of the current fireworks, w max represents the maximum amplitude (maximum radius) of the fireworks explosion, which is a constant, w max has a significant impact on the fast convergence of fireworks algorithms, and many researchers have made improvements [32,33]; f ðx i Þ refers to the fitness function value of the current fireworks x i , and z min represents the minimum fitness function value in the current fireworks group. Under normal circumstances, the fitness function value of the global optimal value and its local extreme value will also be very good. According to this feature, the fireworks algorithm uses a method to control the explosion radius. The better the fitness function value, the smaller the fireworks explosion radius.
In Equation (6), I i represents the explosion intensity of the current fireworks (also known as the explosion number of the fireworks), where i = 1, 2, ⋯, N, Q represents a constant corresponding to the total number of sparks generated by N fireworks, z max represents the maximum fitness function value in the current fireworks group, and ε represents the smallest constant that the computer can represent to prevent zero errors. The explosion density of fireworks is calculated as per the fitness value. The better the fitness function value, the greater the individual explosion intensity of the fireworks; that is, the more sparks will be generated. On the contrary, the worse the fitness function value, the smaller the individual explosion intensity of the fireworks; that is, the less sparks will be generated.
In order to ensure the diversity of fireworks explosion, a few fireworks are selected in an appropriate proportion, and a few dimensions are randomly selected for variation operation. The Gaussian variation of the k-dimensional coordinate of the jth spark in the fireworks explosion is given by where Gaussian (1,1) is a random number having a Gaussian distribution with a mean and variance of 1.
Since the fireworks algorithm was proposed, it has attracted many scholars to study, and many improved algorithms have been proposed [34,35], which began to be applied in many fields [36,37], but there are still many problems, such as the lack of diversity of fireworks optimization and the impact of fireworks search radius on optimization; these two problems are studied in this paper.
In the fireworks algorithm, the fitness function value of the fireworks is used for calculating the radius of the individ-ual fireworks explosion. The fireworks explosion radius has an important impact on the algorithm. In this algorithm, the explosion radius is generated randomly with the fitness function value. The smaller the fitness function value of the fireworks, the more explosive the fireworks, and the smaller the explosion radius. Too small an explosion radius reflects the local search ability of this algorithm. If it is used in the later stage of the algorithm, it reflects the fine searchability of the optimal solution. If it is used in the early stage, it is easy to fall into a local optimum. It can also be seen from the principle of the fireworks algorithm that the early search range, as well as the search radius, is large. As the iteration times increase, the search range gradually decreases. In addition, the search radius also decreases, and the explosion radius in the fireworks algorithm changes randomly with the fitness function value. Compared to the randomly changed fireworks explosion radius, dynamically reducing the radius can significantly improve the solution accuracy of the algorithm. Because the fireworks search range is closely related to the number of fireworks explosions, in this study, the fireworks type for which the fireworks explosion quantity (CQ(i)) is greater than or equal to the average explosion quantity (AQ(i)) is called A class fireworks. The fireworks type, where the fireworks explosion quantity is less than the average fireworks explosion quantity, is called B class fireworks. Obviously, the B class fireworks have better quality, and thus, it is easier to search for the global optimum. The fireworks explosion quantity of B class fireworks is less than the average, and this is the fireworks type generated when the explosion radius is large. At this time, the fireworks are optimized in a large search range, and it is easy to search for the global optimal solution. According to this principle, based on reference [38], an improved fireworks explosion radius search formula has been proposed in this study, as expressed by Equation (8): In Equation (8), xðiÞ represents the current fireworks, LABestðiÞ represents the current optimal fireworks obtained by the ith fireworks in the optimization process, and GBest represents the global optimal fireworks position of the current population. In Equation (9), t represents the current number of iterations, T represents the predetermined number of iterations, and R max and R min represent the predetermined maximum and minimum explosion radii, respectively. When the fireworks explosion quantity, CQðiÞ, in Equation (8), is less than the average explosion quantity, AQðiÞ, the optimal fireworks generated by each generation of fireworks explosion are obtained, which expands the ability of global optimization. In addition, increase in iterations, the search radius decreases dynamically and nonlinearly, which is conducive to rapid optimization. When CQðiÞ is greater than or equal to AQðiÞ, 3 International Journal of Aerospace Engineering the current fireworks learn from the global optimization of the current population, and the search radius decreases dynamically with the increase in the iteration times. This is conducive to quickly obtaining the final optimal solution.
Gaussian mutation has good local searchability, but it is not efficient in guiding individuals out of local optimization. In order to avoid too many sparks near the original point in the mutation operation of sparks in the fireworks algorithm, which is not conducive to global optimization, based on reference [39], the mutation operator in the fireworks algorithm is improved as follows: where x ik is the coordinate of the ith fireworks in the kth dimension; x gk represents the position coordinate of the best fireworks in the current fireworks population in the kth dimension; gs represents the Gaussian random variable with a mean and variance of 1; j and p are positive integers that are different from i; x jk and x pk represent the position coordinate of the j and p fireworks, respectively, in kth dimension; and the increased part (x jkx pk ) is because j and p are not equal to i. The diversity of the fireworks algorithm is thus increased, which is conducive to jumping out of local optimization.

UAV Color Image Edge Detection Method
Based on the Improved Fireworks Algorithm. The relationship between two pixel points q 1 and q 2 can be judged based on Equation (4). Therefore, in this study, Equation (4) will be used as the optimization objective function. The closer ε is to 0, the more likely it is that the two pixels are homogeneous. Otherwise, q 1 and q 2 must have one point at the edge and the other point outside the edge. Based on the principle of the fireworks algorithm and the representation method used in this study for UAV color images, an edge detection algorithm for the UAV color images, based on the improved fireworks algorithm, has been proposed. The following is the flowchart of the steps involved in this algorithm.

Color Image Edge Purification
Method. Due to the increase in the image noise, loss of image information, image distortion, and other reasons caused by the UAV color image itself, there are many noise points, pseudo edge points, missing edge points, and other phenomena on the edge of a UAV color image that are calculated as described in Section 3.2. Therefore, the preliminary edge must be purified. In this study, after all the preliminary edge points of the image are obtained by the improved fireworks algorithm, the optimal location point (including the global as well as local optimal location points) is taken as the center. The minimum explosion radius in each best iteration is obtained as the radius to form multiple key areas in the neighborhood. For the edge points that are not in this area, the degree of attachment is set, and the distance between each edge point that is not in the key area and the center of the key area is calculated. The current shortest distance edge point is set as P i . If the center of the key area closest to P i is A C , the current area in which A C is located is the affiliated area of P i ; i.e., A C is the affiliated center of the current edge point, P i . The shortest distance between P i and A C is defined as D i . The distance between the farthest edge fireworks point in the current key area and the center of the key area is set as D. Its affiliated degree is expressed as Start Set the iteration times of the freworks algorithm, the maximum and minimum explosion radii, the maximum and minimum freworks explosion numbers.
Select 20% of the frst-generation freworks and use Eq.  where BL is the degree of attachment. If Equation (11) is satisfied, then the edge points are discontinuous points or fuzzy points of the image edge, which are retained and incorporated into the attachment area. On the contrary, it is considered that the edge points are noise points or pseudo edge points generated by environmental interference, and these edge points are incorporated into the small impact area. The edge points in the key area and the affiliated area constitute the purified UAV color image edge obtained in this study.

Experimental Results and Analysis
The experiment included three parts: (1)   International Journal of Aerospace Engineering detection method based on the improved fireworks algorithm (IGFWAD) was proposed in this work, and the results obtained by applying this method to UAV images were subjectively compared with a quaternion UAV color image edge detection method based on the enhanced fireworks algorithm [40] (GFWAD) and a quaternion UAV color image edge detection method based on the standard particle swarm optimization algorithm [41] (SGFWAD) and a UAV color  In order to improve the efficiency of the experiment, the enhanced fireworks algorithm was selected to replace the traditional fireworks algorithm, which has been tested many times. In this study, an architectural image taken by a UAV in a forest area was selected as the research sample, and its size was 1000 px × 751 px. The number of iterations of the fireworks algorithm was 100, the maximum and minimum values of the fireworks radius were 40 and 3, respectively, and the maximum and minimum number of fireworks explosions were 50 and 5, respectively. In the experiment, BL was a real number, BL ∈ [1,3]. Many experiments have been done in this study, and only the three cases of BL = 1, 2, 3 are shown in this paper. Figures 1(b)-1(d) show the edge detection effect when BL = 1, BL = 2, and BL =3, respectively. Figure 2(a) is a typical example of a UAV discovering forest buildings or monitoring illegal buildings. Figure 2(b) is the effect diagram of edge detection when BL = 1. The edge of the nearest oval-shaped building on the lower left side is interrupted more, the edge of the green cover on the lower right side and the green-roofed house in the uppermost end exhibit more edge loss, and there also are considerable mispoints. Figure 2(c) shows the edge detection results when BL = 2. The detection effect seen in Figure 2(c) is the best, in which the edge extraction of the buildings in  International Journal of Aerospace Engineering the forest is obvious, and the roof edge of the square houses of the green-roofed buildings in the distance and the boundary between the houses and trees are quite clear. Figure 2(d) shows the result diagram when BL = 3. Its edge detection effect is better than that obtained by setting BL = 1 but worse than that obtained by setting BL = 2. The experiment shows that when edge detection is performed, it is not that the larger the attachment value, the better the experimental effect, nor is it that the smaller the attachment value, the better the experimental effect. The results of many experiments also show that the effect of edge detection is the best when the attachment value is approximately BL = 2, and thus, in this study, the value of BL is taken as 2.

Subjective Comparison of the Experimental Results
Obtained Using IGFWAD, GFWAD, SGFWAD, and FWAD Algorithms. The aerial images of the UAV in this experiment were obtained from the laboratory and downloaded from the Internet. The two images selected for illustrative purpose in this paper are the images taken by a UAV during the Baige landslide and the images taken by a UAV monitoring the coastal region of Hainan Island. A subjective evaluation was done in this experiment. The four algorithms, IGFWAD, GFWAD, SGFWAD, and FWAD, were used for edge detection in the two UAV aerial images. The parameter settings of the fireworks algorithm are shown in Section 4.1. For the standard particle swarm optimization algorithm, the maximum inertia weight is W max = 0:9, the minimum inertia weight is W min = 0:4, the acceleration factor is C 1 = C 2 = 2, and the maximum number of iterations is 100. The pixel area of the Baige landslide image was 996 px × 684 px. The pixel area of the Hainan Island image was 1152 px × 864 px. The effect of image detection is shown in Figures 3 and 4. In each figure, the effect diagrams of the FWAD, GFWAD, SGFWAD, and IGFWAD algorithms are shown. Figure 3(a) is an image taken by a UAV monitoring a landslide. The effect obtained in Figure 3(b) is not ideal mainly because the color contrast between the landslide part and the surrounding part is small. In addition, the method of separation into three colors (RGB) used for representing the color image pixels is not sufficiently accurate in expressing colors with close contrast. Therefore, in Figure 3(b), the edge extraction in the highway intersection region is incomplete, there is an obvious interruption, and the detection of the entire area of the landslide is not complete. The nearest large stone in the debris flow caused by the landslide has not been detected, and a pseudo edge phenomenon can also be observed. However, in Figure 3(e), the color image has been represented by a quaternion, and the improved fireworks algorithm has been applied, which provides the best edge detection effect. The detection of the landslide area is complete, and even the large stones exposed in debris flow are clearly extracted. The detection route of the highway and even the edge at the beginning of the landslide on the top of the mountain are clearly detected. Although the quaternion is used to represent the color image in Figure 3(d), the enhanced fireworks algorithm is used, but its effect is worse than that in Figure 3(e). However, the effect of edge detection is better than that in Figure 3(c). Although the detection effect in Figure 3(c) is worse than that in Figure 3(d), it is better than that in Figure 3(b). Figure 4(a) is an image taken by a UAV during coastal patrol monitoring. The effect observed in Figure 4(b) is    undoubtedly the worst, mainly because the color of the seawater and the beach is close to blue. When the vector synthesis method is used for edge extraction, it is difficult to reflect the small color differences, as can be seen from Figure 4(b). Therefore, there is almost no edge line of cloud sea in Figure 4(b), there are many false detections and missed detection of the coastline, and ship offshore has not been extracted. According to the detection results in Figure 4(e), it is undoubtedly the best of the four methods presented in this paper, because the color image is represented by quaternion, and the improved fireworks algorithm proposed in this paper is adopted. The effect of the edge extraction of the distant cloud sea boundary, ships in the sea, coastline, buildings, and trees on the beach is ideal. In Figure 4(b), vector synthesis is used to express color. When the algorithm runs, three color separation leads to the distortion of edge detection results. Moreover, Figure 4(e) adopts the improved fireworks algorithm proposed in this paper. On the basis of quaternion representing color image, when almost one color is reflected in this seaside color, the effect of edge detection is better than that of quaternion UAV edge detection based on enhanced fireworks algorithm (i.e., Figure 4(d)). Similar to Figure 3, the effect of Figure 4(c) is better than that of Figure 4(b) and worse than that of Figure 4(d).

Objective Comparison of the Experimental Results Obtained
Using IGFWAD, GFWAD, SGFWAD, and FWAD Algorithms.
In this experiment, two UAV images were quantitatively compared in terms of time and quality. The four algorithms used for comparison were run thirty times, and the average values of the results were obtained. The experimental results are shown in Tables 1 and 2. To assess the performance of the four edge detection methods, there are many estimation indicators, such as reference [42][43][44], in the paper, in order to accurately evaluate the performance of improved edge detection method, the evaluation indices used in a previous study [45] were used for comparison, and the experimental results are shown in Tables 3-6. For the sake of convenience, the following tables use one-hundredth of a second as the time unit.
It can be seen from Table 1 that for the Baige landslide image, the edge detection time taken by the SGFWAD algorithm accounts for 88% of that taken by the FWAD algorithm, and the edge detection time taken by the GFWAD algorithm accounts for 66% of that taken by the FWAD algorithm, whereas the edge detection time taken by the IGFWAD algorithm accounts for 49% of that taken by the FWAD algorithm. It can be seen from Table 2 that for the Hainan Island image, the edge detection time taken by the SGFWAD algorithm accounts for 87% of that taken by the FWAD algorithm, and the edge detection time taken by the GFWAD algorithm accounts for 67% of that taken by the FWAD algorithm, whereas the edge detection time taken by the IGFWAD algorithm accounts for 50% of that taken by the FWAD algorithm. It can be seen from the operation results of the two images that based on the color image represented by a quaternion, the fireworks algorithm is used for edge detection because a pixel participates as a whole in the entire operation process, and the speed of edge detection is obviously faster than the nonquaternion fireworks algorithm. Based on the quaternion representation, the improved fireworks algorithm is faster than the enhanced fireworks algorithm. Tables 3-6 show the evaluation results of the edge detection quality of the four algorithms applied to the two images, respectively. In the evaluation index system of this experiment, Z/X and Z/Y were used for evaluating the false detection and missed detection instances in image edge detection, respectively. The smaller the values of Z/X and Z/Y, the better the edge detection effect. As can be seen from Tables 3-6 and Figures 5 and 6, the values of Z/X and Z/Y gradually decrease. The results show that the IGFWAD algorithm proposed in this work provides the best edge detection effect, whereas the FWAD algorithm provides the worst edge detection effect. The experiments also show that since quaternions represent color images, the effect of quaternion color UAV edge detection based on standard particle swarm optimization algorithm is better than that based on enhanced fireworks algorithm of color UAV image represented by nonquaternion.

Conclusion
Aiming at the defects in UAV color image edge detection, the color image was represented by a quaternion in this study. The fireworks algorithm was introduced for color image edge detection for the first time. In order to obtain an efficient edge detection effect, the fireworks algorithm  was further improved. Further, to calculate the edge points of color images and ensure the effect of edge detection, a new attachment classification method was used to purify the edge points. The experimental results obtained in this work show that the improved fireworks algorithm based on quaternion exhibits the best edge detection effect among the four algorithms used in this study and can be used in practice. Nonetheless, the fireworks algorithm exhibits certain uncertainties [46] that need to be addressed when applying it to color image edge detection. These uncertainties include the differentiation between fireworks, the displacement of fireworks explosions, the randomness of Gaussian distribution numbers during fireworks mutation, and the selection strategies. The effectiveness of integrating the fireworks algorithm into color image edge detection is influenced by these uncertainties. Consequently, the next research direction is to explore methods to overcome and control these uncertainties.

Data Availability
The data used to support the findings of this study are included within the article.

Conflicts of Interest
The authors declare that they have no conflicts of interest.

Authors' Contributions
Dujin Liu and Bi Liang participated in the design of this study, and they both performed the statistical analysis. Jie Li carried out the study and collected important background information. Dujin Liu drafted the manuscript. Dujin Liu, Bi Liang, and Jie Li carried out the concepts, design, definition of intellectual content, literature search, data acquisition, data analysis, and manuscript editing. Dujin Liu and Bi Liang performed the manuscript review. All authors read and approved the final manuscript.