# Utilization of Merge-Sorting Method to Improve Stitching Efficiency in Multi-Scene Image Stitching
## 4 Multi-Scene Image Stitching Based on Merge-Sorting Method  
In order to be able to stitch both ordered and unordered images and to improve the efficiency of image stitching and reduce the stitching time, this paper proposes a multi-scene image stitching model based on the merge-sorting method. A schematic diagram of the structure of the model is shown in Figure 2.  
We input N images into the model and divided these N images into N/2 groups, then merged each of the two images into one group. This step was similar to the traditional merge-sorting model, where the images in the parent node of the upper layer are merged with the images in the two adjacent leaf nodes. At the same time, the feature points of the  
Figure 1: Pairs of subfigures, (**a–d**), are the results for matching image feature points using A-KAZE and KNN algorithms. merged two images were also matched. When the number of matching points reached the minimum, image stitching was performed with the upper-layer nodes, and the images that did not reach the minimum number of matching points were directly used as the upper-layer nodes. Then, we processed the images in the upper-layer nodes. In order to reduce the stitching time, we set a feature point matching condition that had to be satisfied by the image fusion: the first image was used as a reference image, and the feature points were matched with the subsequent images in turn. When the number of feature points matched in an image reached the minimum number of matching points, the two images were fused as an upper-layer-node image, instead of matching all the images once and then performing image fusion. When the two images were fused, the next image was used as the reference image, and then the feature points were matched and fused with the following images in turn. Images that underwent image fusion no longer participated in feature point matching and fusion. In this way, the feature points of the previous images and the following images were matched, and the images that met the matching condition for the feature points were fused until there were no images that met the condition for this layer of images and no images that met the condition for the images that were directly used in the parent node of the upper layer. By using this method for feature point matching and fusion with the images from each layer, we finally obtained a panoramic image at the root node. After many experiments and comparison and induction, we found that the number of feature points required to match two images with overlapping areas was generally more than 80. In order to better carry out image fusion, the minimum matching point value was set to 50 in this study. After matching the feature points and meeting the condition for the minimum number of matching points, the next step was image fusion. In this study, the optimal seam line image fusion method was used, which involves identifying the \"low energy\" area in the overlapping area of two images, using the energy formula to calculate the energy value for a single pixel in this area, and then determining a path through which image fusion can be achieved with the lowest energy. This path is called the optimal seam line. Following [29], the energy formula used in this study was as follows:  
\[E(i,j)=\alpha\cdot e_{c}(i,j)+\beta\cdot e_{g}(i,j) \tag{7}\]  
where \(\alpha\) and \(\beta\) were set to 0.83 and 0.17, following [29].