Multi-video cutting and splicing method, system, electronic device and storage medium
When aerial photography of the highway by drone, video sorting and splicing are used to sort and splice video frames, which solves the shortcomings of video frame information accuracy and chronological splicing methods, and achieves high precision and high efficiency Video stitching.
Patent Information
- Application Number
- CN202410573843.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-10
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-05-10
AI Technical Summary
In the prior art, when taking aerial photography of a highway by drone, it is difficult to ensure the accuracy of information in video frames, and the chronological splicing method is not suitable for multiple drone airport scenes in drone aerial photography.
The drone takes highway video in segments, obtains the latitude, yaw angle and pitch angle of each frame of image, calculates the average latitude, longitude or median latitude and longitude for sorting, deletes the fully contained video clips, and performs based on the sorted video sequence. Video stitching, removing duplicate and abnormal parts.
The precise splicing of drone aerial videos is realized, and the duplicate parts in the video and abnormal operations of drones are removed. The generated integrated videos are merged in geographical location order, suitable for multi-drone collaborative aerial photography scenarios.
Smart Images

Figure CN118632072B_ABST
Abstract
Description
Background Art
[0002] In today's society, with the rapid development of the drone industry, the functions of drone aerial photography have become more and more perfect, and the advantages of drones in photography have become more and more prominent. Nowadays, the development of drones from a technical perspective has become relatively mature. Compared with other shooting methods, drone aerial photography has the characteristics of low cost, easy operation, and strong flexibility, and has gradually become a mainstream aerial photography tool. After decades of development, drones are relatively mature from a technical perspective. They are low-cost, easy to operate, and highly flexible. They can carry some important equipment to complete special tasks from the air, such as aerial monitoring, aerial surveillance, aerial relay, aerial shouting, emergency rescue, etc. When performing special tasks, they have strong survivability, good maneuverability, and are easy to use. They can play an important role in dealing with natural disasters, accidents and disasters, and social security incidents.
[0003] The basic topographic map of a city is the most basic geographic information for urban construction, planning management, land and resources management, etc. It plays an increasingly important role in many fields such as urban planning, construction, transportation, management, social and public services, and sustainable development research. The requirements for the accuracy and coverage of basic topographic maps are also getting higher and higher. UAV low-altitude remote sensing technology is a new development direction for urban management planning and surveying. It has been gradually applied to aerial survey of large-scale urban topographic maps. With its own technical advantages, it can quickly and efficiently obtain high-precision and high-resolution image data, becoming an effective supplement to traditional manual measurement. When the usage scenario is to use a drone to take aerial photos of the entire highway to be built, the existing technologies are as follows:
[0004] 1) In the invention patent with publication number CN116309080A and subject name “A method for stitching drone videos”, the feature information of the video frames is obtained by convolution technology to perform data matching based on similarity, and then the matching image frames are fused by image fusion technology to combine the images in the two videos of the frame to remove duplicate frames. The disadvantages are:
[0005] In the process of depicting the highway by drone, accurate information in each video frame is needed to obtain a more accurate tunnel concept map based on the corresponding data in the video frame. The general image fusion method cannot guarantee the accuracy of the data when fusing video frames. In order to ensure that each video frame has accurate parameter information, the present invention does not consider using image fusion to process repeated frames.
[0006] 2) In the invention patent with publication number CN112544071A and subject name “Video splicing method, device and system”, video clips are spliced based on time sequence, and then the overlapping clips in two videos are scored using their own scoring system, and the clips with higher scores are retained and the clips with lower scores are cut off, so as to achieve low-precision splicing between multiple videos. The disadvantages are:
[0007] In the process of constructing the highway with drone aerial photography, the time sequence cannot be used as a way to sort. Because there is no guarantee that the shooting order of each section of the road is from the starting point to the end of the road. There are multiple drone airports on the entire highway, and multiple drones are responsible for a section of mileage respectively. In this case, the time sequence will lose its meaning and is not applicable to this scenario. Secondly, the repeated sections of this scenario are not suitable for the scoring system. In this scenario, each frame in each video already has flight data. Moreover, there may be only one or two variables (such as pitch angle and yaw angle) that determine whether the repeated part of each video is retained or intercepted, and because the last part of each video is more likely to have abnormal conditions, in most cases, the overlapping part of the latter video will be retained and the overlapping part of the previous video will be cut off. In this case, the scoring system is not applicable to this scenario. Summary of the invention
[0008] The technical problem to be solved by the present invention is to address the deficiencies of the prior art and specifically provide a multi-video cropping and splicing method, system, electronic device and storage medium, which are as follows:
[0009] 1) In the first aspect, the present invention provides a method for cutting and splicing multiple videos, and the specific technical solution is as follows:
[0010] Use drones to shoot segmented videos of the entire geographical environment of the highway to be built;
[0011] After pre-processing multiple videos shot by the drone, multiple videos to be stitched are obtained;
[0012] Obtain the latitude and longitude, yaw angle and pitch angle of each frame of the video to be stitched;
[0013] Calculate the average longitude and latitude or the median longitude and latitude of each video to be spliced, and sort all the videos to be spliced in ascending order to obtain a first video sequence;
[0014] Compare each adjacent two segments of the videos to be spliced in the first video sequence in turn, delete the videos to be spliced that are completely included, and sort the average longitude and latitude or the median longitude and latitude of each of the remaining videos to be spliced in order from small to large, to obtain a second video sequence;
[0015] Video stitching is performed based on the second video sequence and the latitude and longitude, yaw angle and pitch angle of each frame image in each video to be stitched in the second video sequence to obtain a stitched integrated video.
[0016] The beneficial effects of the multi-video cropping and splicing method provided by the present invention are as follows:
[0017] It is able to merge multiple videos taken by drones into one video, i.e. a spliced integrated video, in the order of the geographical locations of the highway to be built. During the splicing process, the repeated parts in the video are deleted, and abnormal situations such as hovering, pitching, yaw, etc. of the drone in the video are removed.
[0018] Based on the above solution, the multi-video cropping and splicing method of the present invention can also be improved as follows.
[0019] Further, video stitching is performed based on the second video sequence and the latitude and longitude, yaw angle, and pitch angle of each frame image in each video to be stitched in the second video sequence to obtain a stitched integrated video, including:
[0020] Determine whether the longitude and latitude of the i-th frame image of the k-th segment of the video to be spliced in the second video sequence is less than the longitude and latitude of the first frame image of the k+1-th segment of the video to be spliced, and obtain a first judgment result. When the first judgment result is yes, determine whether the yaw angle difference and the pitch angle difference between the i-th frame image of the k-th segment of the video to be spliced and the i-1-th frame image of the k-th segment of the video to be spliced are both within the corresponding range, and obtain a second judgment result. When the second judgment result is yes, splice the i-th frame image of the k-th segment of the video to be spliced into the integrated video, and continue to determine whether the longitude and latitude of the i+1-th frame image of the k-th segment of the video to be spliced in the second video sequence is less than the k+1-th frame image. When the second judgment result is no, continue to judge whether the longitude and latitude of the i+1th frame image of the kth video to be spliced in the second video sequence is less than the longitude and latitude of the first frame image of the k+1th video to be spliced. When the first judgment result is no, continue to judge whether the longitude and latitude of the i-th frame image of the k+1th video to be spliced in the second video sequence is less than the longitude and latitude of the first frame image of the k+2th video to be spliced; until all images except the first frame image in each video to be spliced in the second video sequence are traversed to obtain a spliced integrated video, k and i are both positive integers, and k≥1, i≥2.
[0021] Furthermore, after preprocessing the multiple videos shot by the drone, multiple videos to be stitched are obtained, including:
[0022] By using the pre-drawn engineering drawings of the highway to be built, the position of the highway in each frame of each video taken by the drone is calculated, the engineering drawings are cropped, and the part of the engineering drawings of the highway to be built corresponding to each frame is cut out. Then, after perspective operation, the part of the engineering drawings of the highway to be built corresponding to each frame are superimposed on the corresponding images respectively, and resolution compression processing is performed to obtain multiple videos to be spliced.
[0023] Furthermore, after obtaining the multiple videos to be spliced, the method further includes: performing resolution compression processing on each video to be spliced.
[0024] Furthermore, it also includes:
[0025] When the duration of the spliced integrated video exceeds the preset duration, the duration of the spliced integrated video is processed at a double speed.
[0026] 2) In the second aspect, the present invention also provides a multi-video cropping and splicing system, and the specific technical solution is as follows:
[0027] It includes a multi-video shooting module, a multi-video preprocessing module, an image shooting information acquisition module, a first sorting module, a second sorting module and a multi-video stitching module;
[0028] The multi-video shooting module is used to: shoot videos of the geographical environment of the entire highway to be built in sections by using drones;
[0029] The multi-video preprocessing module is used to preprocess multiple videos shot by the drone to obtain multiple videos to be spliced;
[0030] The image shooting information acquisition module is used to: obtain the latitude and longitude, yaw angle and pitch angle of each frame image in each video to be spliced;
[0031] The first sorting module is used to: calculate the average longitude and latitude or the median longitude and latitude of each video to be spliced, and sort all the videos to be spliced in ascending order to obtain a first video sequence;
[0032] The second sorting module is used to: sequentially compare each two adjacent videos to be spliced in the first video sequence, delete the videos to be spliced that are completely included, and sort the average longitude and latitude or the median longitude and latitude of each remaining video to be spliced in order from small to large, to obtain a second video sequence;
[0033] The multi-video stitching module is used to stitch videos based on the second video sequence and the longitude and latitude, yaw angle and pitch angle of each frame image in each video to be stitched in the second video sequence to obtain a stitched integrated video.
[0034] Based on the above solution, the multi-video cropping and splicing system of the present invention can also be improved as follows.
[0035] The multi-video splicing module is specifically used for:
[0036] Determine whether the longitude and latitude of the i-th frame image of the k-th segment of the video to be spliced in the second video sequence is less than the longitude and latitude of the first frame image of the k+1-th segment of the video to be spliced, and obtain a first judgment result. When the first judgment result is yes, determine whether the yaw angle difference and the pitch angle difference between the i-th frame image of the k-th segment of the video to be spliced and the i-1-th frame image of the k-th segment of the video to be spliced are both within the corresponding range, and obtain a second judgment result. When the second judgment result is yes, splice the i-th frame image of the k-th segment of the video to be spliced into the integrated video, and continue to determine whether the longitude and latitude of the i+1-th frame image of the k-th segment of the video to be spliced in the second video sequence is less than the k+1-th frame image. When the second judgment result is no, continue to judge whether the longitude and latitude of the i+1th frame image of the kth video to be spliced in the second video sequence is less than the longitude and latitude of the first frame image of the k+1th video to be spliced. When the first judgment result is no, continue to judge whether the longitude and latitude of the i-th frame image of the k+1th video to be spliced in the second video sequence is less than the longitude and latitude of the first frame image of the k+2th video to be spliced; until all images except the first frame image in each video to be spliced in the second video sequence are traversed to obtain a spliced integrated video, k and i are both positive integers, and k≥1, i≥2.
[0037] Furthermore, the multi-video preprocessing module is specifically used for:
[0038] By using the pre-drawn engineering drawings of the highway to be built, the position of the highway in each frame of each video taken by the drone is calculated, the engineering drawings are cropped, and the part of the engineering drawings of the highway to be built corresponding to each frame is cut out. Then, the part of the engineering drawings of the highway to be built corresponding to each frame is perspective-operated and superimposed on the corresponding images to obtain multiple videos to be spliced.
[0039] Furthermore, the multi-video preprocessing module is specifically used for:
[0040] By using the pre-drawn engineering drawings of the highway to be built, the position of the highway in each frame of each video taken by the drone is calculated, the engineering drawings are cropped, and the part of the engineering drawings of the highway to be built corresponding to each frame is cut out. Then, after perspective operation, the part of the engineering drawings of the highway to be built corresponding to each frame are superimposed on the corresponding images respectively, and resolution compression processing is performed to obtain multiple videos to be spliced.
[0041] Furthermore, it also includes a speed processing module, which is used for:
[0042] When the duration of the spliced integrated video exceeds the preset duration, the duration of the spliced integrated video is processed at a double speed.
[0043] 3) In a third aspect, the present invention further provides an electronic device, comprising a processor, the processor being coupled to a memory, the memory storing at least one computer program, the at least one computer program being loaded and executed by the processor, so that the electronic device implements any of the above-mentioned multi-video cropping and splicing methods.
[0044] 4) In a fourth aspect, the present invention further provides a computer-readable storage medium, in which at least one computer program is stored, and the at least one computer program is loaded and executed by a processor so that a computer implements any of the above-mentioned multi-video cropping and splicing methods.
[0045] It should be noted that the beneficial effects achieved by the technical solutions of the second to fourth aspects of the present invention and the corresponding possible implementation methods can be found in the above-mentioned technical effects of the first aspect and its corresponding possible implementation methods, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0047] Figure 1 This is one of the flowchart diagrams of a multi-video cropping and splicing method according to an embodiment of the present invention;
[0048] Figure 2 A schematic diagram of a situation where part of the information in the first video to be spliced is omitted;
[0049] Figure 3 The second flowchart of a multi-video cropping and splicing method according to an embodiment of the present invention;
[0050] Figure 4 A schematic diagram of the structure of a multi-video cropping and splicing system according to an embodiment of the present invention;
[0051] Figure 5 The figure is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0052] In order to make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0053] like Figure 1 As shown, a multi-video cropping and splicing method according to an embodiment of the present invention comprises the following steps:
[0054] S1, shooting multiple videos in segments, specifically, shooting the videos of the geographical environment of the entire highway to be built in segments by using a drone;
[0055] S2, video preprocessing, specifically, preprocessing multiple videos shot by the drone to obtain multiple videos to be spliced;
[0056] S3, obtaining the latitude and longitude, yaw angle and pitch angle of each frame image in each video to be stitched, specifically:
[0057] Generally speaking, the parameter information in the video files shot by drones includes not only longitude and latitude, but also absolute altitude, relative altitude, yaw angle, pitch angle and other information. These parameter information are saved in the flight data ".srt" file. The flight data ".srt" file records the parameter information of each frame of image (also called flight data). From the flight data ".srt" file, the longitude and latitude, yaw angle and pitch angle of each frame of image in each video to be spliced can be read.
[0058] S4, first sorting, specifically: calculating the average longitude and latitude or the median longitude and latitude of each video to be spliced, and sorting all the videos to be spliced in ascending order to obtain a first video sequence;
[0059] The specific process of calculating the average longitude and latitude of each video to be spliced is as follows: the sum of all frame images of any video to be spliced is divided by the total number of frames of the image in the video to be spliced to obtain the average longitude and latitude of the video to be spliced, until the average longitude and latitude of each video to be spliced is calculated.
[0060] Among them, the specific process of calculating the median longitude and latitude of each video to be spliced is: sort the longitude and latitude of each frame of any video to be spliced according to the size of the longitude and latitude, and obtain the median longitude and latitude of the video to be spliced from the sorted sequence until the median longitude and latitude of each video to be spliced is calculated.
[0061] S5, sorting for the second time, specifically: comparing each two adjacent videos to be spliced in the first video sequence in turn, deleting the videos to be spliced that are completely included, and sorting the average longitude and latitude or the median longitude and latitude of each of the remaining videos to be spliced in order from small to large, to obtain a second video sequence;
[0062] Compare each two adjacent videos to be spliced in the first video sequence in turn, and delete the videos to be spliced that are completely included. The specific implementation process is as follows:
[0063] Obtain the longitude and latitude of the first frame image (first frame image) and the last frame image of each video to be spliced in the first video sequence. For any two adjacent videos to be spliced, compare the longitude and latitude of the first frame image and the last frame image of the two videos to be spliced, determine and delete the videos to be spliced that are completely included, and record any two adjacent videos to be spliced as the first video to be spliced and the second video to be spliced, respectively. When the longitude and latitude of the first frame image of the second video to be spliced is greater than the longitude and latitude of the first frame image of the first video to be spliced When the latitude and longitude of the last frame image of the second video to be spliced is less than the latitude and longitude of the last frame image of the first video to be spliced, the second video to be spliced can be regarded as being completely contained by the first video to be spliced, that is, the second video to be spliced is a video to be spliced that is completely contained. In this case, if the video to be spliced that is completely contained is not deleted, the non-overlapping part in the first video to be spliced will be written first. After encountering the part overlapping with the second video to be spliced, all the shadow parts of the first video to be spliced will be cut off. There will be a situation where some information in the first video to be spliced is omitted. To avoid this situation, the present invention considers that before writing into the integrated video, it is necessary to delete the video to be spliced that is completely contained, specifically by comparing each adjacent two segments of the video to be spliced in the first video sequence in turn. If there is a video to be spliced that is completely contained, it is deleted for the convenience of subsequent video processing.
[0064] S6, video stitching, specifically: performing video stitching based on the second video sequence and the longitude and latitude, yaw angle and pitch angle of each frame image in each video to be stitched in the second video sequence to obtain a stitched integrated video.
[0065] Optionally, in S6, video stitching is performed based on the second video sequence and the latitude and longitude, yaw angle and pitch angle of each frame image in each video to be stitched in the second video sequence to obtain a stitched integrated video, including:
[0066] S60, determine whether the longitude and latitude of the i-th frame image of the k-th segment of the video to be spliced in the second video sequence is less than the longitude and latitude of the first frame image of the k+1-th segment of the video to be spliced, and obtain a first determination result. When the first determination result is yes, determine whether the yaw angle difference and the pitch angle difference between the i-th frame image of the k-th segment of the video to be spliced and the i-1-th frame image of the k-th segment of the video to be spliced are both within the corresponding range, and obtain a second determination result. When the second determination result is yes, splice the i-th frame image of the k-th segment of the video to be spliced into the integrated video, and continue to determine whether the longitude and latitude of the i+1-th frame image of the k-th segment of the video to be spliced in the second video sequence is less than the longitude and latitude of the k-th segment of the video to be spliced. +1 segment to be spliced video to determine the longitude and latitude of the first frame image of the k+1 segment to be spliced. When the second judgment result is no, continue to judge whether the longitude and latitude of the i+1th frame image of the kth segment to be spliced in the second video sequence is less than the longitude and latitude of the first frame image of the k+1th segment to be spliced. When the first judgment result is no, continue to judge whether the longitude and latitude of the i-th frame image of the k+1th segment to be spliced in the second video sequence is less than the longitude and latitude of the first frame image of the k+2th segment to be spliced; until all images except the first frame image in each segment to be spliced in the second video sequence are traversed to obtain a spliced integrated video, k and i are both positive integers, and k≥1, i≥2.
[0067] Optionally, in S2, multiple videos shot by the drone are preprocessed to obtain multiple videos to be stitched, which can be achieved by the following two methods:
[0068] 1) The first implementation method: through the pre-drawn engineering drawings of the highway to be built, the location of the highway in each frame of each video taken by the drone is calculated, the engineering drawings are cropped, and the part of the engineering drawings of the highway to be built corresponding to each frame is cut out. Then, the part of the engineering drawings of the highway to be built corresponding to each frame is perspectively operated and superimposed on the corresponding images respectively to obtain multiple videos to be spliced.
[0069] 2) The second implementation method: Through the pre-drawn engineering drawings of the highway to be built, the position of the highway in each frame of each video taken by the drone is calculated, the engineering drawings are cropped, and the part of the engineering drawings of the highway to be built corresponding to each frame is cut out. Then, the part of the engineering drawings of the highway to be built corresponding to each frame is perspectively operated, and then superimposed on the corresponding images respectively, and resolution compression processing is performed to obtain multiple videos to be spliced.
[0070] The specific description of the resolution compression process is as follows:
[0071] The video resolution captured by general drone aerial photography is 4k (3840×2160), which is a matrix of 3840 columns and 2160 rows for image processing, and the video processing time is very long. Moreover, the total distance of the entire section of the highway to be built can be more than 100 kilometers. Therefore, even if the entire section of the highway to be built is split into multiple sections for shooting and processing, each video file is still too large. In this case, in order to ensure that there will be no impact on subsequent video processing and to improve the efficiency of video processing, it is possible to consider performing a judgment, that is, if the resolution of the read video is not 1080p (1920×1080), adjust its resolution to 1080p. This not only defines a standard for the resolution of the integrated video, but also improves the efficiency of video processing.
[0072] Optionally, in the above technical solution, it also includes:
[0073] S7. When the duration of the spliced integrated video exceeds the preset duration, the duration of the spliced integrated video is processed at a double speed. The preset duration can be set according to actual conditions.
[0074] Due to the flight speed limit of the drone itself and the total length of general highways that are longer than hundreds of kilometers, if the integration and splicing are performed at the original speed, the length of the spliced integrated video will be very long, which will affect the subsequent processing efficiency of the spliced integrated video.
[0075] In this case, the spliced integrated video needs to be processed at a double speed. Usually, the final spliced integrated video is controlled to be about 30 minutes long, and the total time required for aerial photography of a highway of more than 100 kilometers is about 2 hours. In this case, the total video needs to be processed at 4 times the speed to reduce the time.
[0076] Among them, the method of reducing the total length of the video is to perform frame extraction processing on the video. For example, if the spliced integrated video needs to be processed at 4 times the speed, one frame can be read from the spliced integrated video every 4 frames and written into the final spliced integrated video. In this case, the playback speed of the final spliced integrated video is also 4 times the original, and the size of the final spliced integrated video is also reduced to a quarter of the size of the spliced integrated video. At the same time, the effective information in the final spliced integrated video will not be affected at all.
[0077] like Figure 3 As shown, the present invention is further described by the following examples:
[0078] S101, shooting multiple videos in segments. Specifically, using a drone to shoot videos of the geographical environment of the entire highway to be built in segments.
[0079] S102: Draw a CAD drawing. Specifically, draw a CAD drawing simulating the expressway to be built according to the geographical environment.
[0080] S103, obtaining multiple videos to be spliced, specifically:
[0081] Through coordinate matching calculation between the CAD drawing and the engineering drawing of the highway to be built, the position of the highway in each frame image in each video shot by the drone is calculated, and the part of the engineering drawing of the highway to be built corresponding to each frame image in each video is intercepted from the pre-drawn engineering drawing of the highway to be built, that is, the engineering drawing is cropped, and the part of the engineering drawing of the highway to be built corresponding to each frame image is intercepted, and then the part of the engineering drawing of the highway to be built corresponding to each frame image is perspectively operated, respectively superimposed on the corresponding image, and resolution compression processing is performed to obtain multiple videos to be spliced.
[0082] S104: Obtain the longitude and latitude, yaw angle, and pitch angle of each frame of image in each segment of video to be stitched.
[0083] S105: Obtain a first video sequence, specifically:
[0084] The average longitude and latitude or the median longitude and latitude of each video to be spliced is calculated, and all the videos to be spliced are sorted in ascending order to obtain a first video sequence.
[0085] S106: Obtain a second video sequence, specifically:
[0086] Compare each two adjacent videos to be spliced in the first video sequence in turn, delete the videos to be spliced that are completely contained in the videos to be spliced, and sort the remaining videos to be spliced in ascending order according to the average longitude and latitude or the median of the longitude and latitude of each remaining video to be spliced, to obtain a second video sequence.
[0087] S107, determining whether the longitude and latitude of the i-th frame image of the k-th segment to be stitched video in the second video sequence is less than the longitude and latitude of the first frame image of the k+1-th segment to be stitched video, and obtaining a first determination result. When the first determination result is yes, executing S108. When the first determination result is no, continuing to determine whether the longitude and latitude of the i-th frame image of the k+1-th segment to be stitched video in the second video sequence is less than the longitude and latitude of the first frame image of the k+2-th segment to be stitched video;
[0088] S108, judging whether the yaw angle difference and the pitch angle difference between the i-th frame image of the k-th segment of the video to be stitched and the i-1-th image of the k-th segment of the video to be stitched are both within the corresponding range, and obtaining a second judgment result. When the second judgment result is yes, executing S109, when the second judgment result is no, judging whether the longitude and latitude of the i+1-th frame image of the k-th segment of the video to be stitched in the second video sequence is less than the longitude and latitude of the first frame image of the k+1-th segment of the video to be stitched;
[0089] Among them, the range corresponding to the yaw angle difference and the range corresponding to the pitch angle difference can be preset according to actual conditions.
[0090] S109, stitching the i-th frame image of the k-th video to be stitched into the integrated video, and continuing to determine whether the longitude and latitude of the i+1-th frame image of the k-th video to be stitched in the second video sequence is less than the longitude and latitude of the first frame image of the k+1-th video to be stitched;
[0091] S110, obtaining a spliced integrated video: by repeatedly executing S106 to S109, all images except the first frame image in each video to be spliced in the second video sequence are traversed to obtain a spliced integrated video. It should be noted that, by default, the first frame image in each video to be spliced in the second video sequence is not spliced into the integrated video.
[0092] S111. When the duration of the spliced integrated video exceeds a preset duration, the duration of the spliced integrated video is processed at a double speed to obtain a final spliced integrated video, wherein the preset duration can be set according to actual conditions.
[0093] It should be noted that the number of image frames in each video to be spliced in the second video sequence may be the same or different. When the number of image frames in each video to be spliced in the second video sequence is different, the corresponding range of i is also different, and i can be considered as a variable.
[0094] Taking k=1 and i=2 as an example, the process from S107 to S109 is described as follows:
[0095] S1070, determining whether the longitude and latitude of the second frame image of the first segment of the video to be spliced in the second video sequence is less than the longitude and latitude of the first frame image of the second segment of the video to be spliced, and obtaining a first determination result. When the first determination result is yes, executing S1080. When the first determination result is no, continuing to determine whether the longitude and latitude of the second frame image of the second segment of the video to be spliced in the second video sequence is less than the longitude and latitude of the first frame image of the third segment of the video to be spliced;
[0096] S1080, determining whether the yaw angle difference and the pitch angle difference between the second frame image of the first segment of the video to be stitched and the first frame image of the first segment of the video to be stitched are both within the corresponding range, and obtaining a second determination result. When the second determination result is yes, executing S1090. When the second determination result is no, determining whether the longitude and latitude of the third frame image of the kth segment of the video to be stitched in the second video sequence is less than the longitude and latitude of the first frame image of the second segment of the video to be stitched;
[0097] S1090, stitching the i-th frame image of the first segment of the video to be stitched into the integrated video, and continuing to determine whether the longitude and latitude of the third frame image of the first segment of the video to be stitched in the second video sequence is less than the longitude and latitude of the first frame image of the second segment of the video to be stitched.
[0098] In another embodiment, the location of the highway in each frame of each video shot by the drone is calculated by using a pre-drawn engineering drawing of the highway to be built, the engineering drawing is cropped, and the portion of the highway to be built corresponding to each frame is cut out. The frames are then superimposed after perspective operation to obtain multiple videos to be spliced, and then resolution compression processing is performed on each video to be spliced, and then S104 to S111 in the above embodiment are executed on the multiple videos to be spliced after the resolution compression processing.
[0099] In another embodiment, after obtaining multiple videos to be spliced through the first implementation method mentioned above (using a pre-drawn engineering drawing of the highway to be built, calculating the position of the highway in each frame of each video taken by the drone, cropping the engineering drawing, cutting out the part of the engineering drawing of the highway to be built corresponding to each frame, and then performing a perspective operation on the part of the engineering drawing of the highway to be built corresponding to each frame, and superimposing them on the corresponding images respectively to obtain multiple videos to be spliced), resolution compression processing is performed on the multiple videos to be spliced, and then the resolution-compressed videos to be spliced are used as the videos to be spliced in S3, so as to execute S3 to S6 to achieve video splicing.
[0100] In another embodiment, comprising:
[0101] 1) Read n videos to be stitched in the folder and obtain the latitude and longitude, yaw angle, and pitch angle parameters from the parameter information in the video.
[0102] 2) Perform resolution compression processing on all videos to be spliced;
[0103] 3) Calculate the average longitude and latitude of each video to be stitched and sort them from small to large;
[0104] 4) Record the average longitude and latitude of the first frame and the last frame of each video to be spliced, compare the average longitude and latitude of the first frame and the last frame of two adjacent videos to be spliced, and delete all the included videos to be spliced;
[0105] 5) Determine whether the longitude and latitude of the i-th frame image in the k-th video to be stitched is less than the longitude and latitude of the first frame image of the next video to be stitched. If so, continue to perform subsequent judgments. Otherwise, k++, go to the next video to be stitched.
[0106] 6) From the second frame image, determine whether the yaw angle difference and pitch angle difference between the frame image and the previous frame image are both within the corresponding range. If the conditions are met, write all images in the segment of the video to be stitched whose longitude and latitude are smaller than the first frame image of the next video to be stitched into the integrated video. Otherwise, k++, go to the next video to be stitched;
[0107] 7) After obtaining the spliced integrated video, if the duration of the spliced integrated video is too long, it is processed at a double speed. That is, when the duration of the spliced integrated video exceeds the preset duration, the duration of the spliced integrated video is processed at a double speed.
[0108] The present invention sorts n videos by taking the order of longitude and latitude as an example. Of course, these videos can also be sorted by other parameter size orders without loss of generality. In addition to longitude and latitude, the parameter information in general drone video files also includes absolute altitude, relative altitude, yaw angle, pitch angle and other information. Under certain circumstances, this information can also be used as a sequence to sort the videos. It can be said that as long as there is flight data corresponding to the video, the present invention can be used to realize sequential splicing and selective cropping of the video. Among them, the n videos to be spliced in the folder are read and the longitude and latitude, yaw angle, and pitch angle parameters are obtained from the parameter information in the video. The specific implementation process is as follows:
[0109] Read all the video files in the folder and the flight data ".srt" files corresponding to the video files. These files record the flight data of each frame. These data can be read to help sort and crop the spliced videos. Due to the needs of this scene, the parameters such as longitude and latitude, yaw angle, and pitch angle can be read to facilitate subsequent processing.
[0110] Among them, all the videos to be spliced are subjected to resolution compression processing, and the specific implementation process is as follows:
[0111] The video resolution captured by general drone aerial photography is 4k (3840×2160), which is a matrix of 3840 columns and 2160 rows for image processing, and the video processing time is very long. Moreover, the total distance of the entire highway is more than 100 kilometers, so even if the total distance is split into multiple sections for shooting and processing, each video file is still too large. In this case, in order to ensure that there will be no impact on subsequent video processing and to improve the efficiency of video processing, you can consider performing a judgment, that is, if the resolution of the read video is not 1080p (1920×1080), adjust its resolution to 1080p. This not only defines a standard for the resolution of the integrated video, but also improves the efficiency of video processing.
[0112] Among them, the average longitude and latitude of each video to be stitched is calculated and sorted from small to large. The specific implementation process is as follows:
[0113] The average longitude and latitude in each video to be spliced is very easy to calculate. The total number of frames of a video to be spliced can be read, that is, the total length of the video to be spliced multiplied by the number of frames per second. Then add up the coordinate values of each frame. In this way, the accumulated value of the video coordinates is divided by the total number of frames to get the average coordinate value of each video. Later, all the videos to be spliced can be sorted in ascending order by bubble sorting, preparing for the subsequent splicing of the videos to be spliced in order.
[0114] Among them, the average longitude and latitude of the first frame image and the last frame image of two adjacent videos to be stitched are compared, and all the included videos to be stitched are deleted. The specific implementation process is as follows:
[0115] The first longitude and latitude information in the flight data corresponding to each video can be read and recorded. At the same time, when calculating the average longitude and latitude, it must be added to the longitude and latitude corresponding to the last frame of the video to be stitched for calculation. Therefore, the longitude and latitude of the first frame and the last frame of each video to be stitched are easy to obtain. The purpose of obtaining the coordinate values of the first frame and the last frame is to describe the position of the overlapping part of the video to be stitched, so as to facilitate subsequent data processing. At the same time, some special situations may occur during the video shooting process, such as Figure 2As shown, the coordinate value of the first frame of the second video to be spliced is greater than the coordinate value of the first frame of the first video to be spliced, and the coordinate value of the last frame of the second video to be spliced is less than the coordinate value of the last frame of the first video to be spliced. In this case, the second video to be spliced can be regarded as being included in the first video to be spliced. In the process of processing these two segments of video, since the average coordinate value of the first video to be spliced is less than the average coordinate value of the second video to be spliced, the first video to be spliced will be integrated first. In this case, the algorithm will first write the non-overlapping part of the first video to be spliced. After encountering the overlapping part with the second video to be spliced, according to the algorithm, all the shadow parts of the first video to be spliced will be cut off. At this time, some information in the first video to be spliced will be omitted.
[0116] To avoid this situation, consider deleting the included videos to be spliced before writing them into the integrated video. You only need to determine the longitude and latitude of the first and last frames between adjacent videos to be spliced. If they are included, delete the included videos to be spliced directly to facilitate subsequent video processing.
[0117] Among them, it is judged whether the longitude and latitude of the i-th frame image in the k-th video to be stitched is less than the longitude and latitude of the first frame image of the next video to be stitched. If it is less than, continue to perform subsequent judgments, otherwise k++, go to the next video to be stitched. The specific implementation process is as follows:
[0118] In order to make each video to be spliced be written into the same video, the video to be spliced can be split into several pictures by frame, and the frames that meet the judgment conditions are written into the integrated video through a loop.
[0119] Before the qualified video frames are written into the integrated video, two judgments will be made. The first judgment is to determine whether the longitude and latitude of this frame is less than the longitude and latitude of the first frame of the next video to be spliced. If it is less, the subsequent judgment will continue. If it is greater, it means that the part overlapping with the next video to be spliced is encountered. The purpose of this is to eliminate the overlap that may occur in two adjacent videos to be spliced. In this case, it is necessary to delete the subsequent part of the previous video to be spliced and retain the front part of the latter video to be spliced. Because usually, in the process of drone video shooting, there will be hovering, landing, etc. at the end. Therefore, the second half of the previous video to be spliced is usually removed, and the first half of the next video to be spliced is retained. The code operation is to directly read the next video to be spliced when the coordinate values overlap, so that the entire integrated video looks more complete.
[0120] Among them, starting from the second frame image, determine whether the yaw angle difference and pitch angle difference between the frame image and the previous frame image are both within the corresponding range. If the conditions are met, all images in the segment of the video to be stitched whose longitude and latitude are smaller than the first frame image of the next video to be stitched are written into the integrated video. Otherwise, k++ is used to go to the next video to be stitched. The specific implementation process is as follows:
[0121] From the second frame, a range is defined for the difference in yaw and pitch angles between two adjacent frames through mathematical calculation. Only when the difference in yaw and pitch angles between two adjacent frames are within the corresponding range will the frame be written into the integrated video, otherwise the next video to be spliced will be read directly. The purpose of this operation is to eliminate abnormal conditions such as circling and pitching that may occur at the end of the video to be spliced, making the video more complete and coherent.
[0122] Among them, after obtaining the integrated video, if the total length of the video is too long, it will be processed at a double speed.
[0123] Due to the flight speed limit of the drone itself and the total length of general highways, which are longer than hundreds of kilometers, if the video is integrated and spliced at the original speed, the total length of the video will be very long, which will affect the efficiency of subsequent processing of the total video.
[0124] In this case, the total video needs to be processed at a multiple speed. Usually, we hope to control the video length to about 30 minutes, but the total time required for aerial photography of a highway of more than 100 kilometers is about 2 hours. Taking this as an example, the total video needs to be processed at 4 times the speed to reduce the length.
[0125] The method to reduce the total length of the video is to extract frames from the video. Assuming that the video is processed at 4 times the speed, one frame can be read from every 4 frames in the video and written into the integrated video. In this case, the video playback speed is also 4 times the original speed, and the video size is reduced to a quarter of the original video size. At the same time, the effective information in the video will not be affected at all.
[0126] The key technical points of the present invention are: reading the flight data files corresponding to multiple drone aerial videos, recording the latitude and longitude, yaw angle, pitch angle and other data therein; after recording the data, comparing the average coordinate values between the videos, and sorting the videos in the order of the coordinate values; by comparing the coordinate value of the last frame of the previous video and the coordinate value of the first frame of the next video, cutting the part where the coordinates of the two videos overlap; splicing multiple drone videos in the order of coordinates to form a coherent integrated video. Cutting the abnormal conditions that may appear at the end of the video (such as hovering, yaw, pitch, etc.) so that the integrated video completely and coherently depicts the entire long-mileage highway to be built. In short, the method of reading drone camera videos and their flight data to sort multiple videos in the order of coordinate values; reading the pitch angle and yaw angle in the video flight data to cut off the abnormality of the video that does not overlap with the next video, so that the entire video completely and coherently forms an overview of the entire long-mileage highway. The technical problem to be solved by the present invention is: how to use flight data to merge multiple drone aerial videos into one video in the order of the geographical locations of the highway to be built, and process the repeated parts in these videos, while removing abnormal situations such as drone hovering, pitching, yaw, etc. that appear in the video. The present invention provides assistance for the processing of multiple drone aerial videos with a long range, allowing drones to choose to measure sections of any length at any time during the aerial photography process. As long as all videos can cover the entire bridge or the entire tunnel, and each video is equipped with a corresponding flight data file, the length of the total distance can be completely ignored, and the present invention can be used to achieve complete work. Even, as long as you want to integrate multiple videos into one video in a certain order, the present invention can be used as a reference.
[0127] The specific explanations of the technical terms involved in the present invention are as follows:
[0128] 1) Pitch angle: The angle between the x-axis of the body coordinate system and the horizontal plane. When the x-axis of the body coordinate system is above the XOY plane of the inertial coordinate system, the pitch angle is positive, otherwise it is negative. That is, the angle between the vector parallel to the fuselage axis and pointing to the front of the aircraft and the ground.
[0129] 2) Yaw angle: The angle between the projection of the xb axis of the body coordinate system on the horizontal plane and the xg axis of the ground coordinate system (on the horizontal plane, pointing to the target is positive). When the xg axis rotates counterclockwise to the projection line of the body xb, the yaw angle is positive, that is, the right yaw of the nose is positive, and vice versa.
[0130] 3) Flight data: When taking aerial photos, drones will be accompanied by flight logs that record many flight parameters. These parameters include sensitivity, shutter speed, exposure value, longitude, latitude and relative height to the origin, total height calculated according to the air pressure relationship at altitude, pitch angle, yaw angle and other data. In the present invention, it is necessary to read and call the data such as "longitude, latitude, pitch angle, yaw angle" to perform video processing such as sorting and removing anomalies, so that the integrated spliced video can fully and coherently depict the entire highway.
[0131] 4) CAD: Computer Aided Design (CAD) refers to the use of computers and their graphic devices to help designers perform design work, usually based on interactive computer systems with graphic functions. CAD mainly includes interactive technology, graphic transformation technology, surface modeling and solid modeling technology. In computer-aided design, interactive technology is indispensable. An interactive CAD system means that when users use computer systems for design, people and machines can exchange information in a timely manner. The main function of graphic transformation is to link the user coordinate system with the coordinate system of the graphic output device; to translate, rotate, scale, and perspective transform the graphics; and to achieve graphic transformation through matrix operations. Computer design automation is the computer's own CAD, which aims to realize the automation or semi-automation of the computer's own design and development process.
[0132] In the above embodiments, although the steps are numbered S1, S2, etc., these are only specific embodiments given by the present invention. Those skilled in the art may adjust the execution order of S1, S2, etc. according to actual conditions, which is also within the protection scope of the present invention. It can be understood that in some embodiments, some or all of the above embodiments may be included.
[0133] like Figure 4 As shown, a multi-video cropping and splicing system 200 according to an embodiment of the present invention includes a multi-video shooting module 201, a multi-video preprocessing module 202, an image shooting information acquisition module 203, a first sorting module 204, a second sorting module 205 and a multi-video splicing module 206;
[0134] The multi-video shooting module 201 is used to: shoot the video of the geographical environment of the entire highway to be built in sections by using a drone;
[0135] The multi-video preprocessing module 202 is used to: preprocess the multiple videos shot by the drone to obtain multiple videos to be spliced;
[0136] The image shooting information acquisition module 203 is used to: obtain the latitude and longitude, yaw angle and pitch angle of each frame of image in each video to be spliced;
[0137] The first sorting module 204 is used to calculate the average longitude and latitude or the median longitude and latitude of each video to be spliced, and sort all the videos to be spliced in ascending order to obtain a first video sequence;
[0138] The second sorting module 205 is used to: sequentially compare each two adjacent videos to be spliced in the first video sequence, delete the videos to be spliced that are completely included, and sort the average longitude and latitude or the median longitude and latitude of each remaining video to be spliced in order from small to large, to obtain a second video sequence;
[0139] The multi-video stitching module 206 is used to stitch videos based on the second video sequence and the longitude and latitude, yaw angle and pitch angle of each frame image in each video to be stitched in the second video sequence to obtain a stitched integrated video.
[0140] Optionally, in the above technical solution, the multi-video splicing module 206 is specifically used for:
[0141] Determine whether the longitude and latitude of the i-th frame image of the k-th segment of the video to be spliced in the second video sequence is less than the longitude and latitude of the first frame image of the k+1-th segment of the video to be spliced, and obtain a first judgment result. When the first judgment result is yes, determine whether the yaw angle difference and the pitch angle difference between the i-th frame image of the k-th segment of the video to be spliced and the i-1-th frame image of the k-th segment of the video to be spliced are both within the corresponding range, and obtain a second judgment result. When the second judgment result is yes, splice the i-th frame image of the k-th segment of the video to be spliced into the integrated video, and continue to determine whether the longitude and latitude of the i+1-th frame image of the k-th segment of the video to be spliced in the second video sequence is less than the k+1-th frame image. When the second judgment result is no, continue to judge whether the longitude and latitude of the i+1th frame image of the kth video to be spliced in the second video sequence is less than the longitude and latitude of the first frame image of the k+1th video to be spliced. When the first judgment result is no, continue to judge whether the longitude and latitude of the i-th frame image of the k+1th video to be spliced in the second video sequence is less than the longitude and latitude of the first frame image of the k+2th video to be spliced; until all images except the first frame image in each video to be spliced in the second video sequence are traversed to obtain a spliced integrated video, k and i are both positive integers, and k≥1, i≥2.
[0142] Optionally, in the above technical solution, the multi-video preprocessing module 202 is specifically used for:
[0143] By using the pre-drawn engineering drawings of the highway to be built, the position of the highway in each frame of each video taken by the drone is calculated, the engineering drawings are cropped, and the part of the engineering drawings of the highway to be built corresponding to each frame is cut out. Then, the part of the engineering drawings of the highway to be built corresponding to each frame is perspective-operated and superimposed on the corresponding images to obtain multiple videos to be spliced.
[0144] Optionally, in the above technical solution, the multi-video preprocessing module 202 is specifically used for:
[0145] By using the pre-drawn engineering drawings of the highway to be built, the position of the highway in each frame of each video taken by the drone is calculated, the engineering drawings are cropped, and the part of the engineering drawings of the highway to be built corresponding to each frame is cut out. Then, after perspective operation, the part of the engineering drawings of the highway to be built corresponding to each frame are superimposed on the corresponding images respectively, and resolution compression processing is performed to obtain multiple videos to be spliced.
[0146] Optionally, in the above technical solution, a multiple speed processing module is further included, and the multiple speed processing module is used to:
[0147] When the duration of the spliced integrated video exceeds the preset duration, the duration of the spliced integrated video is processed at a double speed.
[0148] It should be noted that the beneficial effects of the multi-video cropping and splicing system 200 provided in the above embodiment are the same as the beneficial effects of the multi-video cropping and splicing method described above, which will not be described in detail here. In addition, when the system provided in the above embodiment realizes its functions, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the system can be divided into different functional modules according to actual conditions to complete all or part of the functions described above. In addition, the system and method embodiments provided in the above embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be described in detail here.
[0149] like Figure 5 As shown, an electronic device 300 according to an embodiment of the present invention includes a processor 320, the processor 320 is coupled to a memory 310, and the memory 310 stores at least one computer program 330, and the at least one computer program 330 is loaded and executed by the processor 320, so that the electronic device 300 implements any of the above-mentioned multi-video cropping and splicing methods, specifically:
[0150] The electronic device 300 may have relatively large differences due to different configurations or performances, and may include one or more processors 320 (Central Processing Units, CPU) and one or more memories 310, wherein the one or more memories 310 store at least one computer program 330, and the at least one computer program 330 is loaded and executed by the one or more processors 320, so that the electronic device 300 implements any of the multi-video cropping and splicing methods provided in the above embodiments. Of course, the electronic device 300 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The electronic device 300 may also include other components for realizing device functions, which will not be described in detail here. The electronic device may specifically be a computer, etc.
[0151] A computer-readable storage medium according to an embodiment of the present invention stores at least one computer program, and the at least one computer program is loaded and executed by a processor so that a computer implements any of the above-mentioned multi-video cropping and splicing methods.
[0152] Optionally, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, and the like.
[0153] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program includes computer instructions, the computer instructions are stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device performs any of the above-mentioned multi-video cropping and splicing methods.
[0154] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects and represent the definition of a specific order or sequence. The order of use of similar objects can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than the order shown or described.
[0155] Those skilled in the art know that the present invention can be implemented as a system, method or computer program product. Therefore, the present invention can be specifically implemented in the following forms, namely: it can be complete hardware, it can be complete software (including firmware, resident software, microcode, etc.), or it can be a combination of hardware and software, which is generally referred to as "circuit", "module" or "system" herein. In addition, in some embodiments, the present invention can also be implemented in the form of a computer program product in one or more computer-readable media, and the computer-readable medium contains computer-readable program code.
[0156] Any combination of one or more computer-readable media can be used. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0157] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A method for cutting and splicing multiple videos, characterized in that: include: Use drones to shoot segmented videos of the entire geographical environment of the highway to be built; After pre-processing multiple videos shot by the drone, multiple videos to be stitched are obtained; Obtain the latitude and longitude, yaw angle and pitch angle of each frame of the video to be stitched; Calculate the average longitude and latitude or the median longitude and latitude of each video to be spliced, and sort all the videos to be spliced in ascending order to obtain a first video sequence; Compare each adjacent two segments of the videos to be spliced in the first video sequence in turn, delete the videos to be spliced that are completely included, and sort the average longitude and latitude or the median longitude and latitude of each of the remaining videos to be spliced in order from small to large, to obtain a second video sequence; Perform video stitching based on the second video sequence and the latitude and longitude, yaw angle, and pitch angle of each frame image in each video to be stitched in the second video sequence to obtain a stitched integrated video; Performing video stitching based on the second video sequence and the latitude and longitude, yaw angle, and pitch angle of each frame image in each video to be stitched in the second video sequence to obtain a stitched integrated video, including: Determine whether the longitude and latitude of the i-th frame image of the k-th segment of the video to be stitched in the second video sequence is less than the longitude and latitude of the first frame image of the k+1-th segment of the video to be stitched, and obtain a first judgment result. When the first judgment result is yes, determine whether the yaw angle difference and the pitch angle difference between the i-th frame image of the k-th segment of the video to be stitched and the i-1-th frame image of the k-th segment of the video to be stitched are both within the corresponding range, and obtain a second judgment result. When the second judgment result is yes, splice the i-th frame image of the k-th segment of the video to be stitched into the integrated video, and continue to determine whether the longitude and latitude of the i+1-th frame image of the k-th segment of the video to be stitched in the second video sequence is less than the k+1-th frame image. When the second judgment result is no, continue to judge whether the longitude and latitude of the i+1th frame image of the kth video to be stitched in the second video sequence is less than the longitude and latitude of the first frame image of the k+1th video to be stitched; when the first judgment result is no, continue to judge whether the longitude and latitude of the i-th frame image of the k+1th video to be stitched in the second video sequence is less than the longitude and latitude of the first frame image of the k+2th video to be stitched; until all images except the first frame image in each video to be stitched in the second video sequence are traversed to obtain a stitched integrated video, k and i are both positive integers, and k≥1, i≥2.
2. A method for cutting and splicing multiple videos according to claim 1, characterized in that: After preprocessing the multiple videos shot by the drone, multiple videos to be stitched are obtained, including: By using the pre-drawn engineering drawings of the highway to be built, the position of the highway in each frame of each video taken by the drone is calculated, the engineering drawings are cropped, and the part of the engineering drawings of the highway to be built corresponding to each frame is cut out. Then, the part of the engineering drawings of the highway to be built corresponding to each frame is perspective-operated and superimposed on the corresponding images to obtain multiple videos to be spliced.
3. The method for cutting and splicing multiple videos according to claim 1, characterized in that: After preprocessing the multiple videos shot by the drone, multiple videos to be stitched are obtained, including: By using the pre-drawn engineering drawings of the highway to be built, the position of the highway in each frame of each video taken by the drone is calculated, the engineering drawings are cropped, and the part of the engineering drawings of the highway to be built corresponding to each frame is cut out. Then, after perspective operation, the part of the engineering drawings of the highway to be built corresponding to each frame are superimposed on the corresponding images respectively, and resolution compression processing is performed to obtain multiple videos to be spliced.
4. The method for cutting and splicing multiple videos according to claim 1, characterized in that: Also includes: When the duration of the spliced integrated video exceeds a preset duration, the duration of the spliced integrated video is processed at a double speed.
5. A multi-video cropping and splicing system, characterized in that: It includes a multi-video shooting module, a multi-video preprocessing module, an image shooting information acquisition module, a first sorting module, a second sorting module and a multi-video stitching module; The multi-video shooting module is used to: shoot the video of the geographical environment of the entire highway to be built in sections by using a drone; The multi-video preprocessing module is used to: preprocess multiple videos shot by the drone to obtain multiple videos to be spliced; The image shooting information acquisition module is used to: obtain the longitude and latitude, yaw angle and pitch angle of each frame of image in each segment of video to be spliced; The first sorting module is used to: calculate the average longitude and latitude or the median longitude and latitude of each video to be spliced, and sort all the videos to be spliced in ascending order to obtain a first video sequence; The second sorting module is used to: sequentially compare each two adjacent videos to be spliced in the first video sequence, delete the videos to be spliced that are completely included, and sort the average longitude and latitude or the median longitude and latitude of each remaining video to be spliced in order from small to large, to obtain a second video sequence; The multi-video stitching module is used to: perform video stitching based on the second video sequence and the latitude and longitude, yaw angle and pitch angle of each frame image in each video to be stitched in the second video sequence to obtain a stitched integrated video; The multi-video splicing module is specifically used for: Determine whether the longitude and latitude of the i-th frame image of the k-th segment of the video to be stitched in the second video sequence is less than the longitude and latitude of the first frame image of the k+1-th segment of the video to be stitched, and obtain a first judgment result. When the first judgment result is yes, determine whether the yaw angle difference and the pitch angle difference between the i-th frame image of the k-th segment of the video to be stitched and the i-1-th frame image of the k-th segment of the video to be stitched are both within the corresponding range, and obtain a second judgment result. When the second judgment result is yes, splice the i-th frame image of the k-th segment of the video to be stitched into the integrated video, and continue to determine whether the longitude and latitude of the i+1-th frame image of the k-th segment of the video to be stitched in the second video sequence is less than the k+1-th frame image. When the second judgment result is no, continue to judge whether the longitude and latitude of the i+1th frame image of the kth video to be stitched in the second video sequence is less than the longitude and latitude of the first frame image of the k+1th video to be stitched; when the first judgment result is no, continue to judge whether the longitude and latitude of the i-th frame image of the k+1th video to be stitched in the second video sequence is less than the longitude and latitude of the first frame image of the k+2th video to be stitched; until all images except the first frame image in each video to be stitched in the second video sequence are traversed to obtain a stitched integrated video, k and i are both positive integers, and k≥1, i≥2.
6. The multi-video cutting and splicing system according to claim 5, characterized in that: The multi-video preprocessing module is specifically used for: By using the pre-drawn engineering drawings of the highway to be built, the position of the highway in each frame of each video taken by the drone is calculated, the engineering drawings are cropped, and the part of the engineering drawings of the highway to be built corresponding to each frame is cut out. Then, the part of the engineering drawings of the highway to be built corresponding to each frame is perspective-operated and superimposed on the corresponding images to obtain multiple videos to be spliced.
7. An electronic device, characterized in that: The electronic device includes a processor, the processor is coupled to a memory, at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor so that the electronic device implements a multi-video cropping and splicing method as described in any one of claims 1 to 4.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer program, and the at least one computer program is loaded and executed by a processor so that a computer implements a multi-video cropping and splicing method as claimed in any one of claims 1 to 4.
Citation Information
Patent Citations
Video stitching method, device and system
CN112544071A
Unmanned aerial vehicle video stitching method
CN116309080A
Image splicing method and system based on multiple unmanned aerial vehicles
CN115731100A