Unmanned aerial vehicle image parallel splicing method, system and device and storage medium
Through the combination of inverted binary tree parallel processing algorithm and U-Net model, the parallel processing of image recognition during the drone image stitching process is realized, solving the problem of low splicing efficiency and accuracy in the existing technology, and significantly improving the farmland environment image stitching speed and recognition accuracy under.
Patent Information
- Application Number
- CN202410442131.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-12
- Publication Date
- 2024-11-29
AI Technical Summary
The existing drone image stitching technology cannot perform image recognition at the same time during the stitching process, resulting in efficiency and accuracy problems.
The inverted binary tree parallel processing algorithm is used to group the drone images in parallel, feature points are extracted using SURF algorithm, KNN and RANSAC algorithms match feature points, U-Net model performs semantic segmentation and weighted average fusion, and idle computing resources are used for identification.
It improves the speed and recognition accuracy of image stitching, avoids waste of computing resources, and is suitable for real-time monitoring in farmland environments.
Smart Images

Figure CN119048340A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a method, system, device and storage medium for parallel stitching of unmanned aerial vehicle images. Background Art
[0002] UAV remote sensing technology is widely used in the classification of land objects. It is used to collect valuable images to achieve precision agricultural monitoring. However, the acquisition of drone images, classification and monitoring cannot be separated from the stitching of drone images. The speed and efficiency of drone image stitching restrict the analysis and extraction of drone image information. With the development of edge computing and smart agricultural technology, drones have become an essential means to obtain information such as growth environment and growth. As a key link, most surveying and scientific research work uses commercial software and open source software for stitching. Therefore, agricultural drone monitoring often uses open source software for image stitching. Open source software stitches images based on image features, is easy to integrate, and has high scalability.
[0003] With the improvement of UAV flight control technology in recent years, the number of images taken by UAVs in a single flight has increased. Because a single UAV image is difficult to cover a large area, it is necessary to stitch multiple UAV images into a complete UAV image. This process is called UAV image stitching. With the improvement of UAV image accuracy and the increase of battery capacity, the number of pictures taken by UAVs in a single flight has gradually increased. Therefore, the efficiency and accuracy of UAV image stitching based on the original SIFT algorithm have appeared. At present, there have been many improvements to this problem, such as setting a suitable contrast threshold in the Gaussian scale space of the SIFT algorithm, improving the SIFT algorithm to the SURF algorithm, and introducing key frames in the SIFT algorithm. In order to meet the requirements of real-time, robustness and accuracy at the same time, these solutions effectively reduce the impact of cumulative errors through the improvement of the SIFT algorithm, and realize automatic panoramic stitching of the measurement area. The efficiency and accuracy of stitching can also be improved by preprocessing the image, such as scene structure analysis, parameter analysis and image band analysis.
[0004] All of the existing solutions utilize the characteristics of drone data and preprocess the data so that the algorithm can better adapt to the data. There are many ways to improve the accuracy and efficiency of stitching, but most of them are improvements in the extraction and matching of feature points, and it is impossible to simultaneously recognize images during the stitching process. Summary of the invention
[0005] In view of the deficiency of the prior art that it is impossible to simultaneously recognize images during the stitching process, the present invention proposes a method, system, device and storage medium for parallel stitching of drone images. By designing an inverted binary tree parallel scheme, idle computing resources are used to simultaneously perform recognition during the stitching process, thereby solving the problems existing in the prior art.
[0006] A method for parallel stitching of drone images, comprising the following steps:
[0007] Obtain images collected by drones;
[0008] The collected images are grouped into pairs using an inverted binary tree parallel processing algorithm;
[0009] Extract feature points for each group of image locations based on the SURF algorithm;
[0010] The KNN algorithm is used to calculate the distance between a feature point and all other feature points, and the nearest feature point is selected as the matching point;
[0011] Using the matching points, the image transformation matrix between the two images is calculated using the RANSAC algorithm;
[0012] Based on the U-Net model, semantic segmentation is performed on the two original images before grouping to obtain the recognition results of the two original images;
[0013] According to the transformation matrix, one of the original images and its recognition result is transformed to the coordinate system corresponding to the other original image and its recognition result, and then the weighted average fusion method is used to fuse the two transformed images and their corresponding recognition results to obtain the parallel stitching result of the final image.
[0014] Furthermore, the inverted binary tree parallel processing algorithm is used to group the collected images in pairs by treating the two groups as subtrees of the inverted binary tree; starting the layer-by-layer traversal from the leftmost subtree of the inverted binary tree, when the left and right subtrees of a node of the inverted binary tree are processed, the image processing task of the node is added to the queue, and the root of the tree is the final spliced image; it specifically includes the following steps:
[0015] Divide the drone images into n groups, where n is the number of CPU cores, and the process from reading the image to completing the task is one layer;
[0016] First, a certain number of CPU cores are allocated to each task group so that the CPU computing tasks of each group can be processed in parallel; the number of parallel processing tasks of each group is determined by the number of CPU cores and the maximum amount of memory;
[0017] After the first image stitching result is completed, the group of tasks is blocked and the stitching result is read into the cache;
[0018] Wait until all nodes in one layer are processed before processing the next layer of tasks. Similarly, after the task is completed, block the task and wait for the task of this layer to be completed;
[0019] This process continues in this way until the last set of tasks is left, completing the image stitching.
[0020] Furthermore, the extraction of feature points for positioning each group of images based on the SURF algorithm also includes distortion correction of the drone image; the distortion correction includes radial distortion position conversion and tangential distortion position conversion of the image, which specifically includes the following steps:
[0021] According to the image's Exif information, obtain the parameters required for distortion correction, including the camera's focal length f x 、f y and the center point c x 、c y , radial distortion K1, K2, K3 and tangential distortion T1, T2 of the camera;
[0022] According to the focal length f of the camera x 、f y and the center point c x 、c y , convert the image from the camera coordinate system to the pixel coordinate system, and the calculation formula is:
[0023]
[0024] Among them, Z c is the scaling factor, i.e. the Z coordinate; is the pixel coordinate system; is the camera coordinate system;
[0025] According to the distortion parameters, the image is transformed into radial distortion position and tangential distortion position. The formula for radial distortion position transformation is:
[0026]
[0027] The tangential distortion position conversion formula is:
[0028]
[0029] Among them, r 2 =x 2 +y 2 , x and y are the positions of the pixels that produce distortion; p1 and p2 are the tangential distortion parameters T1 and T2.
[0030] Furthermore, the feature points for locating each group of images extracted based on the SURF algorithm keep the image size consistent through the SURF algorithm, keep the image locating feature points by changing the size of the filter, and then extract the feature points of the image.
[0031] Furthermore, the weighted average fusion method is used to fuse the two transformed images and their corresponding recognition results to obtain the parallel stitching result of the final image, which is expressed as:
[0032] I=ω1I1(x,y)+w2I2(x,y)
[0033] Among them, ω1ω2 are the weights of the two images, I1I2 are the pixel values of the two images, x and y are the positions of the distorted pixels, and I is the pixel value after the two images are fused.
[0034] Furthermore, it also includes evaluating the image stitching result through subjective evaluation and objective evaluation; the subjective evaluation includes evaluating the quality of the drone image according to the brightness, chroma, saturation, stitching line and ghosting parameters of the image; the objective evaluation evaluates the stitching quality of the drone image according to the peak signal-to-noise ratio PSNR; its peak signal-to-noise ratio PSNR is expressed as:
[0035]
[0036] in, is the maximum value of the image pixel value, MSE is the root mean square error, and the larger the PSNR value is, the better the image stitching quality is.
[0037] The present invention also includes a UAV image parallel stitching system, comprising:
[0038] An acquisition module is used to acquire images collected by drones;
[0039] A grouping module, used to group the collected images into pairs using an inverted binary tree parallel processing algorithm;
[0040] An extraction module is used to extract feature points for positioning each group of images based on the SURF algorithm;
[0041] The matching point selection module is used to calculate the distance between a feature point and all other feature points through the KNN algorithm, and select the nearest feature point as the matching point;
[0042] The transformation matrix calculation module is used to calculate the image transformation matrix between two images by using the matching points through the RANSAC algorithm;
[0043] The recognition module is used to perform semantic segmentation on the two original images before grouping based on the U-Net model to obtain recognition results of the two original images respectively;
[0044] The stitching module is used to transform one of the original images and its recognition result to the coordinate system corresponding to the other original image and its recognition result according to the transformation matrix, and then use the weighted average fusion method to fuse the two transformed images and their corresponding recognition results to obtain the parallel stitching result of the final image.
[0045] The present invention also includes a computer device for parallel stitching of drone images, including: a memory, a processor, and a computer program stored in the memory, and the processor implements the steps of the method for parallel stitching of drone images when executing the computer program.
[0046] The present invention also includes a readable storage medium, which stores a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, they are used to execute the steps of the parallel stitching method of drone images.
[0047] The present invention provides a method, system, device and storage medium for parallel stitching of drone images, which have the following beneficial effects:
[0048] The inverted binary tree parallel processing algorithm of the present invention groups the collected images into groups of two, and each group of images performs feature point extraction based on the SURF algorithm, feature point matching based on the KNN and RANSAC algorithms, image recognition based on the U-Net recognition model, and weighted fusion. The transformation matrix between the two images is obtained by extracting image feature points and calculating matching points, and the U-Net recognition model is used to recognize the original image by using idle computing resources. The weighted average fusion method is used to fuse each two transformed drone images and their corresponding image recognition results to obtain the final image splicing recognition result. The method uses the idle computing resources to simultaneously perform recognition during the splicing process through the inverted binary tree parallel method, which can not only avoid the loss of the image during splicing, thereby affecting the image recognition accuracy, but also improve the image recognition accuracy, and also avoid the waste of computing resources in a farmland environment, greatly improving the splicing speed. The inverted binary tree parallel splicing recognition is of great significance for realizing real-time monitoring of ground objects based on drone images in a farmland environment. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 A schematic diagram of a parallel splicing framework in an embodiment of the present invention;
[0050] Figure 2 This is a schematic diagram of the scale space in an embodiment of the present invention;
[0051] Figure 3 This is a schematic diagram of feature point matching results in an embodiment of the present invention;
[0052] Figure 4This is a schematic diagram of weighted average fusion in an embodiment of the present invention;
[0053] Figure 5 A schematic diagram of a U-Net backbone network in an embodiment of the present invention;
[0054] Figure 6 This is a schematic diagram of the UAV image stitching process in an embodiment of the present invention;
[0055] Figure 7 Schematic diagram of inverted binary tree parallel processing in an embodiment of the present invention;
[0056] Figure 8 Schematic diagram of PSNR of different numbers of images under different schemes in an embodiment of the present invention;
[0057] Fig. 9 This is a schematic diagram showing the results of splicing parts of different image qualities in an embodiment of the present invention;
[0058] Fig.10 Schematic diagram of the effect of different flight altitudes on the splicing speed in an embodiment of the present invention;
[0059] Fig.11 This is a schematic diagram showing the results of splicing parts at different flight altitudes in an embodiment of the present invention;
[0060] Fig.12 This is a schematic diagram of training loss in an embodiment of the present invention;
[0061] Fig.13 This is a schematic diagram of the test set accuracy in an embodiment of the present invention;
[0062] Fig.14 Schematic diagram of the splicing result in an embodiment of the present invention. DETAILED DESCRIPTION
[0063] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0064] In order to improve the computing speed and efficiency of drone images in a farmland environment, the present invention proposes a parallel splicing and recognition method for drone images in a farmland environment. The method proposes an inverted binary tree parallel splicing and recognition algorithm, and realizes simultaneous splicing and recognition by extracting the transformation matrix in image splicing. The image splicing and recognition task is automatically divided into multiple sub-processes according to the number of CPU cores and the number of images of the edge device, and they are assigned to different cores for execution to improve the computing efficiency in a farmland environment. The method specifically includes the following steps:
[0065] Step 1: Data acquisition. The drone image data of this experiment was selected from two different locations to increase the diversity of the data. The shooting equipment used DJI drones Phantom 4RTK and Mavic 3E to avoid the influence of different drones on the stitching effect. The collected images are all RGB three-band images, with a shooting height of about 20-100m. The resolution of the Phantom 4RTK camera is 5472*3648, and the resolution of the Mavic 3E camera is 5280*3956. The specific shooting details are shown in Table 1.
[0066] Table 1 Image acquisition information diagram
[0067]
[0068]
[0069] The D1-D3 datasets are used to compare the effect of the number of images at the same altitude on the stitching speed and quality, and the D4-D12 datasets are used to compare the effect of the flight altitude at the same position on the stitching speed and quality; the image recognition experiment uses 150 images from the D2 and D13 datasets as the datasets for object recognition. Since the two datasets are shot in the same area at different altitudes, in order to balance the data, the selected data avoids large areas of corn or areas with cluttered distribution of objects. The main objects in the picture are corn, grassland, other crops, and buildings. The ratio of training set, validation set, and test set is 8:1:1.
[0070] Step 2: Parallel stitching technology framework. The present invention mainly parallelizes the stitching and recognition of drone images, such as Figure 1 As shown in the figure, firstly, the number of tasks that can be processed in parallel is calculated according to the number of CPU cores and memory size of the computer, and the parallel scheme is determined and the subtasks are divided. Then the image recognition model is trained and deployed to the computer. Each subtask mainly includes drone image preprocessing, feature point extraction based on SURF algorithm, feature point matching based on KNN and RANSAC algorithm, image recognition and image fusion. Then the subtasks are parallelized based on the inverted binary tree parallel algorithm. When all subtasks are completed, the parallel process ends and finally they are spliced into a panoramic image and recognition results.
[0071] First, the image is preprocessed; the image preprocessing mainly includes image denoising and distortion correction. Image distortion correction mainly solves the distortion problem caused by wide-angle cameras.
[0072] Table 2 Parameters required for distortion correction
[0073]
[0074] Generally, the parameters shown in the table above can be obtained based on the Exif information of the image, and the focal length f of the camera x 、f y and the center point c x 、c y , convert the image from the camera coordinate system to the pixel coordinate system, the formula is as follows:
[0075]
[0076] Where Z c is the scaling factor, i.e. the Z coordinate. The left side is the pixel coordinate system and the right side is the camera coordinate system.
[0077] Then, the image is transformed into radial distortion position and tangential distortion position according to the distortion parameters. The radial distortion position transformation formula (2) and the tangential distortion position transformation formula (3) are as follows:
[0078]
[0079]
[0080] where r 2 =x 2 +y 2 , x and y are the positions of the pixels that produce distortion.
[0081] Then the feature points are extracted and matched. The output of the SURF algorithm includes the location information, direction information and feature description of the feature points. The location information includes the location information of the feature points on the image and the scale and direction information of the feature points, so as to achieve the invariance of direction rotation and scale transformation. The process of feature point extraction mainly includes three steps: feature point positioning, direction assignment, and feature description. Figure 2As shown in the figure, compared with the SIFT algorithm, the SURF algorithm keeps the image size consistent and keeps the image positioning feature points by changing the size of the box filter (the size of the box filter is based on the principle that a window slides on the image to calculate the average pixel value in the window, and this average value can be used as the new value of the center pixel. The original SIFT algorithm box filter size is fixed, and the image size is changed. The improved SURF algorithm fixes the image size and changes the box filter size). Avoid excessive number of invalid feature points caused by excessive image size. KNN is the simplest classification algorithm in supervised learning and is used to calculate the points with the closest distance. The calculation method is to directly calculate the distance between a feature point descriptor and all other feature point descriptors. The distance uses the commonly used Euclidean distance, and then sorts the obtained distances and takes the one with the closest distance as the matching point; after obtaining the matching points, the matching points are used to calculate the perspective transformation matrix between the two images based on the RANSAC algorithm. The RANSAC algorithm obtains the value of the input matching point, then continuously eliminates the error points according to the error threshold and the number of matching points, and finally obtains the optimal matching point, screens out the error points, and then uses the reprojection error to determine whether these matches are correct matches. Figure 3 Shown are the matching results after RANSAC screening, and the lines connect the correct matching results of the images.
[0082] Secondly, the image is recognized through the U-Net network model. Since it was proposed, U-Net has been widely used in various directions of semantic segmentation, such as satellite image segmentation and drone segmentation. It evolved from the Fully Convolutional Networks for Semantic Segmentation (FCN). The core idea is to introduce skip connections, which greatly improves the accuracy of image segmentation.
[0083] The present invention uses this model as a sample model in the parallel algorithm, such as Figure 5 As shown, the model mainly includes the backbone feature extraction part, the enhanced feature extraction part and the prediction part.
[0084] Finally, weighted average fusion is performed: weighted average fusion has low memory overhead, fast speed and little impact on the image, retains more details in the middle of the image, and will not change the resolution of the image, thereby causing changes in image details. It improves image clarity by complementing information between multiple images.
[0085] like Figure 4 As shown in FIG. 1 , the weighted fusion method is to assign appropriate weights to the pixels of the overlapping parts of the images, and fuse the overlapping parts of the images according to Formula 4. The pixel value of the spliced image is:
[0086] I=ω1I1(x,y)+w2I2(x,y) (4)
[0087] Where ω1ω2 are the weights of the two images, and I1I2 are the pixel values of the two images.
[0088] The UAV image stitching task in this invention mainly includes image preprocessing, feature matching and fusion. Figure 6 As shown. First, read two drone images, then match the image feature points, stitch the two images together, and repeat this process until all drone images are traversed and the final stitched image is saved. The IO of image data is mainly in reading drone images, saving the final stitching results, and caching the stitching of two images each time, while the CPU computing task is mainly to extract and match image feature points. The traditional recognition task is to predict the stitched large image after the images are stitched.
[0089] Therefore, parallel processing of the above steps and making full use of the processing performance of multi-core computers can greatly improve the speed of parallel stitching of drone images. Parallel processing is a computing method that can execute two or more processing processes simultaneously in a computer system. At present, parallel processing is mainly a language extension solution, which uses the library functions of programming languages to perform parallel functions. The most important thing about parallel processing is to reasonably plan the parallel processing solution based on the relevance of the program.
[0090] After analysis, the above image processing steps are reasonably parallelized to avoid IO transmission and CPU calculation waiting for each other and reduce waiting time. Multi-core and multi-threaded processing is enabled to make full use of the CPU multi-core processor as much as possible to greatly improve the stitching speed of drone images. The algorithm adopts a multi-process task mode to maximize the use of the CPU to execute tasks. The IO and CPU calculations of the algorithm are separated and processed in parallel, and multiple data are read into the cache in advance to avoid IO blocking the execution of the program. Tasks that require CPU processing, such as feature point extraction and feature point matching, are divided into different processing cores so that both can be performed simultaneously to avoid wasting CPU computing resources. A parallel processing algorithm based on an inverted binary tree is designed.
[0091] In order to realize the simultaneous recognition and splicing, the present invention extracts the transformation matrix in the image splicing process, splices the recognition result and the original image at the same time, and avoids the need to perform cropping prediction again when predicting the large image after the image splicing; specifically, the two images to be spliced of the drone are the original images, and the two original images are extracted and matched to calculate the image transformation matrix. At this time, the two images are semantically segmented using the deployed U-Net model under the support of the parallel processing algorithm to obtain the ground object recognition result. After the two original images respectively obtain the corresponding recognition results, the image transformation matrix is used to transform one of the original images and the recognition to the coordinate system of the other original image and the recognition result, so as to correspond to the position of the two images. Finally, the weighted average fusion algorithm is used to fuse the original images and the corresponding recognition results of the two drone images to realize the parallel splicing of the drone images. Therefore, the present invention proposes a parallel processing algorithm based on an inverted binary tree, which groups the drone images in pairs to perform the splicing and recognition of the drone images, and the number of parallel groups in each group is determined according to the number of CPU cores and the maximum number of memory, so as to maximize the use of the computer's computing and storage resources.
[0092] The present invention regards the overall image processing process as an inverted binary tree, groups all data in pairs as an inverted binary tree, and the processing process is a layer-order traversal of the inverted binary tree starting from the leftmost subtree. When the left and right subtrees of a node of the inverted binary tree have been processed, the image processing task of the node is added to the queue to ensure that each group of images is processed, and the root of the tree is the final spliced image. Figure 7 As shown, the drone images are first divided into n groups, where n is the number of CPU cores. From reading the image to completing the task execution, one layer is formed. First, a certain number of CPU cores are allocated to each group of tasks so that the CPU computing tasks of each group can be processed in parallel. After the first image stitching result is completed, the group of tasks is blocked and the stitching result is read into the cache. After all nodes in a layer are processed, the next layer of tasks is processed. Similarly, after the task is completed, the task is blocked and waits for the task of this layer to be completed. This process is repeated until the last group of tasks is left and the image stitching is completed.
[0093] Through the analysis of the algorithm's time complexity, we know that the time complexity of the inverted binary tree parallel processing method is O(n) (n is the number of CPU cores), and the time complexity of not using parallel processing is O(n). Therefore, it can be concluded that the inverted binary tree parallel algorithm greatly improves the speed of image stitching and recognition by evenly dividing the subtasks.
[0094] In order to scientifically and effectively evaluate the results of drone image stitching and recognition, the present invention will evaluate the stitched images from subjective and objective aspects, and evaluate image recognition from objective aspects. Subjective evaluation: For the stitching quality of drone images, the stitched images are subjectively evaluated according to the CCIR500-1 standard, including image brightness, chroma, saturation, stitching lines, ghosting and other parameters to evaluate the quality of drone images. The standards are shown in Table 3.
[0095] Table 3CCIR500-1 Standard
[0096]
[0097] Objective evaluation: The objective evaluation index of image stitching is the peak signal-to-noise ratio (PSNR), which is widely used in image processing. PSNR is the maximum possible signal power / destructive noise power that affects its representation accuracy, calculated using the root mean square error (MSE) and defined as:
[0098]
[0099] in It is the maximum value of the image pixel value. The unit of PSNR is db. The larger the PSNR value is, the better the image stitching quality is.
[0100] The objective evaluation of image recognition mainly includes mean intersection over union (mIoU), mean pixel accuracy (mPA), mean precision (mPrecision), and mean recall (mRecall). The calculation formulas of these indicators are as follows:
[0101]
[0102]
[0103] Among them, TP means that the true value is positive in the feature classification, and the predicted value is also positive; FP means that the predicted value is positive in the feature classification, and the true value is false; FN means that the true value is positive in the feature classification, and the predicted value is false; TN means that the true value is false in the feature classification, and the predicted value is also false. The above indicators are all evaluated for each category, and then the sum is taken as the average.
[0104] Experimental analysis:
[0105] The CPU model of the edge device environment used in this experiment is i7-11700, with a frequency of 2.50GHz, 8 cores and 16 logical processors, and 64GB of memory. In order to compare the impact of commercial software and open source solutions on stitching efficiency, the stitching solutions of Pix4Dmapper commercial software (Pix4, trial version), Xu et al. and DJI Terra commercial software were selected for comparison. Pix4Dmapper and DJI Terra surveying software are stitching software that integrates full automatic, fast and professional precision. The stitching solution of Xu et al. also realizes image stitching without drone attitude information and adopts multi-threaded stitching, and proposes a new image stitching objective function to improve the speed and accuracy of stitching.
[0106] The impact of the number of images on the speed and quality of stitching: In order to evaluate the efficiency of parallel stitching recognition, the experimental model uses U-Net as the network structure for training. The server graphics card for training is NVIDIAA100-PCIE, the development framework used is Pytorch, the training epoch is 300 rounds, and the backbone network is frozen for the first 50 rounds to avoid excessive data noise and image model accuracy. The batch size (batch_size) is set to 16, and the loss function is the cross entropy loss function (CrossEntropy Loss, CE). The model training test is deployed on the edge device in the farmland environment and integrated with the stitching.
[0107] In order to evaluate the advantages and disadvantages of the algorithm under different image orders of magnitude, the present invention selected three groups of data (D1, D2, and D3), in which 10, 50, and 100 consecutive drone images were simultaneously screened to evaluate the image stitching speed under different numbers of images, as shown in Table 4.
[0108] Table 4 shows that when the number of images is 10, the time consumption of the inverted binary tree parallel is reduced by about 61% compared with Xu et al., 90% compared with Pix4Dmapper, and 76% compared with DJI Terra. The stitching of Pix4Dmapper and DJI Terra requires processes such as aerial triangulation, adding control points, and generating by-product digital elevation models. There are many results to consider, which leads to a longer time consumption. When the data is small, the inverted binary tree parallel can still divide multiple tasks for parallel processing, and the stitching speed is faster than other solutions.
[0109] In Xu et al., the stitching speed dropped significantly when the number of images was 100. This is because when the number of images increased, Xu et al. would search for the optimal stitching image based on all other images, causing the time to increase exponentially. DJITerra has targeted optimization for the stitching of images taken by DJI drones, so the stitching speed is the same as the inverted binary tree parallel solution when the number of images is 100. The inverted binary tree parallel solution searches for the optimal solution based on the nearest image, which greatly improves the image stitching time.
[0110] Table 4 Running time of different solutions with different number of images
[0111]
[0112] The parallel inverted binary tree takes the shortest time to join under the experimental environment and data. Figure 8 It can be seen that the PSNR of DJ I Terra is generally low, which means that the software is well optimized for this dataset. The PSNRs of inverted binary tree parallel, Pix4 and Xue et al. are basically stable between 27 and 28. In particular, on the D1 (100) dataset, the inverted binary tree parallel splicing has the lowest PSNR, and the PSNR on other datasets has not changed significantly and is relatively stable.
[0113] The PSNR value of an image can only represent that its image depth is less affected by image transformation, so subjective evaluation is used to evaluate the texture and stitching effect of the image. As shown in Table 5, when the number of images is small, the image texture and other issues are not caused by image transformation, but when the number of images is 100, each solution has different quality problems, including stitching gaps, ghosting, etc. Dataset D2 has problems such as poor evaluation in each solution.
[0114] Fig. 9 Some representative parts were intercepted for comparison. Through comparison, it was found that the stitching results of each solution were all usable, but DJI Terra deleted most of the images at the edge with low overlap rate due to the optimization of image stitching. The average perception and quality of the inverted binary tree parallelization on each data set were good.
[0115] Table 5 Subjective evaluation of different image numbers under different schemes
[0116]
[0117] The impact of aircraft altitude on stitching speed and quality: When the drone flies at different altitudes, the accuracy and quality of the captured images are different, and images of different accuracy have a greater impact on the speed and quality of image stitching. In order to evaluate the advantages and disadvantages of the algorithm at different altitudes, the present invention selects a fixed area and collects 20-100m drone data for comparison. The stitching time is shown in Table 6. The number of each route in this set of data is basically equal, avoiding the impact on the stitching time due to the uneven number of images on each route.
[0118] As shown in Table 6, when flying at a low altitude of 20m, some problems occurred in the stitching of each scheme. This may be due to the excessive number of images caused by the low flight altitude, and the depth of the image affected the matching of feature points. At 30m, Xu et al. and the inverted binary tree parallel scheme did not obtain any results. It can be seen that the image transformation stitching has weak adaptability to high-quality image stitching effects. When the flight altitude is 20-100m, the speed of the inverted binary tree parallel scheme is faster than other stitching schemes. In general, the inverted binary tree parallel scheme has a significant improvement in speed at different flight altitudes.
[0119] Table 6 Splicing time consumption at different heights under different schemes
[0120]
[0121]
[0122] The PSNR comparison of the four schemes is as follows Fig.10 The subjective evaluation is shown in Table 7. Fig.10 It can be seen that the image quality of the four stitching schemes is roughly the same, and the PSNR fluctuates directly between 26 and 28. As shown in Table 7, the subjective average quality of all schemes is at a good level, with no obvious stitching gaps and stitching misalignments.
[0123] Table 7 Subjective evaluation of different heights under different schemes
[0124]
[0125] Fig.11 The following is a schematic diagram of the stitching results of all images. At all altitudes, all schemes have no misalignment, but at 60m, Xu.et al parallel has stitching gaps and at 70m, the inverted binary tree scheme has stitching gaps. This may be because the lower the flight altitude, the more image details there are, and the weighted average fusion cannot handle the problem of different fused image depths well. However, DJI Terra still has the problem of a large number of edge images being discarded, resulting in incomplete stitching results and affecting the analysis of the farmland panorama. Overall, the inverted binary tree parallel has a good stitching effect and speed when the number of images and flight altitude are appropriate.
[0126] Model training and accuracy: Fig.12 The training and validation Loss and mIoU graphs generated by U-Net using the CE loss function are shown. The loss value is significantly reduced after the model starts training, and the gradient descent is performed, and it converges at 150 rounds and stabilizes at 200 rounds. Fig.13 The accuracy of the test set is shown in Figure 1. Among them, corn and other crops are higher than grass and buildings in all evaluation indicators, and the grass with the lowest IoU also reaches 80%. Overall, mIoU reaches 89.01%, indicating that the U-Net model has a good segmentation effect on this data, reflecting the versatility of U-Net in ground object classification in remote sensing images. Therefore, the subsequent parallel splicing recognition uses this weight as an example.
[0127] Parallel stitching and recognition time consumption: The present invention extracts the transformation matrix in the stitching process and stitches the recognition result and the original image at the same time. In order to prove the feasibility and superiority of parallel stitching recognition compared with traditional serial stitching recognition, the present invention extracted 20 consecutive drone images for comparative experiments. As shown in Table 8, the parallel stitching recognition not only reduces the time consumption by 70% compared with the serial stitching recognition, but also improves the mIoU of the image by 10%. Fig.14 The figure shows the full result of parallel stitching recognition. It is found that parallel stitching recognition has good classification accuracy for the contours of objects while ensuring high efficiency, and it is found that the low accuracy of serial stitching recognition is mostly due to the poor stitching recognition results of image edges.
[0128] Table 8 Comparison of parallel splicing and serial splicing solutions
[0129]
[0130] The experimental results show that: under the same experimental environment and data set, the inverted binary tree parallel splicing solution reduces the splicing time by an average of about 60% to 80% compared with commercial software; in the farmland environment, the inverted binary tree parallel splicing recognition not only reduces the time by 70% compared with the serial splicing recognition, but also improves the mIoU of image recognition by 10%. This shows that in the farmland environment, the use of a multi-threaded inverted binary tree parallel solution can better utilize the computing resources of edge devices in the farmland environment, greatly improve the speed of UAV image splicing and recognition, and provide technical support for the rapid real-time monitoring of UAVs.
[0131] The present invention proposes a parallel processing scheme based on an inverted binary tree, which realizes automated and parallel processing of image correction, feature point extraction, feature point matching, image fusion and image splicing. Through multiple experimental comparisons, it is proved that the efficiency of parallel splicing is improved compared with other schemes under large data volume. Selecting a multi-process scheme during parallel processing has higher efficiency in image splicing. This is because image splicing is a CPU-intensive calculation. Although there are file reading and storage, most of the calculation time is still spent on extracting and matching feature points. Multi-process calls CPU multi-core to execute multiple tasks of extracting and matching feature points at the same time, blocking the file I / O flow at each stage to protect the security of the file. By comparing the time consumption and accuracy of parallel splicing recognition, it is found that parallel splicing recognition is not only greatly improved in time consumption, but also in accuracy. On the one hand, recognizing the image before splicing can not only avoid the loss of the image caused by splicing to affect the image recognition accuracy, but also improve the image recognition accuracy; on the other hand, splicing recognizes the image at the same time, avoiding the waste of computing resources in the farmland environment, and greatly improving the splicing speed.
[0132] The present invention proposes a parallel algorithm for drone image splicing and recognition under a farmland environment. Compared with the traditional splicing and recognition process, the drone image parallel splicing and recognition algorithm of the present invention designs an inverted binary tree parallel scheme, automatically divides subtasks under different image numbers and CPU core numbers, replans the image splicing process using the divide-and-conquer idea, and uses idle computing resources to perform recognition simultaneously during the splicing process. In order to evaluate the performance of the proposed method, comparative experiments were conducted with Pix4Dmapper, Xu et al., and DJI Terra on data sets at different locations and different heights. The experimental results show that the inverted binary tree parallel splicing method proposed in the present invention is 60%-80% less time-consuming than the other three schemes. Parallel splicing recognition also reduces the time consumption by 70% compared with serial splicing recognition. Therefore, inverted binary tree parallel splicing recognition is of great significance for realizing real-time monitoring of objects based on drone images in a farmland environment.
[0133] Based on the same inventive concept, the present invention proposes a drone image parallel stitching system, comprising:
[0134] The acquisition module is used to obtain images collected by the drone.
[0135] The grouping module is used to group the collected images into groups by using an inverted binary tree parallel processing algorithm.
[0136] The extraction module is used to extract the feature points of each group of image positioning based on the SURF algorithm.
[0137] The matching point selection module is used to calculate the distance between a feature point and all other feature points through the KNN algorithm, and select the nearest feature point as the matching point.
[0138] The transformation matrix calculation module is used to calculate the image transformation matrix between two images using the matching points through the RANSAC algorithm.
[0139] The recognition module is used to perform semantic segmentation on the two original images before grouping based on the U-Net model to obtain recognition results of the two original images.
[0140] The stitching module is used to transform one of the original images and its recognition result to the coordinate system corresponding to the other original image and its recognition result according to the transformation matrix, and then use the weighted average fusion method to fuse the two transformed images and their corresponding recognition results to obtain the parallel stitching result of the final image.
[0141] Based on the same inventive concept, the present invention also proposes a computer device for parallel stitching of drone images, including: a memory, a processor, and a computer program stored in the memory, and when the processor executes the computer program, the steps of the parallel stitching method of drone images are implemented.
[0142] Based on the same inventive concept, the present invention also proposes a readable storage medium, which stores a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, they are used to execute the steps of the parallel stitching method of drone images.
[0143] The above description is only a preferred specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical scheme and inventive concept of the present invention within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A method for parallel stitching of drone images, characterized in that: The following steps are involved: Obtain images collected by drones; The collected images are grouped into pairs using an inverted binary tree parallel processing algorithm; Extract feature points for each group of image locations based on the SURF algorithm; The KNN algorithm is used to calculate the distance between a feature point and all other feature points, and the nearest feature point is selected as the matching point; Using the matching points, the image transformation matrix between the two images is calculated using the RANSAC algorithm; Based on the U-Net model, semantic segmentation is performed on the two original images before grouping to obtain the recognition results of the two original images; According to the transformation matrix, one of the original images and its recognition result is transformed to the coordinate system corresponding to the other original image and its recognition result, and then the weighted average fusion method is used to fuse the two transformed images and their corresponding recognition results to obtain the parallel stitching result of the final image.
2. The method for parallel stitching of drone images according to claim 1, characterized in that: The inverted binary tree parallel processing algorithm is used to group the collected images into groups of two by treating the two groups as subtrees of the inverted binary tree; Start the layer-order traversal from the leftmost subtree of the inverted binary tree. When the left and right subtrees of a node of the inverted binary tree are processed, add the image processing task of the node to the queue, and the root of the tree is the final stitched image. It specifically includes the following steps: Divide the drone images into n groups, where n is the number of CPU cores, and the process from reading the image to completing the task is one layer; First, a certain number of CPU cores are allocated to each task group so that the CPU computing tasks of each group can be processed in parallel; the number of parallel processing tasks of each group is determined by the number of CPU cores and the maximum amount of memory; After the first image stitching result is completed, the group of tasks is blocked and the stitching result is read into the cache; Wait until all nodes in one layer are processed before processing the next layer of tasks. Similarly, after the task is completed, block the task and wait for the task of this layer to be completed; This process continues in this way until the last set of tasks is left, completing the image stitching.
3. The method for parallel stitching of drone images according to claim 1, characterized in that: The method further includes performing distortion correction on the drone image before extracting the feature points for positioning each group of images based on the SURF algorithm; the distortion correction includes performing radial distortion position conversion and tangential distortion position conversion on the image, which specifically includes the following steps: According to the image's Exif information, obtain the parameters required for distortion correction, including the camera's focal length f x 、f y and the center point c x 、c y , radial distortion K1, K2, K3 and tangential distortion T1, T2 of the camera; According to the focal length f of the camera x 、f y and the center point c x 、c y , convert the image from the camera coordinate system to the pixel coordinate system, and the calculation formula is: Among them, Z c is the scaling factor, i.e. the Z coordinate; is the pixel coordinate system; is the camera coordinate system; According to the distortion parameters, the image is transformed into radial distortion position and tangential distortion position. The formula for radial distortion position transformation is: The tangential distortion position conversion formula is: Among them, r 2 =x 2 +y 2 , x and y are the positions of the pixels that produce distortion; p1 and p2 are the tangential distortion parameters T1 and T2.
4. The method for parallel stitching of drone images according to claim 1, characterized in that: The feature points for locating each group of images are extracted based on the SURF algorithm, and the image size is kept consistent by the SURF algorithm, and the image locating feature points are kept by changing the size of the filter, thereby extracting the feature points of the image.
5. The method for parallel stitching of drone images according to claim 1, characterized in that: The weighted average fusion method is used to fuse the two transformed images and their corresponding recognition results to obtain the parallel stitching result of the final image, which is expressed as: I=ω1I1(x,y)+w2I2(x,y) Among them, ω1ω2 are the weights of the two images, I1I2 are the pixel values of the two images, x and y are the positions of the distorted pixels, and I is the pixel value after the two images are fused.
6. The method for parallel stitching of drone images according to claim 1, characterized in that: The method also includes evaluating the image stitching result by subjective evaluation and objective evaluation; the subjective evaluation includes evaluating the quality of the drone image according to the brightness, chroma, saturation, stitching line and ghosting parameters of the image; the objective evaluation evaluates the stitching quality of the drone image according to the peak signal-to-noise ratio (PSNR); Its peak signal-to-noise ratio PSNR is expressed as: in, is the maximum value of the image pixel value, MSE is the root mean square error, and the larger the PSNR value is, the better the image stitching quality is.
7. A UAV image parallel stitching system, characterized in that: include: An acquisition module is used to acquire images collected by drones; A grouping module, used to group the collected images into pairs using an inverted binary tree parallel processing algorithm; An extraction module is used to extract feature points for positioning each group of images based on the SURF algorithm; The matching point selection module is used to calculate the distance between a feature point and all other feature points through the KNN algorithm, and select the nearest feature point as the matching point; The transformation matrix calculation module is used to calculate the image transformation matrix between two images by using the matching points through the RANSAC algorithm; The recognition module is used to perform semantic segmentation on the two original images before grouping based on the U-Net model to obtain recognition results of the two original images respectively; The stitching module is used to transform one of the original images and its recognition result to the coordinate system corresponding to the other original image and its recognition result according to the transformation matrix, and then use the weighted average fusion method to fuse the two transformed images and their corresponding recognition results to obtain the parallel stitching result of the final image.
8. A computer device for parallel stitching of drone images, characterized in that: include: A memory, a processor, and a computer program stored in the memory, wherein when the processor executes the computer program, the steps of the method for parallel stitching of drone images according to any one of claims 1 to 6 are implemented.
9. A readable storage medium, characterized in that: The readable storage medium stores a computer program, which includes program instructions. When the program instructions are executed by a processor, they are used to execute the steps of the drone image parallel stitching method according to any one of claims 1 to 6.
