Panorama synthesis method and system for aerial video of unmanned aerial vehicle
Through video key frame extraction based on camera motion estimation and an improved Alpha image fusion method, the problems of limited field of view and low splicing efficiency in drone aerial videos are solved, and efficient and natural panorama synthesis is achieved.
Patent Information
- Application Number
- CN202410774780.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-17
- Publication Date
- 2024-10-18
AI Technical Summary
Due to the limited field of view of drone aerial video, it is difficult to capture the complete target area. Existing image stitching technology has problems such as redundant calculations, obvious stitching traces, and image distortion, making it difficult to generate high-quality panoramic images.
A video keyframe extraction method based on camera motion estimation is used to estimate camera motion parameters through a homography matrix, dynamically update the keyframe extraction interval, and use an improved Alpha image fusion method to adaptively adjust pixel intensity and gradient to reduce splicing traces.
It improves the accuracy and efficiency of video key frame extraction, significantly shortens image stitching time, generates clear and natural panoramas, and solves the problems of stitching traces and image distortion.
Smart Images

Figure CN118799175A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of image splicing and relates to a method and system for synthesizing a panoramic image of an unmanned aerial vehicle aerial video. Background Art
[0002] Drones are gaining popularity in many fields such as agriculture, forest protection, and resource development because of their ability to quickly and efficiently capture high-resolution images at low altitudes. However, the video field of view captured by drones is limited and cannot observe the overall situation of the region. Drone remote sensing technology is a low-altitude technology that has become an important means of obtaining information. Drones have been widely used in various ground surveys due to their advantages such as fast acquisition speed, convenient operation, good safety, and low investment cost. However, due to the low flight altitude and limited camera focal length, the scene field of drone images is small, making it difficult to capture a relatively complete target area. Technical means are needed to combine multiple images of the same target to obtain a complete scene of the desired target. The purpose of image stitching is to combine multiple images with overlapping areas into a panoramic image.
[0003] The video shot by the drone is composed of multiple frames with temporal continuity, and the overlap rate between adjacent frames of the video is high. If all the frames of the video are directly stitched together, a lot of redundant calculations will be generated. Therefore, by extracting valid video frames from the video sequence for image stitching, the stitching efficiency can be greatly improved. Common key frame extraction methods include fixed interval-based, motion analysis-based, and clustering-based methods. The fixed interval-based method is to set a fixed interval to extract video key frames. Although this method is efficient and can reduce the redundancy of video image stitching, it is difficult to ensure that there are enough matching pairs between adjacent frames, which affects the stitching effect. The motion analysis-based method can extract key frames based on the motion characteristics of objects in the video, but this method has the problems of large computational complexity and low processing efficiency. The clustering-based method is to extract feature information from the video frame, use the feature information to achieve clustering, and thus divide the video sequence into multiple clusters. The video frame closest to the cluster center in each cluster is the key frame. However, this method requires the number of cluster centers to be set in advance, and the degree of automation is low.
[0004] In addition, image fusion plays a vital role in ensuring the quality of panorama synthesis. If the overlapping areas of the image are directly warped, the edge transition will often be unnatural or the stitching marks will be obvious. Therefore, these stitching gaps can be eliminated by image fusion methods to achieve smooth transitions and finally generate a more natural panorama. For example, Brown et al. proposed a panorama synthesis method that uses a bundling method for global adjustment and combines a multi-band mixing method for image fusion. Although this method can generate more natural stitched images, it may cause image distortion and blurring, and the processing process is time-consuming. In addition, Jiang et al. proposed a highly applicable stitching algorithm to address the problems of unstable machine posture, image distortion, and high feature point matching error rate during underwater image acquisition. This method improves image deflection by adjusting the posture angle, extracts feature points based on SURF, and uses OpenCV to stitch images. Experiments have shown that this method can increase the number of matching feature points, shorten the Euclidean distance, and improve matching accuracy. However, this method still needs to be improved in eliminating stitching marks. Summary of the invention
[0005] The purpose of the present invention is to propose a panoramic image synthesis method for unmanned aerial vehicle aerial video, which can efficiently extract video key frames suitable for panoramic image synthesis through the proposed video key frame extraction method based on camera motion estimation, and can significantly improve the stitching efficiency and the quality of the synthesized image through the proposed improved Alpha image fusion method.
[0006] In order to achieve the above object, the present invention adopts the following technical scheme:
[0007] A method for synthesizing a panoramic image of a drone aerial video comprises the following steps:
[0008] Step 1. Load the drone aerial video;
[0009] Assume that the video key frame extraction interval is T, that is, extract a frame as a key frame every T frames, T∈N + , N + is a positive integer;
[0010] Step 2. Initialize the video key frame extraction interval T=T0, where T0 is the initial extraction interval;
[0011] Step 3. Extract video key frames at intervals of T;
[0012] Step 4. Perform feature detection and description on adjacent key frames of the extracted drone aerial video;
[0013] Step 5. Complete image registration with the key frame images;
[0014] Step 6. Use the RANSAC algorithm to solve the homography matrix between adjacent key frames of the drone aerial video;
[0015] Step 7. Determine whether the video key frame extraction is completed;
[0016] If there are still key frames that have not been extracted, go to step 8; if the key frame extraction is completed, end;
[0017] Step 8. Decompose the obtained homography matrix to estimate the camera motion parameters, and update the video key frame extraction interval T according to the parameter changes, return to step 3, and use the updated T as the extraction interval of the next key frame;
[0018] Step 9. Based on the homography matrix obtained in step 6, the homography matrix is optimized, and the optimized homography matrix is used to warp the current frame onto the previously stitched panorama;
[0019] At the same time, based on the improved Alpha image fusion method, the stitching traces at the seams of the warped composite panorama are eliminated;
[0020] Step 10. Synthesize the drone aerial panorama.
[0021] In addition, based on the panoramic synthesis method of drone aerial video, the present invention also proposes a panoramic synthesis system of drone aerial video adapted thereto. The panoramic synthesis system of drone aerial video is used to implement the steps of the panoramic synthesis method of drone aerial video as described above.
[0022] In addition, based on the above-mentioned panoramic image synthesis method of drone aerial video, the present invention also proposes a computer device, which includes a memory and one or more processors.
[0023] The memory stores executable codes, and when the processor executes the executable codes, it is used to implement the steps of the panoramic image synthesis method of the drone aerial video mentioned above.
[0024] In addition, based on the above-mentioned panoramic image synthesis method of drone aerial video, the present invention also proposes a computer-readable storage medium on which a program is stored.
[0025] When the program is executed by a processor, it is used to implement the steps of the panoramic image synthesis method of the drone aerial video mentioned above.
[0026] The present invention has the following advantages:
[0027] As described above, the present invention relates to a method and system for synthesizing a panoramic image of a drone aerial video. According to various shooting changes of drone aerial videos, the present invention proposes a key frame extraction method based on camera motion estimation. The extraction method estimates the changes in the motion parameters of the camera by obtaining the homography matrix between adjacent video frames, dynamically updates the key frame extraction interval according to the parameter changes, and adaptively and quickly extracts key frames suitable for the synthesis of drone panoramic images. In the key frame extraction process, the homography matrix obtained by the present invention can also be used for image splicing, and in view of the cumulative error generated by solving the homography matrix, the present invention also proposes an image warping method based on an optimized homography matrix. At the same time, in view of the problem that there are obvious splicing marks at the splicing seams of the panorama synthesized by warping the video key frame image, the present invention also proposes an image fusion method based on improved Alpha, which can adaptively determine the Alpha value according to the pixel intensity and gradient of the image to be fused, and significantly shortens the image splicing time while ensuring that the image is not distorted, and synthesizes a clear and natural panorama. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 Schematic diagram of the process of a method for synthesizing a panoramic image of a drone aerial video in an embodiment of the present invention;
[0029] Figure 2 Schematic diagram of the changes between images captured by the camera in an embodiment of the present invention. Figure 2 (a) is a zoom diagram. Figure 2 (b) is a rotation diagram. Figure 2 (c) in the figure is a schematic diagram of translation.
[0030] Figure 3 Schematic diagram of the Alpha fusion algorithm in an embodiment of the present invention. DETAILED DESCRIPTION
[0031] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments:
[0032] Example 1
[0033] This embodiment 1 describes a method for synthesizing a panoramic image of a drone aerial video. This method proposes a video key frame extraction method based on camera motion estimation for the non-uniform motion of drone videos. Combined with the prior characteristics of the camera motion state, the camera motion parameter changes are estimated through the homography matrix, and appropriate video key frames are extracted according to the speed of parameter changes. In the key frame extraction process, the required homography matrix can also be used for image stitching, which is beneficial to improve the synthesis efficiency of the panorama, and the key frames are warped to the same coordinate using the optimized homography matrix. In view of the phenomenon that the warped synthesized panorama has obvious stitching marks at the stitching seams, the present invention also proposes an image fusion method based on improved Alpha, which adaptively determines the Alpha value through the pixel intensity difference and gradient change between images, so that the synthesized panorama is more natural.
[0034] like Figure 1 As shown, the panoramic image synthesis method of the drone aerial video in this embodiment includes the following steps:
[0035] Step 1. Load the drone aerial video.
[0036] Assume that the video key frame extraction interval is T, that is, extract a frame as a key frame every T frames, T∈N + , N + Is a positive integer.
[0037] Step 2: Initialize the video key frame extraction interval T=T0, where T0 is the initial extraction interval. Generally, the initial extraction interval T0 is a small fixed interval, for example, a key frame is extracted every 5 frames.
[0038] Step 3. Extract video key frames at intervals of T.
[0039] Step 4. Perform feature detection and description on the adjacent key frames of the extracted drone aerial video.
[0040] Commonly used methods for feature detection and description include SIFT algorithm, SURF algorithm and ORB algorithm.
[0041] Among them, the ORB algorithm has the fastest calculation speed, and the SIFT algorithm has the slowest. SURF improves the calculation speed while maintaining the robustness of SIFT rotation and scale transformation, and the rotation and scale transformation robustness of both are better than the ORB algorithm.
[0042] Since feature detection and description are not only used for video key frame extraction, but also for the stitching of aerial video images, the image stitching process requires both the timeliness of the stitching and the stitching of high-precision panoramic images.
[0043] Therefore, the method of the present invention selects the SURF algorithm to perform feature detection and description on the drone aerial video images.
[0044] Step 5. Complete image registration with key frame images.
[0045] In this embodiment, the key frame images are registered by using the fast approximate nearest neighbor matching algorithm FLANN. The process is as follows:
[0046] Assume that the two adjacent key frames extracted are I k and I k+1 , define a k and a k+1 I k and I k+1 The feature points extracted by SURF algorithm are as follows: and The Euclidean distance between feature points is:
[0047]
[0048] Among them, d represents the Euclidean distance between feature points, i represents the sequence number of feature descriptors, and n represents the number. represents a descriptor on a key frame, Represents the descriptor on another keyframe.
[0049] The ratio of the nearest neighbor to the next nearest neighbor of each pair of feature descriptors is used in I k+1 Found on I k The most matching feature point.
[0050] The ratio of the nearest neighbor to the next nearest neighbor is:
[0051]
[0052] In the formula, d1 represents the feature point a k with I k+1 The minimum Euclidean distance among all feature points on k+1,1 is the feature point corresponding to d1, and d2 represents the feature point a k with I k+1 The second smallest Euclidean distance among all feature points, a k+1,2 is the feature point corresponding to d2.
[0053] If r is less than the preset threshold R Thre , then it is considered that the feature point a k with a k+1,1 is a pair of matching points. Thre ∈[0.6,0.75], the matching accuracy is usually high. However, this matching strategy is very time-consuming and has a complexity of S(n 2 ).
[0054] In order to improve the matching efficiency, the present invention adopts the Fast Library for Approximate Nearest Neighbors (FLANN) algorithm, which has a fast matching speed and can reduce the time consumption to S (nlog2n).
[0055] The Fast Approximate Nearest Neighbor Algorithm (FLANN) is implemented through the KD tree, which is a binary tree structure used to partition the K-dimensional data space and is suitable for fast retrieval of high-dimensional data. The core principle is to recursively divide the data space into two regions through a hyperplane perpendicular to the coordinate axis. The steps to construct the KD tree are:
[0056] (1) Determine the partition domain, that is, calculate the variance of each dimension and select the dimension with the largest variance as the basis for partition.
[0057] (2) Sort the data by the partition domain, take the middle value as the partition point, and divide the data space into two subspaces.
[0058] (3) Repeat the above steps until there are no data elements in the subspace or it contains only one element.
[0059] The FLANN algorithm constructs a data index structure by analyzing the KD tree, and based on this structure, searches for the feature point with the smallest Euclidean distance to the query point in the feature point set. The ratio of the nearest neighbor to the next nearest neighbor distance determines whether a matching point pair is formed. This method realizes image registration between two adjacent key frames of UAV video.
[0060] Step 6. Use the RANSAC algorithm to solve the homography matrix between adjacent key frames of the drone aerial video.
[0061] Usually, the relationship between adjacent frame images in drone aerial videos can be described as a perspective transformation. This transformation relationship is described by a homography matrix, which is used to represent the mapping relationship of the same image from one plane to another.
[0062] Assume that the two adjacent key frames extracted are I k and I k+1 , I k and I k+1 There is a transformation relationship between them:
[0063]
[0064] In the formula, is the homography matrix between two adjacent key frame images; according to the perspective transformation model:
[0065]
[0066] Homography matrix The degree of freedom is 8, that is, There are 8 parameters in total; let (x k,1 ,y k,1 ) and (x k+1,1 ,y k+1,1 ) is a pair of matching points before filtering of two adjacent key frames.
[0067] According to the perspective transformation relationship:
[0068]
[0069] Right now:
[0070]
[0071] Using one pair of matching points, two equations can be established. Let the other three pairs of matching points be (x k,2 ,y k,2 ) and (x k+1,2 ,y k+1,2 )、(x k,3 ,y k,3 ) and (x k+1,3 ,y k+1,3 )、(x k,4 ,y k,4 ) and (x k+1,4 ,y k+1,4 ), and use four pairs of matching points to establish the following equation:
[0072]
[0073] The homography matrix can be obtained by using 4 pairs of matching points In the process of image registration, due to certain errors in feature point matching, the registration parameters obtained using a certain pair of four feature points may not be applicable to other feature points.
[0074] The Random Sample Consensus (RANSAC) algorithm can eliminate mismatched points and improve the registration accuracy. It is a robust estimation algorithm. Therefore, the present invention uses RANSAC to perform image registration.
[0075] Step 7. Determine whether the video key frame extraction is completed;
[0076] If there are still key frames that have not been extracted, go to step 8; if the key frames are extracted, end.
[0077] Step 8. Decompose the obtained homography matrix to estimate the camera motion parameters, and update the video key frame extraction interval T according to the parameter changes, return to step 3, and use the updated T as the extraction interval of the next key frame.
[0078] Step 8.1. The process of camera motion estimation is as follows:
[0079] When a drone is taking aerial photos, it mainly performs zooming, rotation and translation. The changes between the images taken by the camera reflect the camera motion state. Since the changes in the more complex affine parameters and perspective parameters between the estimated images have little effect on extracting key frames, the present invention only considers the state changes of camera zooming, rotation and translation.
[0080] According to the state changes between the images taken by the camera, Figure 2 As shown. In which s is defined c is the scaling factor, θ c is the rotation angle, t c.x is the horizontal translation, t c.y is the vertical translation, t c.x,y is the translational Euclidean distance.
[0081] Through the homography matrix between adjacent key frames It can accurately estimate the motion state of the camera. In fact, the homography matrix is a comprehensive reflection of various transformation relationships. Therefore, the homography matrix between adjacent key frames This breaks down into:
[0082]
[0083] in:
[0084]
[0085] In the formula, Q represents linear transformations such as scaling, rotation, and shearing, O represents displacement transformation, and P represents perspective effect; is the homography matrix 8 parameters.
[0086] Therefore, according to the displacement transformation O, it can be calculated:
[0087] Horizontal shift parameters
[0088] Vertical translation parameters
[0089] Euclidean distance of camera translation
[0090] To calculate the scaling factor s c and the rotation angle θ c , the set of matching points x that are successfully paired k and x k+1 The transformation relationship between them is expressed as:
[0091] xk+1 =s c Rx k +t c (10)
[0092] Where R is the rotation matrix, t c is the translation vector.
[0093] To calculate s c and R, for Perform singular value decomposition and get:
[0094]
[0095] Among them, U and V are orthogonal matrices, Σ is a diagonal matrix, and its expression is as follows:
[0096]
[0097] Extract the scaling factor s from the diagonal matrix c , use the orthogonal matrices U and V to obtain the rotation matrix R, the formula is as follows:
[0098]
[0099] Therefore, θ c =arctan(sinθ c / cosθ c )(14)
[0100] The camera motion parameters are estimated through the transformation relationship between the video key frames, namely t c.x,y 、s c and θ c , according to the changes of camera motion state parameters, the video key frame extraction interval T is updated in real time.
[0101] Step 8.2. The process of updating the key frame extraction interval is as follows:
[0102] Since drones usually perform non-uniform motion in the air, at different times, they may be stationary on the seabed, or they may perform uniform or variable speed motion, and the cameras they carry also perform the same motion when shooting.
[0103] In order to effectively capture images taken by the camera in different states, it is necessary to reasonably extract video key frames.
[0104] Since the camera motion posture is constantly changing, the extraction interval of the video key frames is dynamically updated according to the changes in the camera motion parameters, so that the video key frames suitable for panorama synthesis can be extracted more robustly.
[0105] The relationship between the changes in camera parameters and the key frame extraction interval is shown in equations (15) to (17).
[0106]
[0107] Where, T s 、T θ and T t Respectively represent the video key frame extraction intervals for scaling, rotation and translation changes. A1, A2 and A3 represent the parameter thresholds of scaling scale, rotation angle and translation amount, respectively, which are used to determine the trend of key frame extraction interval changes. s , η θ and η t They represent the correlation coefficients corresponding to the zoom scale, rotation angle, and translation, respectively, and are used to limit the degree of change in the key frame extraction interval.
[0108] According to the comprehensive changes of camera zoom scale, rotation angle and translation, the dynamic update of video key frame extraction interval is realized, and a comprehensive expression of video key frame extraction interval T is constructed, as shown in formula (18).
[0109] T=T0+T s +T θ +T t (18)
[0110] Then, T updated by equation (18) is used as the extraction interval of the next key frame to extract the video key frame.
[0111] By dynamically adjusting the key frame extraction interval according to the changes in motion parameters, we can better adapt to the changes in the speed of the drone in the air. This method can ensure that appropriate video key frame images are extracted at critical moments to capture important motion or scene changes. When the drone is relatively stationary, the extraction is no longer repeated, saving resources and improving efficiency. This adjustment method is highly robust to drone moving shooting in the air, laying the foundation for the rapid synthesis of drone aerial panoramas.
[0112] Step 9. Based on the homography matrix obtained in step 6, the homography matrix is optimized, and the current frame is warped onto the previously stitched panorama by using the obtained optimal homography matrix.
[0113] First, set an offset to move the video key frame image to the same field of view, that is, transform the key frame to the same coordinate system; then set the offset matrix to H offset Finally, the homography matrix between the second key frame placed in the field of view and the first key frame is obtained by premultiplying the offset matrix Combined with formula (4), the homography matrix The formula is:
[0114]
[0115] In the formula, and are the offsets in the x and y directions respectively, is the homography matrix between the first key frame and the second key frame.
[0116] From formula (4), we know that:
[0117]
[0118] in is the homography matrix between the second key frame and the third key frame.
[0119] Similarly, we can further conclude that in is the homography matrix between the third key frame and the fourth key frame,…, is the homography matrix between the n-1 keyframes and the nth keyframe.
[0120] Therefore, the homography matrix between the nth key frame and the first key frame in the same field of view is:
[0121]
[0122] In the formula, is the homography matrix between the third key frame and the first key frame; is the homography matrix between the n-1th key frame and the n-2th key frame; is the homography matrix between the nth keyframe and the first keyframe.
[0123] If the nth frame is recorded as the current frame I t , formula (21) can be simplified as:
[0124] Among them, H t represents the homography matrix between the current frame and the first key frame, H t-1 represents the homography matrix between the t-1 keyframe and the 1st keyframe, Indicates the current key frame I t The homography matrix between t-1th keyframe and t-1th keyframe.
[0125] This method continuously warps the extracted key frames of drone aerial video into the same field of view to synthesize a panorama. It is intuitive and simple, but it will produce cumulative errors. The cumulative error will continue to increase with the increase of images, causing distortion in the panorama.
[0126] To solve this problem, the present invention proposes a local optimization method to reduce the cumulative error. k When it is a key frame, not only the previous frame I is calculated k-1 To the current frame's position, also calculate the positions from all previous keyframes to the current frame.
[0127] Store each keyframe I i The position information of the current frame I t Matching relative keyframes, i<t.
[0128] Current frame I t With a previous keyframe I i When the homography matrix difference ΔH between them is less than the preset threshold P, I i It is considered to be the frame before the current frame I k relative reference frames, all relative reference frames constitute a candidate frame set S.
[0129] S={I m |ΔH(I m ,I t )<P,0≤m≤t} (22)
[0130] Among them, I m Indicates the current frame I t With a previous keyframe I i The difference in homography matrix between ΔH(I m ,I t ) is less than the preset threshold P, I t Indicates the current frame, ΔH(I m ,I t ) represents the homography matrix difference.
[0131] Calculate the homography matrix of the candidate frames in the current frame pair set S.
[0132] Define each frame I in the set S t1 ,I t2 ,…,I tn The homography matrices to the base plane, i.e. the same field of view, are H t1 ,H t2 ,…,H tn ; For any key frame I in set S ti , obtained from I t To I ti The homography matrix Then the candidate homography matrix from the current frame to the base plane is as shown in formula (23):
[0133] Calculate all candidate homography matrices and find the optimal homography matrix. The specific process is as follows:
[0134] The weighted reprojection error is used as the criterion for determining whether the homography is optimal, and is defined as follows:
[0135]
[0136] Where E(i) represents the weighted reprojection error, C ti ∩C t Representative I t and I tj The function proj(x,H) represents the coordinates of the feature points in the key frame after projecting them back to the reference plane through the homography matrix H; ΔH(t,tj) represents the homography matrix difference between the current frame and the candidate frame; represents the x coordinate of the feature point in the candidate frame, H tj represents the candidate frame homography matrix, Indicates the x coordinate of the feature point in the current frame, H t (i) represents the candidate homography matrix, represents the x-coordinate of the feature point in the candidate frame, Indicates the y coordinate of the feature point in the current frame; here H tj and H t (i) is the homography matrix of different candidate frames.
[0137] ΔH(t,tj) is used to balance the difference in the number of feature points between different matching image pairs.
[0138]
[0139] Where m is the index of the best coordinate system found.
[0140] The best coordinate system matching the current coordinate system is determined by formula (25), and I t To I tm The homography of projects the current coordinate system onto the base plane and determines I t The homography to the base plane is as follows: t =H t (m)(26)
[0141] Among them, H t represents the optimal homography matrix, H t (m) represents the homography matrix in the optimal coordinate system; the optimal homography matrix H is obtained by using t , warping the current frame onto the previously stitched panorama for a more precise and seamless overlay.
[0142] The drone aerial panorama spliced after image warping often leaves splicing marks and obvious edge transitions at the image splicing seams. In order to improve the overall visual effect of the image, making the transition at the image splicing seams more natural has become the key in image splicing technology. Aiming at the phenomenon that the warped panorama has obvious splicing marks at the splicing seams, the present invention proposes an image fusion method based on improved Alpha to improve the image splicing quality.
[0143] Alpha image fusion is a linear fusion algorithm and a widely used image fusion technology in computer vision. Its purpose is to merge two images to generate a fused image with a more natural visual effect.
[0144] When compositing, set the Alpha channel to control the proportion of each pixel in the new image from the original image. The fusion equation is:
[0145]
[0146] Where (x, y) represents the pixel coordinates, C(x, y) represents the final fused image, A(x, y) represents one image, B(x, y) represents another image, α1 and α2 are the weight coefficients of the reference image and the image to be fused, and their values are determined by the distance from the pixel to the edge of the image and meet the conditions:
[0147]
[0148] There is a smooth transition region between the two images, such as Figure 3 The traditional Alpha fusion method has a small amount of calculation and saves image fusion time, but there will be distortion at the seams, and it is impossible to synthesize a high-quality panorama.
[0149] In view of the distortion problem of traditional Alpha image fusion algorithm, the present invention proposes an improved Alpha fusion algorithm, which combines adaptive intensity and gradient-based fusion strategies, analyzes the intensity difference and gradient change of the image, and adjusts α1 and α2 according to the features in different areas, thereby achieving a more natural image fusion effect.
[0150] By comparing the intensity difference between the original image and the transformed image, an adaptive intensity fusion method is proposed.
[0151] Define an adaptive Alpha value, using α L It is expressed as shown in formula (29):
[0152]
[0153] Where, L k and L k+1is the image intensity of two adjacent key frames, and l is the intensity adaptation coefficient.
[0154] According to the gradient information of the image, a method for calculating the Alpha value based on gradient change is proposed, as follows:
[0155] First, the Sobel operator is used to calculate the horizontal gradient of the image, and then the gradient difference between the original image and the transformed image is compared, and finally the adaptive Alpha value based on the gradient is obtained. G It is expressed as shown in formula (30):
[0156]
[0157] In the formula, G k and G k+1 are the gradients of two adjacent key frame images, g is the gradient adaptive coefficient, and τ is a small positive number to prevent the denominator from being zero. According to formula (28) and combined with the adaptive intensity information and gradient-based features, the weight parameter is introduced to define the final Alpha value, as shown in formula (31):
[0158]
[0159] In the formula, w L and w G It is a weight parameter that flexibly adjusts the contribution ratio of intensity and gradient in image fusion. By automatically adjusting the two weight parameters, it can better balance the different features of the image to achieve a better fusion effect.
[0160] The improved Alpha algorithm proposed in the present invention can fuse drone aerial images into a high-quality panoramic image by adjusting the transparency of different images, thereby improving the naturalness and visual effect of image fusion.
[0161] Substitute the obtained α1 and α2 into formula (27) to obtain the improved stitched image.
[0162] Step 10. Synthesize the drone aerial panorama.
[0163] In addition, in order to verify the effectiveness of the panoramic image synthesis method proposed in the present invention, the following experiments were also conducted:
[0164] 1. Feature extraction comparison experiment.
[0165] The SIFT algorithm, SURF algorithm and ORB algorithm are used to detect and describe the features of two adjacent key frame images respectively, and then the FLANN algorithm is used for image registration, and the RANSAC algorithm is used to eliminate mismatches. By analyzing the experimental data, a feature extraction algorithm is selected that can quickly and accurately complete the feature detection and description of the drone key frame image.
[0166] By analyzing the data, we can see that although the ORB algorithm has a fast processing speed, its registration accuracy is too low; the processing speed and registration accuracy of the SURF algorithm are better than the SIFT algorithm.
[0167] Therefore, in the registration process between drone key frames, the present invention selects the SURF algorithm for feature detection and description, which can lay the foundation for the rapid synthesis of drone panoramas and ensure the accuracy and timeliness of image registration.
[0168] 2. Comparative experiment and analysis of key frame extraction.
[0169] Video keyframes refer to representative image frames in a video sequence. The purpose of extracting keyframes is to achieve rapid synthesis of panoramas. Too few matching pairs will cause distortion when stitching images, affecting the overall visual effect. Although too many matching pairs can improve the stitching effect to a certain extent, it will significantly increase the amount of calculation and reduce processing efficiency. To ensure that the number of matching pairs between two adjacent frames is moderate, the number of matching pairs between two adjacent keyframes is used as a measurement standard, denoted as E. Based on the experience of image registration experiments, the maximum threshold E of the matching pairs of feature points between two adjacent keyframes is set to max =350, minimum threshold E min =100, key frames within the threshold range are considered to be reasonably extracted, those above the maximum threshold are considered to be redundantly extracted, and those below the minimum threshold are omitted. Under the condition of reasonable extraction, the key frame extraction methods based on motion analysis, k-means clustering, and camera motion estimation are used to extract key frames from the two groups of video sequences, and the advantages and disadvantages of the three methods are compared and analyzed, as shown in Table 1.
[0170] Table 1 Key frame extraction data
[0171]
[0172]
[0173] The video key frames extracted in the first 120 frames in Table 1 (the video key frames underlined in the table) are analyzed, and the matching pairs between two adjacent key frames are calculated. By comparing the obtained matching pairs with the set reasonable threshold range, the following conclusions are drawn: When the motion analysis method is used to extract key frames, it can be clearly seen that the matching pairs between 1-15 frames, 30-59 frames, and 59-119 frames are less than 100, indicating that there is a phenomenon of missing video key frames. However, between 16 and 17 frames, between 24 and 25 frames, and between 119 and 120 frames, the matching pairs are greater than 350, indicating that there is a phenomenon of redundant extraction. In addition, the processing process of this method is time-consuming and inefficient. When the k-means clustering method is used to extract video key frames, by observing the frame sequence number and verifying the matching pairs of adjacent key frames, it is proved that the extraction accuracy of this method has been improved, but the time consumption is still serious, and it is difficult to meet the needs of efficiently extracting drone video key frames. The key frame extraction method based on camera motion estimation proposed in the present invention can accurately extract key frames according to the changes in motion parameters. This method can reduce omissions and redundancies, and has a very fast extraction speed, thus providing a more efficient and accurate method for extracting key frames from drone videos.
[0174] 3. Image fusion is the key to the quality of UAV stitching images. In order to test the effectiveness of the method of the present invention, a comparative experiment of the fusion method was carried out, and the performance of the fusion method was evaluated by subjective and objective evaluation. The splicing traces and detail differences of the fused image were observed for subjective evaluation; the spatial frequency (SF), standard deviation (SD), entropy (EN) and running time t were used to objectively evaluate the fusion algorithm.
[0175] Two adjacent key frames of the drone video are selected, and the two key frames are stitched using image warping, image warping + feathering fusion, image warping + optimal stitching, image warping + multi-band blending, image warping + Alpha fusion, and image warping + improved Alpha fusion. In order to verify the comprehensive performance of the proposed method in terms of the quality and efficiency of the stitched images, the objective evaluation data of each fused image are shown in Table 2.
[0176] Table 2 Objective evaluation of image fusion
[0177]
[0178] It can be seen from Table 2 that the image splicing marks cannot be processed by direct image warping or feathering fusion, optimal seam line and Alpha fusion based on image warping; the splicing mark problem can be solved by using multi-band blending, but the overall quality is low; and the improved Alpha fusion method proposed in the present invention can not only process the splicing marks, but also ensure the clarity of the image. Only using the image warping method without image fusion processing, although the speed is faster, the quality of the synthesized image is low. Although the feathering fusion and Alpha algorithms are slightly faster than the improved Alpha algorithm, the fusion effect is not good; and the multi-band blending method and the optimal seam line method are both time-consuming. Experiments have shown that the improved Alpha fusion method proposed in the present invention can quickly fuse two key frame images, and while retaining the image details, it can better adapt to the intensity and gradient changes in different regions, thereby producing a more natural fusion effect, and finally achieving high-quality image splicing.
[0179] In summary, the panoramic image synthesis method of drone aerial video proposed in the present invention can improve the accuracy and timeliness in video key frame extraction, and at the same time significantly solve the problem of splicing traces, thereby improving the synthesis quality of the panoramic image.
[0180] Example 2
[0181] This embodiment 2 describes a panoramic image synthesis system for drone aerial video, which is based on the same inventive concept as the panoramic image synthesis method for drone aerial video in embodiment 1.
[0182] The panoramic image synthesis system of drone aerial video mentioned in this embodiment is used to implement the steps of the panoramic image synthesis method of drone aerial video described in the above embodiment 1.
[0183] It should be noted that, in the panoramic image synthesis system of drone aerial video, the implementation process of the functions and effects of each functional module is specifically described in the implementation process of the corresponding steps in the method in Example 1, and will not be repeated here.
[0184] Example 3
[0185] This embodiment 3 describes a computer device, which includes a memory and one or more processors.
[0186] An executable code is stored in the memory. When the processor executes the executable code, it is used to implement the steps of the panoramic image synthesis method of the drone aerial video in the above-mentioned embodiment 1.
[0187] In this embodiment, the computer device is any device or apparatus with data processing capability, which will not be described in detail here.
[0188] Example 4
[0189] This embodiment 4 describes a computer-readable storage medium on which a program is stored. When the program is executed by a processor, it is used to implement the steps of a method for synthesizing a panoramic image of a drone aerial video.
[0190] The computer-readable storage medium can be an internal storage unit of any device or apparatus with data processing capabilities, such as a hard disk or memory, or an external storage device of any device with data processing capabilities, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), an SD card, a flash card, etc. equipped on the device.
[0191] Of course, the above description is only a preferred embodiment of the present invention, and the present invention is not limited to the above embodiments. It should be noted that all equivalent substitutions and obvious deformation forms made by any technician familiar with the field under the guidance of this specification fall within the essential scope of this specification and should be protected by the present invention.
Claims
1. A method for synthesizing a panoramic image of a drone aerial video, characterized in that: The steps include: Step 1. Load the drone aerial video; Assume that the video key frame extraction interval is T, that is, extract a frame as a key frame every T frames, T∈N + , N + is a positive integer; Step 2. Initialize the video key frame extraction interval T=T0, where T0 is the initial extraction interval; Step 3. Extract video key frames at intervals of T; Step 4. Perform feature detection and description on adjacent key frames of the extracted drone aerial video; Step 5. Complete image registration with the key frame images; Step 6. Use the RANSAC algorithm to solve the homography matrix between adjacent key frames of the drone aerial video; Step 7. Determine whether the video key frame extraction is completed; If there are still key frames that have not been extracted, go to step 8; if the key frame extraction is completed, end; Step 8. Decompose the obtained homography matrix to estimate the camera motion parameters, and update the video key frame extraction interval T according to the parameter changes, return to step 3, and use the updated T as the extraction interval of the next key frame; Step 9. Based on the homography matrix obtained in step 6, the homography matrix is optimized, and the optimized homography matrix is used to warp the current frame onto the previously stitched panoramic image; At the same time, based on the improved Alpha image fusion method, the stitching traces at the seams of the warped composite panorama are eliminated; Step 10. Synthesize the drone aerial panorama.
2. The method for synthesizing a panoramic image of a drone aerial video according to claim 1, characterized in that: In step 5, the key frame images are registered using a fast approximate nearest neighbor matching algorithm, and the process is as follows: Assume that the two adjacent key frames extracted are I k and I k+1 , define a k and a k+1 I k and I k+1 The feature points extracted by SURF algorithm are as follows: and The Euclidean distance between feature points is: Where d represents the Euclidean distance between feature points, i represents the sequence number of the feature descriptor, and n represents the number of feature descriptors; represents a descriptor on a key frame, Represents the descriptor on another keyframe; The ratio of the nearest neighbor to the next nearest neighbor of each pair of feature descriptors is used in I k+1 Found on I k The most matching feature point; The ratio r of the nearest neighbor to the next nearest neighbor is: In the formula, d1 represents the feature point a k with I k+1 The minimum Euclidean distance among all feature points on k+1,1 is the feature point corresponding to the minimum Euclidean distance d1, and d2 represents the feature point a k with I k+1 The second smallest Euclidean distance among all feature points above; If r is less than the preset threshold R Thre , then it is considered that the feature point a k with a k+1,1 are matching point pairs.
3. The panoramic image synthesis method of drone aerial video according to claim 1, characterized in that: The step 6 is specifically as follows: Assume that the two adjacent key frames extracted are I k and I k+1 , I k and I k+1 There is a transformation relationship between them: In the formula, is the homography matrix between two adjacent key frame images; According to the perspective transformation model: Homography matrix have A total of 8 parameters; Assume (x k,1 ,y k,1 ) and (x k+1,1 ,y k+1,1 ) is a pair of matching points before filtering two adjacent key frames. According to the perspective transformation relationship, we get: Right now: Using one pair of matching points, two equations can be established. Let the other three pairs of matching points be (x k,2 ,y k,2 ) and (x k+1,2 ,y k+1,2 )、(x k,3 ,y k,3 ) and (x k+1,3 ,y k+1,3 )、(x k,4 ,y k,4 ) and (x k+1,4 ,y k+1,4 ), and use four pairs of matching points to establish the following equation: The homography matrix can be obtained by using 4 pairs of matching points 4. The method for synthesizing a panoramic image of a drone aerial video according to claim 1, characterized in that: In step 8, the process of using the obtained homography matrix to decompose and estimate the camera motion parameters is as follows: According to the state changes between the images taken by the camera, define s c is the scaling factor, θ c is the rotation angle, t c.x is the horizontal translation, t c.y is the vertical translation, t c.x,y is the Euclidean distance of camera translation; Homography matrix between adjacent keyframes This breaks down into: in: In the formula, Q represents linear transformation including scaling, rotation and shearing, O represents displacement transformation, and P represents perspective effect; is the homography matrix 8 parameters of; According to the displacement transformation O, the following parameters can be calculated: Horizontal shift Vertical shift Euclidean distance of camera translation To calculate the scaling factor s c and the rotation angle θ c , the set of matching points x that are successfully paired k and x k+1 The transformation relationship between them is expressed as: x k+1 =s c Rx k +t c (10) Where R is the rotation matrix, t c is the translation vector; To calculate s c and R, for Perform singular value decomposition and get: Among them, U and V are orthogonal matrices, Σ is a diagonal matrix, and its expression is as follows: Extract the scaling factor s from the diagonal matrix c , use the orthogonal matrices U and V to obtain the rotation matrix R, the formula is as follows: θ c =arctan(sinθ c / cosθ c ) (14) The camera motion parameters, i.e. the Euclidean distance t of the camera translation, are estimated through the transformation relationship between the video key frames. c.x,y , scaling scale s c and the rotation angle θ c ; According to the changes in the camera motion state parameters, the video key frame extraction interval T is updated in real time.
5. The method for synthesizing a panoramic image of a drone aerial video according to claim 4, characterized in that: In step 8, the process of updating the video key frame extraction interval T is as follows: The relationship between the changes in camera parameters and the key frame extraction interval is shown in equations (15) to (17); Where, T s , T θ and T t Respectively represent the video key frame extraction intervals for scaling, rotation and translation changes; A1, A2 and A3 represent the preset parameter thresholds of scaling scale, rotation angle and translation amount respectively; η s , η θ and η t They represent the correlation coefficients corresponding to the scaling, rotation angle and translation respectively; According to the comprehensive changes of the camera zoom scale, rotation angle and translation, the video key frame extraction interval T is dynamically updated, and a comprehensive expression of the video key frame extraction interval T is constructed, as shown in formula (18): T=T0+T s +T θ +T t (18) The T updated by formula (18) is used as the extraction interval of the next key frame to extract the video key frame.
6. The method for synthesizing a panoramic image of a drone aerial video according to claim 1, characterized in that: In step 9, based on the homography matrix obtained in step 6, the homography matrix is optimized, and the process of using the optimized homography matrix to warp the current frame to the previously stitched panorama is as follows: First, set an offset to move the video key frame image to the same field of view, that is, transform the key frame to the same coordinate system, and then set the offset matrix to H offset Finally, the homography matrix between the second key frame placed in the field of view and the first key frame is obtained by premultiplying the offset matrix Combined with the homography matrix The formula is: In the formula, is the homography matrix between the first key frame and the second key frame; and are the offsets in the x and y directions respectively; From formula (4), we know that: in is the homography matrix between the second key frame and the third key frame; Further in, is the homography matrix between the third key frame and the fourth key frame,…, is the homography matrix between the n-1 keyframes and the nth keyframe; Therefore, the homography matrix between the nth key frame and the first key frame in the same field of view is: In the formula, is the homography matrix between the third key frame and the first key frame; is the homography matrix between the n-1th key frame and the n-2th key frame; is the homography matrix between the nth key frame and the first key frame; If the nth key frame is recorded as the current frame I t , formula (21) can be simplified as: Among them, H t represents the homography matrix between the current frame and the first key frame, H t-1 represents the homography matrix between the t-1 keyframe and the 1st keyframe, Indicates the current key frame I t The homography matrix between t-1th key frame; Next, a local optimization method is proposed to reduce the cumulative error. t When it is a key frame, not only the previous frame I is calculated t-1 To the position of the current frame, we also need to calculate the position from all previous key frames to the current frame; Store each keyframe I i The position information of the current frame I t Matching relative keyframe, i<t; Current frame I t With a previous keyframe I i When the difference of the homography matrix between them is less than the preset threshold P, I i It is considered to be the frame before the current frame I k Relative reference frames, all relative reference frames constitute a candidate frame set S; S={I m |ΔH(I m ,I t )<P,0≤m≤t} (22) Among them, I m Indicates the current frame I t With a previous keyframe I i The homography matrix difference ΔH(I m ,I t ) is less than the preset threshold P, I t Indicates the current frame, ΔH(I m ,I t ) represents the homography matrix difference; Calculate the homography matrix of the candidate frames in the current frame pair set S; Define each frame I in the set S t1 ,I t2 ,…,I tn The homography matrices to the base plane, i.e. the same field of view, are H t1 ,H t2 ,…,H tn ; For any key frame I in the set S ti , obtained from I t To I ti The homography matrix Then the candidate homography matrix from the current frame to the base plane is as shown in formula (23): Calculate all candidate homography matrices and find the optimal homography matrix. The specific process is as follows: The weighted reprojection error is used as the criterion for determining whether the homography is optimal, and is defined as follows: Where E(i) represents the weighted reprojection error, C ti ∩C t Representative I t and I tj The function proj(x,H) represents the coordinates of the feature points in the key frame after projecting them back to the reference plane through the homography matrix H; ΔH(t,tj) represents the homography matrix difference between the current frame and the candidate frame; represents the x coordinate of the feature point in the candidate frame, H tj represents the candidate frame homography matrix, Indicates the x coordinate of the feature point in the current frame, H t (i) represents the candidate homography matrix, represents the x-coordinate of the feature point in the candidate frame, Indicates the y coordinate of the feature point in the current frame; H tj and H t (i) is the homography matrix of different candidate frames; Use ΔH(t,tj) to balance the difference in the number of feature points between different matching image pairs; Where m is the index of the best coordinate system found; The best coordinate system matching the current coordinate system is determined by formula (25), and I t To I tm The homography of projects the current coordinate system onto the base plane and determines the current frame I t The homography to the base plane is given by: H t =H t (m) (26) Among them, H t represents the optimal homography matrix, H t (m) represents the homography matrix in the optimal coordinate system; the optimal homography matrix H is obtained by using t , warping the current frame onto the previously stitched panorama.
7. The method for synthesizing a panoramic image of a drone aerial video according to claim 1, characterized in that: In step 9, the process of the image fusion method based on improved Alpha is as follows: When compositing, set the Alpha channel to control the proportion of each pixel in the new image from the original image. The fusion equation is: Where (x, y) represents the pixel coordinates, C(x, y) represents the final fused image, A(x, y) represents one image, B(x, y) represents another image, α1 and α2 are the weight coefficients of the reference image and the image to be fused, and the conditions are met: Define an adaptive Alpha value, using α L It is expressed as shown in formula (29): Where, L k and L k+1 is the image intensity of two adjacent key frames, l is the intensity adaptation coefficient; According to the gradient information of the image, a method for calculating the Alpha value based on gradient changes is proposed as follows: First, the Sobel operator is used to calculate the horizontal gradient of the image, and then the gradient difference between the original image and the transformed image is compared, and finally the adaptive Alpha value based on the gradient is obtained. G It is expressed as shown in formula (30): In the formula, G k and G k+1 are the gradients of two adjacent key frame images, g is the gradient adaptation coefficient, and τ is a positive number; According to formula (28) and combined with adaptive intensity information and gradient-based features, a weight parameter is introduced to define the final Alpha value, as shown in formula (31): In the formula, w L and w G It is a weight parameter that flexibly adjusts the contribution ratio of intensity and gradient in image fusion; Substitute the obtained α1 and α2 into formula (27) to obtain the improved stitched image.
8. A panoramic image synthesis system for drone aerial video, characterized in that: Steps for implementing the panoramic image synthesis method of drone aerial video as described in any one of claims 1 to 7 above.
9. A computer device comprising a memory and one or more processors, wherein the memory stores executable code, characterized in that: When the processor executes the executable code, the steps of the panoramic image synthesis method of the drone aerial video as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a program stored thereon, characterized in that: When the program is executed by a processor, the steps of the panoramic image synthesis method of drone aerial video as described in any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Unmanned aerial vehicle continuous frame image splicing method and system
CN120125431A
Multi-target tracking method and system under fast motion view angle of unmanned aerial vehicle
CN121236119A
Scene-adaptive online learning for video post processing
US12707099B2
Scene-adaptive online learning for video post processing
US20260075255A1
