Video processing method, device, computer equipment and storage medium

By adjusting the pixel adjustment amount of video frames and performing splicing, the poor splicing effect and flickering of video frames in the prior art are solved, and a more natural image splicing effect is achieved.

CN115348398BActive Publication Date: 2025-05-06ARASHI VISION INC
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110521073.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-13
Publication Date
2025-05-06
Estimated Expiration
2041-05-13

AI Technical Summary

Technical Problem

The existing video processing methods have poor results when splicing video frames, resulting in unnatural images and flickering problems.

Method used

By determining the pixel adjustment amount of the video frame to be spliced ​​and its corresponding historical frame, adjusting the pixel adjustment amount according to the pixel adjustment constraints, and adjusting and splicing of the video frames.

Benefits of technology

It reduces the pixel difference between video frames to be spliced, reduces the occurrence of flickering, and improves the effect of video frame splicing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115348398B_ABST
    Figure CN115348398B_ABST
Patent Text Reader

Abstract

The present application relates to a video processing method, device, computer equipment and storage medium. The method includes: determining a first current video frame to be spliced ​​in a first video, and a second current video frame corresponding to the first current video frame in a second video; obtaining a first historical pixel adjustment amount corresponding to the first current video frame, and a second historical pixel adjustment amount corresponding to the second current video frame; determining a first current pixel adjustment amount corresponding to the first current video frame and a second current pixel adjustment amount corresponding to the second current video frame according to the first historical pixel adjustment amount, the second historical pixel adjustment amount and a pixel adjustment constraint; adjusting the first current video frame and the second current video frame to obtain an adjusted first current video frame and a second current video frame; splicing the adjusted first current video frame and the adjusted second current video frame to obtain a spliced ​​video frame. The present method can improve the video frame splicing effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of video processing technology, and in particular to a video processing method, apparatus, computer equipment and storage medium. Background Art

[0002] With the development of video processing technology, various types of videos have occupied an important position in people's daily life and work. According to different needs of people for videos or different video application scenarios, it is often necessary to process videos in some way. For example, videos shot under different time conditions are spliced ​​together to form a complete video, and spliced ​​into a continuous and complete video in the time domain. When performing video splicing, the video frames of two or more videos to be spliced ​​can be aligned in the overlapping area of ​​the videos to be spliced, and then the aligned video frames are processed to obtain a spliced ​​video.

[0003] However, current video processing methods have the problem of poor video frame splicing effect. For example, when two videos with overlapping areas are fused, only local fusion processing is performed on the overlapping areas, which cannot guarantee the global naturalness of the image or there are problems such as large pixel differences between two adjacent video frames, resulting in severe flickering. Summary of the invention

[0004] Based on this, it is necessary to provide a video processing method, device, computer equipment and storage medium that can improve the video processing effect in response to the above technical problems.

[0005] A video processing method, the method comprising: determining a first current video frame to be spliced ​​in a first video, and a second current video frame in a second video corresponding to the first current video frame; obtaining a first historical pixel adjustment amount of a first historical video frame corresponding to the first current video frame, and a second historical pixel adjustment amount of a second historical video frame corresponding to the second current video frame; determining a first current pixel adjustment amount corresponding to the first current video frame and a second current pixel adjustment amount corresponding to the second current video frame according to the first historical pixel adjustment amount, the second historical pixel adjustment amount and a pixel adjustment constraint; adjusting the first current video frame based on the first current pixel adjustment amount, and adjusting the second current video frame based on the second current pixel adjustment amount to obtain an adjusted first current video frame and an adjusted second current video frame; splicing the adjusted first current video frame and the adjusted second current video frame to obtain a spliced ​​video frame.

[0006] In one of the embodiments, determining the first current pixel adjustment amount corresponding to the first current video frame and the second current pixel adjustment amount corresponding to the second current video frame according to the first historical pixel adjustment amount, the second historical pixel adjustment amount and the pixel adjustment constraint includes: using the first historical pixel adjustment amount and the second historical pixel adjustment amount as the initial pixel adjustment amounts of the first current video frame and the second current video frame, respectively, and adjusting the initial pixel adjustment amounts in a direction that satisfies the pixel adjustment constraint to obtain the first current pixel adjustment amount and the second current pixel adjustment amount that satisfy the pixel adjustment constraint.

[0007] In one embodiment, the first historical pixel adjustment amount and the second historical pixel adjustment amount are used as the initial pixel adjustment amounts of the first current video frame and the second current video frame respectively, and the initial pixel adjustment amounts are adjusted in the direction of satisfying the pixel adjustment constraint condition, including: the first historical pixel adjustment amount and the second historical pixel adjustment amount are used as the initial pixel adjustment amounts of the first current video frame and the second current video frame respectively, and the initial pixel adjustment amounts are adjusted in the direction of making the target value smaller until the pixel adjustment constraint condition is satisfied, and the pixel adjustment constraint condition includes at least one of the target value being less than a preset threshold value or the number of adjustments reaching a preset number of times; the target value is obtained by statistically analyzing the first value and the second value, the first value represents the pixel difference of the control point of the overlapping area between the first current video frame after pixel adjustment and the second current video frame after pixel adjustment, and the second value represents the size of the pixel adjustment change amount of the first current video frame and the size of the pixel adjustment change amount of the second current video frame.

[0008] In one embodiment, the step of obtaining the first value includes: determining the target pixel difference corresponding to each pixel point in the overlapping area between the first current video frame and the second current video frame; obtaining the upper limit of the difference of the target pixel difference in a preset middle range as the first threshold, and obtaining the lower limit of the difference of the target pixel difference in the preset middle range as the second threshold; determining a reliable range of the target pixel difference corresponding to the overlapping area based on the first threshold and the second threshold; determining a transition range of the target pixel difference corresponding to the reliable range; determining a first weight corresponding to the pixel points whose target pixel difference is within the reliable range, and a second weight for the pixel points whose target pixel difference is within the transition range, the first weight being greater than the second weight; and determining the first value based on the first weight, the second weight and the pixel difference of the control points of the overlapping area.

[0009] In one embodiment, the step of determining the second weight of the pixel point within the transition range of the target pixel difference includes: determining the pixel value of the pixel point within the transition range of the target pixel difference; calculating the shortest distance between the pixel value and the threshold value corresponding to the transition range; determining the second weight of the pixel point within the transition range of the target pixel difference based on the shortest distance, wherein the shortest distance is positively correlated with the second weight.

[0010] In one embodiment, the first current pixel adjustment amount includes pixel adjustment amounts corresponding to multiple control points, and the adjusting the first current video frame based on the first current pixel adjustment amount includes: performing interpolation calculation based on the pixel adjustment amounts corresponding to the multiple control points to obtain the pixel adjustment amounts of each pixel point in the first current video frame; adjusting the pixel adjustment amounts of the pixel points in the first current video frame according to the pixel adjustment amounts of each pixel point in the first current video frame.

[0011] In one embodiment, the step of splicing the adjusted first current video frame and the adjusted second current video frame to obtain a spliced ​​video frame includes: determining an overlapping area between the first current video frame and the second current video frame; weightedly fusing the adjusted first current video frame and the adjusted second current video frame in the overlapping area to obtain a fused area; and splicing the fused area, the non-overlapping area in the adjusted first current video frame, and the non-overlapping area in the adjusted second current video frame to obtain a spliced ​​video frame.

[0012] A video processing device, the device comprising: a current video frame determination module, used to determine a first current video frame to be spliced ​​in a first video, and a second current video frame in a second video corresponding to the first current video frame; a historical pixel adjustment amount acquisition module, used to acquire a first historical pixel adjustment amount of a first historical video frame corresponding to the first current video frame, and a second historical pixel adjustment amount of a second historical video frame corresponding to the second current video frame; a current pixel adjustment amount determination module, used to determine a first current pixel adjustment amount corresponding to the first current video frame and a second current pixel adjustment amount corresponding to the second current video frame according to the first historical pixel adjustment amount, the second historical pixel adjustment amount and a pixel adjustment constraint condition; an adjusted current video frame acquisition module, used to adjust the first current video frame based on the first current pixel adjustment amount, and adjust the second current video frame based on the second current pixel adjustment amount, to obtain an adjusted first current video frame and an adjusted second current video frame; and a spliced ​​video frame acquisition module, used to splice the adjusted first current video frame and the adjusted second current video frame to obtain a spliced ​​video frame.

[0013] In one of the embodiments, the current pixel adjustment amount determination module is used to use the first historical pixel adjustment amount and the second historical pixel adjustment amount as the initial pixel adjustment amounts of the first current video frame and the second current video frame, respectively, and adjust the initial pixel adjustment amounts in a direction that satisfies the pixel adjustment constraint condition to obtain the first current pixel adjustment amount and the second current pixel adjustment amount that satisfy the pixel adjustment constraint condition.

[0014] In one embodiment, the current pixel adjustment amount determination module is used to use the first historical pixel adjustment amount and the second historical pixel adjustment amount as the initial pixel adjustment amounts of the first current video frame and the second current video frame respectively, and adjust the initial pixel adjustment amounts in the direction of reducing the target value until the pixel adjustment constraint condition is satisfied, wherein the pixel adjustment constraint condition includes at least one of the target value being less than a preset threshold value or the number of adjustments reaching a preset number; the target value is obtained by statistically analyzing the first value and the second value, wherein the first value represents the pixel difference of the control point of the overlapping area between the first current video frame after pixel adjustment and the second current video frame after pixel adjustment, and the second value represents the size of the pixel adjustment change amount of the first current video frame and the size of the pixel adjustment change amount of the second current video frame.

[0015] In one embodiment, the current pixel adjustment amount determination module is used to determine the target pixel difference corresponding to each pixel point in the overlapping area of ​​the first current video frame and the second current video frame; obtain the upper limit of the difference of the target pixel difference in a preset middle range as the first threshold, and obtain the lower limit of the difference of the target pixel difference in the preset middle range as the second threshold; determine the reliable range of the target pixel difference corresponding to the overlapping area based on the first threshold and the second threshold; determine the transition range of the target pixel difference corresponding to the reliable range; determine the first weight corresponding to the pixel points whose target pixel difference is within the reliable range, and the second weight of the pixel points whose target pixel difference is within the transition range, the first weight being greater than the second weight; determine the first value based on the first weight, the second weight and the pixel difference of the control point of the overlapping area.

[0016] In one embodiment, the current pixel adjustment amount determination module is used to determine the pixel value of the pixel point whose target pixel difference is within the transition range; calculate the shortest distance between the pixel value and the threshold corresponding to the transition range; and determine the second weight of the pixel point whose target pixel difference is within the transition range based on the shortest distance, wherein the shortest distance is positively correlated with the second weight.

[0017] In one embodiment, the module for obtaining the adjusted current video frame is used to adjust the first current video frame based on the first current pixel adjustment amount, including: interpolating the pixel adjustment amounts corresponding to multiple control points to obtain the pixel adjustment amounts of each pixel point in the first current video frame; adjusting the pixel values ​​of the pixel points in the first current video frame according to the pixel adjustment amounts of each pixel point in the first current video frame to obtain the adjusted first current video frame.

[0018] In one embodiment, a module for obtaining a spliced ​​video frame is used to determine the overlapping area between the first current video frame and the second current video frame; weightedly fuse the adjusted first current video frame and the adjusted second current video frame in the overlapping area to obtain a fused area; and splice the fused area, the non-overlapping area in the adjusted first current video frame, and the non-overlapping area in the adjusted second current video frame to obtain a spliced ​​video frame.

[0019] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the following steps when executing the computer program: determining a first current video frame to be spliced ​​in a first video, and a second current video frame in a second video corresponding to the first current video frame; obtaining a first historical pixel adjustment amount of a first historical video frame corresponding to the first current video frame, and a second historical pixel adjustment amount of a second historical video frame corresponding to the second current video frame; determining a first current pixel adjustment amount corresponding to the first current video frame and a second current pixel adjustment amount corresponding to the second current video frame according to the first historical pixel adjustment amount, the second historical pixel adjustment amount and a pixel adjustment constraint; adjusting the first current video frame based on the first current pixel adjustment amount, and adjusting the second current video frame based on the second current pixel adjustment amount to obtain an adjusted first current video frame and an adjusted second current video frame; splicing the adjusted first current video frame and the adjusted second current video frame to obtain a spliced ​​video frame.

[0020] A computer-readable storage medium stores a computer program, which implements the following steps when executed by a processor: determining a first current video frame to be spliced ​​in a first video, and a second current video frame in a second video corresponding to the first current video frame; obtaining a first historical pixel adjustment amount of a first historical video frame corresponding to the first current video frame, and a second historical pixel adjustment amount of a second historical video frame corresponding to the second current video frame; determining a first current pixel adjustment amount corresponding to the first current video frame and a second current pixel adjustment amount corresponding to the second current video frame according to the first historical pixel adjustment amount, the second historical pixel adjustment amount and a pixel adjustment constraint; adjusting the first current video frame based on the first current pixel adjustment amount, and adjusting the second current video frame based on the second current pixel adjustment amount to obtain an adjusted first current video frame and an adjusted second current video frame; splicing the adjusted first current video frame and the adjusted second current video frame to obtain a spliced ​​video frame.

[0021] The above-mentioned video processing method, device, computer equipment and storage medium determine the first current video frame to be spliced ​​in the first video, and the second current video frame corresponding to the first current video frame in the second video; obtain the first historical pixel adjustment amount of the first historical video frame corresponding to the first current video frame, and the second historical pixel adjustment amount of the second historical video frame corresponding to the second current video frame; determine the first current pixel adjustment amount corresponding to the first current video frame and the second current pixel adjustment amount corresponding to the second current video frame according to the first historical pixel adjustment amount, the second historical pixel adjustment amount and the pixel adjustment constraint condition; adjust the first current video frame based on the first current pixel adjustment amount, and adjust the second current video frame based on the second current pixel adjustment amount to obtain the adjusted first current video frame and the adjusted second current video frame; splice the adjusted first current video frame and the adjusted second current video frame to obtain a spliced ​​video frame. The purpose of determining the pixel adjustment amount of the current video frame by the historical pixel adjustment amount of the historical video frame can be achieved, that is, the pixel adjustment amount of the previous video frame and the pixel adjustment constraint conditions are used to determine the pixel adjustment amount of the current video frame. This can reduce the pixel difference between adjacent video frames in the overlapping area of ​​the two videos to be spliced, and reduce the occurrence of flickering in the process of splicing two videos, thereby achieving the purpose of improving the video frame splicing effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 A diagram showing an application environment of a video processing method in an embodiment;

[0023] Figure 2 is a schematic flow chart of a video processing method in one embodiment;

[0024] Figure 3 A schematic flow chart of a step of obtaining a first value in one embodiment;

[0025] Figure 4 A schematic flow chart of a step of determining a second weight of a pixel in a transition range in one embodiment;

[0026] Figure 5 is a flow chart of a video processing method in another embodiment;

[0027] Figure 6 is a flow chart of a video processing method in another embodiment;

[0028] Figure 7 is a structural block diagram of a video processing device in one embodiment;

[0029] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0030] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0031] The video processing method provided in this application can be applied to Figure 1In the application environment shown, it is specifically applied to a video processing system. The video processing system includes a terminal 102 and a video acquisition device 104, wherein the terminal 102 is connected to the video acquisition device 104. The terminal 102 executes a video processing method. Specifically, the video acquisition device 104 transmits a plurality of videos with overlapping areas shot at different angles to the terminal 102. Taking two videos as an example, after the terminal 102 receives the videos transmitted by the video acquisition device 104, it determines a first current video frame to be spliced ​​in the first video and a second current video frame corresponding to the first current video frame in the second video; obtains a first historical pixel adjustment amount of a first historical video frame corresponding to the first current video frame and a second historical pixel adjustment amount of a second historical video frame corresponding to the second current video frame; determines a first current pixel adjustment amount corresponding to the first current video frame and a second current pixel adjustment amount corresponding to the second current video frame according to the first historical pixel adjustment amount, the second historical pixel adjustment amount and a pixel adjustment constraint; adjusts the first current video frame based on the first current pixel adjustment amount, and adjusts the second current video frame based on the second current pixel adjustment amount to obtain an adjusted first current video frame and an adjusted second current video frame; splices the adjusted first current video frame and the adjusted second current video frame to obtain a spliced ​​video frame. The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices, and the video acquisition device 104 may include various cameras, video acquisition cards, and the like.

[0032] In one embodiment, Figure 2 As shown, a video processing method is provided, which is applied to Figure 1 The terminal in is used as an example to illustrate, including the following steps:

[0033] Step 202: determine a first current video frame to be spliced ​​in the first video and a second current video frame in the second video corresponding to the first current video frame.

[0034] The current video frame refers to a video frame in the video that currently needs to be processed.

[0035] Specifically, the first current video frame in the first video to be spliced ​​can be obtained through the video frame acquisition tool in the terminal. After obtaining the first current video frame, the second current video frame corresponding to the first current video frame is obtained according to the matching relationship between the first current video frame and the video frame in the second video. The first video and the second video have an overlapping area, and the first current video frame and the second current video frame both exist in the overlapping area. The overlapping area refers to the video frame area obtained by shooting the same position in the two videos. For example, two videos shot at different times have the same shooting position, and the video frame area obtained by shooting the common shooting position of the two videos is the overlapping area. The above-mentioned acquisition tool can be a video frame acquisition function stored in the terminal.

[0036] In one embodiment, the terminal can read the video through the OpenCV software library and extract each frame in the video. First, the video acquisition structure function in the OpenCV software library is used to realize the acquisition of the video. For example, the video acquisition structure function VideoCapture and Mat are used to acquire the video. Further, the above video acquisition structure function can be used to acquire the current video frame in the first video. The second current video frame corresponding to the first current video frame is acquired in the overlapping area of ​​the first video and the second video.

[0037] Step 204 , obtaining a first historical pixel adjustment amount of a first historical video frame corresponding to the first current video frame, and a second historical pixel adjustment amount of a second historical video frame corresponding to the second current video frame.

[0038] The historical video frame refers to the forward video frame of the current video frame, and the forward video frame refers to the video frame before the current video frame, which may be a video frame corresponding to one frame before the current video frame, or a video frame corresponding to multiple frames before the current video frame. For example, if the current video frame is the nth frame in the video, the historical video frame may be the n-1th frame or the nmth frame in the video. The pixel adjustment amount refers to the adjustment amount of the pixel value of the pixel point in the video frame.

[0039] Specifically, according to the timestamp and the frame rate of the video frame corresponding to the current video frame, the historical video frame corresponding to the current video frame is obtained; and then the pixel adjustment amount of a certain historical video frame is determined through the correspondence between the historical video frame and the pixel adjustment amount.

[0040] In one embodiment, the first current video frame can be acquired through a video frame acquisition tool. After the first current video frame is acquired, the first historical pixel adjustment amount is determined according to the timestamp and video frame rate of the first current video frame and the selected first historical video frame, and according to the one-to-one correspondence between the first historical video frame and the first historical pixel adjustment amount. For example, the timestamp of the first current video frame is 5 seconds, and the frame rate is 24FPS (video frames per second). According to the frame rate, it can be known that the time interval between each adjacent video frame is 42 milliseconds. Assuming that the tenth frame of the forward video frame of the first current video frame is selected as the first historical video frame, the timestamp corresponding to the first historical video frame is the difference between the time interval between the timestamp of the first current video frame and the first historical video frame, that is, 4.8 seconds. Through the pixel adjustment amount 10 corresponding to the video frame with a timestamp of 4.8 seconds, the first historical pixel adjustment amount of the first historical video frame is acquired as 10. Similarly, the second historical pixel adjustment amount of the second historical video frame corresponding to the second current video frame can be acquired.

[0041] Step 206 , determining a first current pixel adjustment amount corresponding to the first current video frame and a second current pixel adjustment amount corresponding to the second current video frame according to the first historical pixel adjustment amount, the second historical pixel adjustment amount and the pixel adjustment constraint condition.

[0042] The pixel adjustment constraint condition refers to the condition that constrains the adjustment of the pixel adjustment amount; the adjustment direction refers to the direction of adjustment toward the current pixel adjustment amount with the historical pixel adjustment amount as the starting condition. The pixel adjustment constraint condition may be an iterative equation.

[0043] Specifically, the first historical pixel adjustment amount corresponding to the first video frame with an overlapping area and the second historical pixel adjustment amount corresponding to the second video frame can be used as the input of the pixel adjustment constraint condition, and the output of the pixel adjustment constraint condition can be used as the first current pixel adjustment amount corresponding to the first current video frame and the second current pixel adjustment amount corresponding to the second current video frame.

[0044] In one embodiment, the pixel adjustment constraint condition may be an iterative equation, for example, using the conjugate gradient method, taking the first historical pixel adjustment amount as an input parameter of the iterative equation, and when the conjugate gradient iterative equation reaches the iterative termination condition, taking the output parameter as the first current pixel adjustment amount corresponding to the first current video frame. Similarly, taking the second historical pixel adjustment amount as an input parameter of the conjugate gradient iterative equation, and when the conjugate gradient iterative equation reaches the iterative termination condition, taking the output parameter as the second current pixel adjustment amount corresponding to the second current video frame.

[0045] Step 208 , adjusting the first current video frame based on the first current pixel adjustment amount, and adjusting the second current video frame based on the second current pixel adjustment amount, to obtain an adjusted first current video frame and an adjusted second current video frame.

[0046] Specifically, after obtaining the first current pixel adjustment amount corresponding to the first current video frame and the second current pixel adjustment amount corresponding to the second current video frame, the adjusted first current video frame can be obtained through the functional relationship between the pixel value of the adjusted first current video frame and the pixel value of the pixel point in the first current video frame, and the adjusted second current video frame can be obtained through the functional relationship between the pixel value of the adjusted second current video frame and the pixel value of the pixel point in the second current video frame. For example, the pixel value of the pixel point in the first current video frame can be obtained by summing the pixel value of the first current video frame and the pixel adjustment amount.

[0047] In one embodiment, the pixel value of the pixel point in the first current video frame and the first current pixel adjustment amount can be summed to obtain the adjusted first current video frame, and the pixel value of the pixel point in the second current video frame and the second current pixel adjustment amount can be summed to obtain the adjusted second current video frame.

[0048] Step 210 , splicing the adjusted first current video frame and the adjusted second current video frame to obtain a spliced ​​video frame.

[0049] The spliced ​​video frame refers to a complete video frame formed by splicing two or more video frames.

[0050] Specifically, an image fusion method may be used to perform image fusion on the adjusted first current video frame and the adjusted second current video frame to complete splicing, thereby obtaining a spliced ​​video frame.

[0051] In one embodiment, after obtaining the adjusted first current video frame and the adjusted second current video frame, the terminal can use local alpha fusion, multi-band fusion, Poisson fusion and other methods to splice the adjusted first current video frame and the adjusted second current video frame to obtain a spliced ​​video frame.

[0052] In the above-mentioned video processing method, a first current video frame to be spliced ​​in the first video and a second current video frame corresponding to the first current video frame in the second video are determined; a first historical pixel adjustment amount of a first historical video frame corresponding to the first current video frame and a second historical pixel adjustment amount of a second historical video frame corresponding to the second current video frame are obtained; according to the first historical pixel adjustment amount, the second historical pixel adjustment amount and the pixel adjustment constraint condition, a first current pixel adjustment amount corresponding to the first current video frame and a second current pixel adjustment amount corresponding to the second current video frame are determined; the first current video frame is adjusted based on the first current pixel adjustment amount, and the second current video frame is adjusted based on the second current pixel adjustment amount to obtain an adjusted first current video frame and an adjusted second current video frame; the adjusted first current video frame and the adjusted second current video frame are spliced ​​to obtain a spliced ​​video frame. The purpose of determining the pixel adjustment amount of the current video frame by the historical pixel adjustment amount of the historical video frame can be achieved, that is, the pixel adjustment amount of the previous video frame and the pixel adjustment constraint conditions are used to determine the pixel adjustment amount of the current video frame. This can reduce the pixel difference between adjacent video frames in the overlapping area of ​​the two videos to be spliced, and reduce the occurrence of flickering in the process of splicing two videos, thereby achieving the purpose of improving the video frame splicing effect.

[0053] In one embodiment, determining the first current pixel adjustment amount corresponding to the first current video frame and the second current pixel adjustment amount corresponding to the second current video frame according to the first historical pixel adjustment amount, the second historical pixel adjustment amount, and the pixel adjustment constraint includes: using the first historical pixel adjustment amount and the second historical pixel adjustment amount as the initial pixel adjustment amounts of the first current video frame and the second current video frame, respectively, and adjusting the pixel adjustment amounts in a direction that satisfies the pixel adjustment constraint to obtain the first current pixel adjustment amount and the second current pixel adjustment amount that satisfy the pixel adjustment constraint.

[0054] Specifically, the direction that satisfies the pixel adjustment constraint condition may be at least one of the following: the target value is less than a preset threshold value or the number of adjustments reaches a preset number of times.

[0055] In one embodiment, when the direction that satisfies the pixel adjustment constraint condition is that the target value is less than a preset threshold, the first current pixel adjustment amount and the second current pixel adjustment amount are obtained. For example, the preset threshold is 10 -5 When the pixel adjustment amount corresponding to the first historical pixel adjustment amount at this time is used as the first current pixel adjustment amount, and the pixel adjustment amount corresponding to the second historical pixel adjustment amount is used as the second current pixel adjustment amount.

[0056] In one embodiment, taking the first historical pixel adjustment amount and the second historical pixel adjustment amount as the initial pixel adjustment amount, and adjusting the pixel adjustment amount in the direction of satisfying the pixel adjustment constraint condition includes: taking the first historical pixel adjustment amount and the second historical pixel adjustment amount as the initial pixel adjustment amount of the first current video frame and the second current video frame respectively, and adjusting the initial pixel adjustment amount in the direction of making the target value smaller until the pixel adjustment constraint condition is satisfied, wherein the pixel adjustment constraint condition includes at least one of the target value being less than a preset threshold value or the number of adjustments reaching a preset number of times. The target value is obtained by statistically analyzing the first value and the second value, the first value represents the pixel difference of the control point of the overlapped area between the first current video frame after pixel adjustment and the second current video frame after pixel adjustment, and the second value represents the size of the pixel adjustment change amount of the first current video frame and the size of the pixel adjustment change amount of the second current video frame.

[0057] Specifically, after obtaining the pixel-adjusted first current video frame and the pixel-adjusted second current video frame, a control point is selected in the overlapped area of ​​the first current video frame and the second current video frame, and the difference between the pixel value of the pixel point corresponding to the pixel adjustment of the first current video frame and the pixel value of the pixel point corresponding to the pixel adjustment of the second current video frame at the control point is calculated to obtain the first value. The second value can be obtained by selecting a control point in a blank area farthest from the overlapped area in the first current video frame and the second current video frame, and according to the size of the pixel adjustment change of the pixel value of the pixel point in the first current video frame corresponding to the control point and the size of the pixel adjustment change of the pixel value of the pixel point in the second current video frame.

[0058] In one embodiment, the pixel adjustment amount can be adjusted using the argmin objective function, and the first historical pixel adjustment amount and the second historical pixel adjustment amount are used as input parameters of the objective function until the number of iterations of the argmin objective function reaches the number of adjustments. For example, the number of adjustments is 100. The output parameters in the argmin objective function are obtained as the first current pixel adjustment amount and the second current pixel adjustment amount. It can be understood that argmin represents the output parameter value of the objective function when the objective function takes the minimum value. For example, if the objective function is expressed as f(x), then argmin f(x) represents the output parameter value in f(x) when f(x) takes the minimum value, where the output parameter value can be understood as the variable value in f(x).

[0059] In one embodiment, the argmin objective function can be converted into an iterative matrix form, and when the target value is less than the iteration termination threshold, the first current pixel adjustment amount and the second current pixel adjustment amount are obtained. For example, the target value less than the iteration termination threshold can be 10 -5 .

[0060] In this embodiment, by setting constraints, it is possible to accurately obtain the pixel adjustment change amount of the first current video frame and the pixel adjustment change amount of the second current video frame through the first historical pixel adjustment amount and the second historical pixel adjustment amount. By using reasonable constraints, the efficiency of video processing is improved, and at the same time, the input parameters of reasonable constraints are used to improve the video processing effect.

[0061] In one embodiment, Figure 3 As shown, the step of obtaining the first value includes:

[0062] Step 302: determine a target pixel difference value corresponding to each pixel point in an overlapped area between the first current video frame and the second current video frame.

[0063] The target pixel difference refers to the difference between the pixel value of a pixel point in the first current video frame and the pixel value of a pixel point at a corresponding position in the second current video frame.

[0064] Specifically, the terminal can obtain the pixel value of a pixel point in the first current video frame and the pixel value of a pixel point in the second current video frame at the corresponding position through a pixel value acquisition tool, and obtain the target pixel difference by calculating the difference between the two pixel values.

[0065] In one embodiment, in the overlapped area of ​​the first current video frame and the second current video frame, the correlation coefficient between the first current video frame and the second current video frame is calculated, and the area with the correlation coefficient less than a preset threshold is filtered out, and the target pixel difference is calculated in the filtered area. For example, the correlation coefficient is expressed as Ncc, and the pixel value of the pixel point in the first current video frame is expressed as I i , the pixel value of the second pixel in the current video frame is represented by I j , the target pixel difference is expressed as diff, the preset threshold is expressed as m, and the correlation coefficient Ncc is expressed as the formula:

[0066] Ncc=∑(I i *I j ) / sqrt(∑(I i *I i )*∑(I j *I j ))

[0067] After filtering out the area where Ncc is less than m, the target pixel difference diff between image i and image j is calculated in the remaining areas where the correlation coefficient is greater than or equal to m. The calculation formula is:

[0068] diff=I i -I j

[0069] Step 304 , obtaining an upper limit of the target pixel difference value in the preset middle range as a first threshold, and obtaining a lower limit of the target pixel difference value in the preset middle range as a second threshold.

[0070] The middle range refers to the range where the difference is in the middle position after filtering out the numerical range with smaller difference and the numerical range with larger difference in the target pixel difference. For example, the preset middle range is 80% of the target pixel difference, which means filtering out the first 10% and the last 10% of the data in the target pixel difference, and obtaining the data between 20% and 90% of the target pixel difference as the target pixel difference in the preset middle range. The upper limit of the difference refers to the maximum value of the target pixel difference; the lower limit of the difference refers to the minimum value of the target pixel difference.

[0071] Specifically, after determining the target pixel difference corresponding to each pixel point in the overlapping area of ​​the first current video frame and the second current video frame, it is necessary to screen the target pixel difference to obtain the target pixel difference in a preset middle range. After obtaining the target pixel difference in the preset middle range, the upper limit and lower limit of the difference can be obtained by sorting the difference sizes among the target pixel differences in the preset middle range.

[0072] In one embodiment, a histogram is performed on the target pixel difference to obtain the target pixel difference in a preset range in the middle of the histogram. For example, 80% of the data in the middle of the histogram is obtained. The upper limit of the difference and the lower limit of the difference are obtained in the target pixel difference in the preset range. For example, the upper limit of the difference can be expressed as maxThreshRange, and the lower limit of the difference can be expressed as minThreshRange; that is, the first threshold is expressed as maxThreshRange, and the second threshold is expressed as minThreshRange.

[0073] Step 306: Determine a reliable range of the target pixel difference value corresponding to the overlapped area based on the first threshold and the second threshold.

[0074] The reliable range refers to a target pixel difference range between the first threshold and the second threshold or after the first threshold and the second threshold are reasonably expanded.

[0075] Specifically, after obtaining the first threshold and the second threshold, the corresponding reliable range can be obtained by limiting the numerical range of the first threshold and the second threshold. For example, the first threshold is expressed as maxThreshRange, and the second threshold is expressed as minThreshRange, then the reliable range can be expressed as (minThreshRange, maxThreshRange) or the reliable range obtained after reasonably expanding the first threshold and the second threshold is (minThreshRange-k, maxThreshRange+k). The reliable range can be expressed as (minThresh, maxThresh).

[0076] Step 308: Determine a transition range of the target pixel difference value corresponding to the reliable range.

[0077] The transition range refers to the expanded range when the reliable range is expanded. For example, if the reliable range is (minThresh, maxThresh), the range after expansion is (minThresh-range, maxThresh+range), then the transition range is range.

[0078] Specifically, in the overlapping area, there is a positive correlation between the statistical value of the target pixel difference and the transition range, and the larger the statistical value, the larger the transition range. The statistical value can be the average value, mode or median of the target pixel difference in the overlapping area.

[0079] Step 310, determining a first weight corresponding to a pixel point whose target pixel difference value is within a reliable range, and a second weight corresponding to a pixel point whose target pixel difference value is within a transition range, wherein the first weight is greater than the second weight.

[0080] The weight refers to the degree of adjustment of the pixel value of the pixel, and the degree can be expressed by a numerical value. For example, the weight of adjusting the pixel value of the pixel point in the reliable range is 1, and the weight of adjusting the pixel value of the pixel point in the transition range is 1 / 2, then the degree of adjustment of the pixel value of the pixel in the reliable range is greater than the degree of adjustment of the pixel value of the pixel in the transition range.

[0081] Specifically, when adjusting the pixel values ​​of pixels in the reliable range and pixels in the transition range, the adjustment weights are different, so that the pixel values ​​of the pixels are adjusted according to the ranges in which the pixel values ​​of the pixels are located.

[0082] In one embodiment, the first weight and the second weight can be determined according to the functional relationship between the pixel value adjustment weight and the range of the pixel value of the pixel point. For example, assuming that the reliable range is represented by (minThresh, maxThresh), the transition range is represented by (threshBot, minThresh) and (maxThresh, threshTop), and the weight is represented by weight, then the first weight and the second weight can be expressed as formulas:

[0083]

[0084] Step 312, determining a first value based on the first weight, the second weight, and the pixel difference of the control points in the overlapping area.

[0085] The pixel difference refers to the difference between the pixel value of a pixel point in the first video frame and the pixel value of a pixel point in the second video frame in the overlapping area.

[0086] Specifically, after obtaining the first weight and the second weight, after determining the overlapping area control point, the first value can be determined by the pixel difference between the first weight and the corresponding control point or by the pixel difference between the second weight and the corresponding control point.

[0087] In one embodiment, the first value may be determined by superimposing the product of the first weight or the second weight and the pixel difference of the corresponding control point in the overlapped region. For example, the first value is represented as A, the first weight or the second weight is represented as weight, and the pixel difference of the control point in the overlapped region is represented as diff1, then the first value A is represented as the formula:

[0088]

[0089] In this embodiment, the terminal determines the target pixel difference corresponding to each pixel point in the overlapping area between the first current video frame and the second current video frame, obtains the first threshold and the second threshold from the target pixel difference, and then determines the reliable range corresponding to the overlapping area through the first threshold and the second threshold, obtains the corresponding transition range based on the reliable range, and after determining the reliable range and the transition range, respectively determines the first weight corresponding to the pixels in the above-mentioned reliable range and the second weight corresponding to the pixels in the transition range, and determines the first value based on the first weight, the second weight and the pixel difference of the control point of the overlapping area, so as to achieve the purpose of accurate first value.

[0090] In one embodiment, Figure 4 As shown, the step of determining the second weight of the pixel point whose target pixel difference value is within the transition range includes:

[0091] Step 402, determining the pixel value of the pixel point whose target pixel difference value is within the transition range.

[0092] Specifically, after the transition range is determined, a certain pixel point may be selected within the transition range, and the pixel value of the pixel point within the transition range may be obtained by using a pixel value acquisition tool or an acquisition function.

[0093] Step 404, calculating the shortest distance between the pixel value and the threshold value corresponding to the transition range.

[0094] Among them, the shortest distance refers to the minimum difference between the pixel value and the threshold corresponding to the transition range. The shortest distance can be considered as the absolute value of the difference. For example, the maximum threshold and the minimum threshold corresponding to the transition range are 230 and 10, and the pixel value is 14. Then the shortest distance between the pixel value and the threshold corresponding to the transition range is the difference between the pixel value and the minimum threshold, that is, the shortest distance is 4. For another example, if the pixel value is 226, then the shortest distance between the pixel value and the threshold corresponding to the transition range is the difference between the pixel value and the maximum threshold, that is, the shortest distance is 4.

[0095] Specifically, the shortest distance between the pixel value and the threshold corresponding to the transition range may be calculated by using the difference between the pixel value and the threshold corresponding to the transition range.

[0096] Step 406 : determining a second weight of the pixel point whose target pixel difference is within the transition range based on the shortest distance, wherein the shortest distance is positively correlated with the second weight.

[0097] The positive correlation means that the second weight increases as the shortest distance increases, and decreases as the shortest distance decreases.

[0098] Specifically, the second weight can be determined according to the ratio of the shortest distance to the transition range. Assuming that the transition range is represented by range, the second weight is represented by weight1, and the transition range is represented by (threshBot, minThresh) and (maxThresh, threshTop), the second weight weight1 is represented by the formula:

[0099]

[0100] In this embodiment, by determining the pixel value of the pixel point in the transition range, calculating the shortest distance between the pixel value and the threshold corresponding to the transition range, and then obtaining the second weight of the pixel in the transition range based on the positive correlation between the shortest distance and the second weight, the purpose of accurately obtaining the second weight of the pixel in the transition range can be achieved.

[0101] In one embodiment, Figure 5As shown, the first current pixel adjustment amount includes pixel adjustment amounts corresponding to a plurality of control points, and adjusting the first current video frame based on the first current pixel adjustment amount includes:

[0102] Step 502: interpolate the pixel adjustment amounts corresponding to the multiple control points to obtain the pixel adjustment amount of each pixel point in the first current video frame.

[0103] The interpolation calculation refers to the calculation of increasing the number of corresponding pixel adjustment amounts after the current image is processed with a higher resolution.

[0104] Specifically, the first current pixel adjustment amount is obtained by calculating a plurality of control points selected in the first current video frame, and the pixel adjustment amount needs to be calculated by interpolation so that each pixel in the first current video frame can be adjusted based on the pixel adjustment amount.

[0105] In one embodiment, in order to improve the video processing speed, the first video can be pre-processed with a reduced resolution. When the pixel adjustment amount is determined, the first video after the resolution reduction processing is processed with an increased resolution, and the video frame corresponding to the first current pixel adjustment amount is increased in resolution to obtain a video frame corresponding to the first current pixel adjustment amount with the same resolution as the first current video frame. Then, using the bilinear difference method, the pixel adjustment amount is corresponded to the position of a pixel point in the first current video frame to obtain the pixel value of the pixel point.

[0106] Step 504 : adjusting the pixel adjustment amount pixel values ​​of the pixels in the first current video frame according to the pixel adjustment amount of each pixel in the first current video frame to obtain an adjusted first current video frame.

[0107] Specifically, after obtaining the pixel adjustment amount of each pixel point in the first current video frame, the pixel point in the first current video frame after adjustment can be obtained by summing the pixel adjustment amount of each pixel point in the first current video frame and the pixel value of each pixel point in the first current video frame. For example, if the pixel value of a certain pixel point in the first current video frame is 100, and the pixel adjustment amount corresponding to the pixel point is 10, then the pixel value of the pixel point in the adjusted video frame is calculated by summing the pixel value of the pixel point and the pixel adjustment amount corresponding to the pixel point, that is, the pixel value of the pixel point after adjustment by the pixel adjustment amount is 110.

[0108] It can be understood that the process of performing pixel adjustment on the pixel points in the first current video frame in this embodiment is also applicable to performing pixel adjustment on the pixel points in the second current video frame.

[0109] In this embodiment, the pixel adjustment amount corresponding to multiple control points is interpolated to obtain the pixel adjustment amount of each pixel point in the first current video frame, and the pixel adjustment amount is used to adjust the pixel points in the first current video frame. This can achieve the purpose of adjusting the pixel adjustment amount of the pixel points in the first current video frame, thereby making the pixel value of the pixel point in the first current video frame transition more naturally during video splicing.

[0110] In one embodiment, Figure 6 As shown, the adjusted first current video frame and the adjusted second current video frame are spliced ​​to obtain a spliced ​​video frame including:

[0111] Step 602: Determine an overlapping area between a first current video frame and a second current video frame.

[0112] The overlapped area refers to the same area between the first current video frame and the second current video frame or the area whose similarity reaches a preset threshold. The similarity can be determined by the correlation coefficient between the pixel values ​​in the first current video frame and the pixel values ​​in the second current video frame. The preset threshold can be determined based on an empirical value or a statistical value of the similarity.

[0113] In one embodiment, the overlapped area between the first current video frame and the second current video frame is determined by calculating the area where the similarity between the first current video frame and the second current video frame reaches a preset threshold. For example, the first current video frame is represented as i, the second current video frame is represented as j, and the similarity between the first current video frame and the second current video frame is represented as Ncc, then the similarity Ncc can be expressed as a formula:

[0114] Ncc=∑(I i *I j ) / sqrt(∑(I i *I i )*∑(I j *I j ))

[0115] Assuming that the preset threshold is represented by m, the region of pixels where Ncc is greater than or equal to m is taken as the overlapping region between the first current video frame and the second current video frame.

[0116] Step 604 : weightedly fuse the adjusted first current video frame and the adjusted second current video frame in the overlapping area to obtain a fused area.

[0117] The weighted fusion refers to fusion according to the different proportions of the adjusted first current video frame and the adjusted second current video frame in the overlapping area.

[0118] Specifically, the first current video frame and the second current video frame may be fused according to the weights of the adjusted pixel values ​​of the pixels in the first current video frame and the adjusted pixel values ​​of the pixels in the second current video frame in the overlapped region to obtain a fused region. For example, the adjusted pixel value of the pixel in the first current video frame is represented by G i , the pixel value of the pixel point in the second current video frame after adjustment is expressed as H i , the proportion of the adjusted first current video frame in the overlapped area is 20%, and the proportion of the adjusted second current video frame in the overlapped area is 80%. Assuming that the obtained fusion area is represented by E, the fusion area E is expressed as the formula:

[0119] E=G i *20%+H i *80%

[0120] Step 606 , stitching the fused area, the adjusted non-overlapping area in the first current video frame, and the adjusted non-overlapping area in the second current video frame to obtain a stitched video frame.

[0121] The non-overlapping area refers to the area outside the overlapping area.

[0122] Specifically, the adjusted first current video frame includes the same fusion area as the adjusted second current video frame, and also includes the non-overlapping areas of the first current video frame and the second current video frame.

[0123] In this embodiment, by performing weighted fusion on the adjusted first current video frame and the adjusted second current video frame in the overlapping area, and splicing the non-overlapping areas of the adjusted first current video frame and the adjusted second current video frame, it is possible to reduce the impact of the color difference after fusion on the adjusted first current video frame and the adjusted second current video frame, make the grayscale values ​​of the pixels in the overlapping area as consistent as possible, achieve the purpose of eliminating color difference, and improve the image processing effect.

[0124] In one embodiment, two video frames among a plurality of video frames with overlapping areas shot by a camera at different angles are taken as an example. The two video frames are the first video frame and the second video frame, respectively. By calculating the correlation coefficient between the pixel values ​​of the pixels in the first video frame and the pixel values ​​of the pixels in the second video frame, and the difference between the pixel values ​​of the pixels in the first video frame and the pixel values ​​of the pixels in the second video frame, the weight of the equation of each pixel in the overlapping area can be obtained; according to the pixel values ​​of each pixel in the overlapping area and the weight of the equation of each pixel in the overlapping area, an equation based on weight is obtained; according to the equation, the pixel adjustment amount of the forward video frame of the first video frame and the pixel adjustment amount of the forward video frame of the second video frame, the pixel adjustment amount of the forward video frame of the first video frame and the pixel adjustment amount of the forward video frame of the second video frame are used as input values ​​of the above equation to obtain the corresponding pixel adjustment amount of the first video frame and the pixel adjustment amount of the second video frame. Repeat the above pixel adjustment amount obtaining process to obtain the pixel adjustment amount of each video frame, use the pixel adjustment amount of each video frame to adjust the pixels of each video frame, and perform image fusion on each adjusted video frame in the overlapping area to obtain a color difference spliced ​​video.

[0125] In one embodiment, a plurality of videos with overlapping areas may be obtained by using a shooting device such as an ordinary camera or a panoramic camera. Specifically, a panoramic camera may be used to shoot with multiple lenses at the same time or an ordinary camera may be used to shoot multiple videos using different viewing angles for multiple times, and the video frame images of the original videos obtained by the multiple shots may be processed by reducing the resolution; for example, the resolution of n original video frame images may be reduced to a preset size, so as to improve the processing speed of the video frames.

[0126] In one embodiment, by calculating the correlation coefficient between the pixel value of the pixel point in the first video frame and the pixel value of the pixel point in the second video frame, and the difference between the pixel value of the pixel point in the first video frame and the pixel value of the pixel point in the second video frame, the equation weight of each pixel point in the overlapping area can be obtained. Specifically, assuming that the first video frame is represented as i, the second video frame is represented as j, there is an overlapping area between the first video frame i and the second video frame j, and the pixel value of the pixel point in the first video frame i is represented as I i , the pixel value of the pixel point in the first video frame j is represented by I i , then the correlation coefficient Ncc between the first video frame i and the second video frame j is expressed as the formula:

[0127] Ncc=∑(I i *I j ) / sqrt(∑(I i *I i )*∑(I j *I j ))

[0128] Assume that the preset cross - correlation coefficient threshold is m, and filter out the image regions where Ncc < m. Calculate the pixel difference diff between the first video frame i and the second video frame j in the remaining regions. The pixel difference diff can be expressed by the formula:

[0129] diff = I i - I j

[0130] Perform a histogram statistics on the pixel difference diff, and obtain the threshold region data of the preset ratio in the histogram. The preset ratio can be 80%, that is, obtain the middle 80% data of the histogram. For the data within the threshold region of the above - mentioned preset ratio, read the upper and lower thresholds (minThreshRange, maxThreshRange); then expand the upper and lower thresholds of the difference, for example, expand each of the upper and lower thresholds by 10, that is, (minThreshRange - 10, maxThreshRange + 10), to obtain a completely reliable interval denoted as (minThresh, maxThresh); then calculate an adaptive transition interval size range from completely reliable to completely unreliable according to the pixel value size of each pixel point in the difference image. The larger the pixel difference, the larger the transition interval, and vice versa. The above - mentioned completely reliable interval plus the transition interval, that is, (minThresh - range, maxThresh + range), is denoted as the effective interval (threshBot, threshTop). The pixel points within the effective interval are selected as control points, called effective control points, to participate in the construction of the equation. The pixel points outside the effective interval are selected as invalid control points and do not participate in the construction of the equation, and the weight is set to 0; when the pixel points within the effective interval are selected as control points, the pixel value weight of this pixel point can be expressed as weight, and the weight weight can be expressed by the formula:

[0131]

[0132] Through the above formula, the pixel value weights of the pixel points selected as control points or all pixel points in the overlapping region between the first video frame i and the second video frame j can be calculated.

[0133] In one embodiment, in order to ensure that the difference in the transition interval size range obtained between two adjacent video frames in the first video or the second video is not large, so as to ensure the smooth change of the transition interval. Assume that the transition interval of the n - th frame in the first video or the second video is expressed as range(n), the transition interval of the (n - 1) - th frame in the first video or the second video is expressed as range(n - 1), and the smooth transition control weight is expressed as β. Then the transition interval range(n) of the n - th frame in the first video or the second video can be expressed by the formula:

[0134]

[0135] In one embodiment, a weight-based equation is obtained according to the pixel values ​​of each pixel point in the overlapping area and the pixel value weights of each pixel point in the overlapping area. Specifically, pixel points can be selected as control points in the overlapping area, the area farthest from the overlapping area, and the transition area between the overlapping area and the area farthest from the overlapping area, including the overlapping area. The pixel adjustment amount of the first video frame can be expressed as X i , the pixel adjustment amount of the second video frame can be expressed as X i , the pixel adjustment amount of the control point farthest from the overlapping area can be expressed as X m , the pixel adjustment amount between adjacent control points in the transition region of the first video frame or the second video frame can be expressed as X v and The penalty coefficient can be expressed as λ, and the pixel adjustment amount X of the above control point can be expressed as the formula:

[0136]

[0137] Control points are selected in the overlapping area, the area farthest from the overlapping area, and the transition area including the overlapping area to construct a control network covering the entire image. For example, the control network can be a triangular network or a quadrilateral network, and the adjustment amounts of the two vertices of each side of the control network are as consistent as possible. This embodiment can make the grayscale values ​​of the pixels in the overlapping area as consistent as possible after adjustment to achieve the purpose of eliminating color difference; the pixels in the area farthest from the overlapping area are adjusted as close to 0 as possible to achieve the purpose of making the image closer to the original image after color adjustment.

[0138] In one embodiment, according to the equation of the control point pixel adjustment amount X, the pixel adjustment amount of the forward video frame of the first video frame, and the pixel adjustment amount of the forward video frame of the second video frame, the pixel adjustment amount of the forward video frame of the first video frame and the pixel adjustment amount of the forward video frame of the second video frame are used as input values ​​of the equation to obtain the corresponding pixel adjustment amount of the first video frame and the pixel adjustment amount of the second video frame. Specifically, the equation of X can be converted into a matrix form and expressed as a formula:

[0139]

[0140] After taking the derivative of X in the above matrix and making its derivative equal to zero, the minimum value of the matrix is ​​obtained. The minimum value is expressed as the formula:

[0141] 2(A T A+Γ T Γ)X-2A T f=0, which is expressed as the formula:

[0142] (A T A+Γ T Γ)X=A T f

[0143] The above formula is solved by the conjugate gradient method until the above formula reaches the iteration termination threshold or the number of solutions reaches the preset number of times, and the pixel adjustment amount of the first video frame and the pixel adjustment amount of the second video frame are obtained. The pixel adjustment amount of the forward video frame of the first video frame and the pixel adjustment amount of the forward video frame of the second video frame are used as the input parameters of the above formula, and the obtained output parameters are used as the pixel adjustment amount of the first video frame and the pixel adjustment amount of the second video frame. The obtained pixel adjustment amount of the first video frame can be used to adjust the pixels of the first video frame, or the obtained pixel adjustment amount of the second video frame can be used to adjust the pixels of the second video frame. It can reduce the pixel difference between adjacent video frames in the overlapping area of ​​two videos, reduce the occurrence of flickering in the process of splicing two videos, and improve the iteration efficiency and reduce the occurrence of video flickering caused by excessive pixel adjustment of the two frames of video.

[0144] In one embodiment, the pixel adjustment amount of each video frame is used to adjust the pixels of each video frame, and the adjusted video frames in the overlapping area are fused to obtain a color difference-free spliced ​​video. Specifically, there are multiple video frames in the overlapping area of ​​the first video and the second video, and each video frame is adjusted according to the pixel adjustment amount to obtain an adjusted video frame. The image fusion can be performed on each video frame in the overlapping area of ​​the first video and the second video to obtain a seamless image. The seamless image can be represented as dst, and the weight of each video frame is represented as γ i , the pixel adjustment amount of the i-th video frame is expressed as bias i , the pixel value of the pixel in the original video frame is represented by I i , then the seamless image dst can be expressed as the formula:

[0145]

[0146] In one embodiment, the pixel adjustment amounts corresponding to the respective video frames in the overlapping area may be bilinearly interpolated to increase the resolution to the size of the original video frame to obtain the pixel adjustment amounts corresponding to the pixel values ​​of the pixel points of the original video frame, and the corresponding adjusted original video frame may be obtained by summing the original video frame and the corresponding pixel adjustment amounts.

[0147] It should be understood that although Figure 2-6The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-6 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0148] In one embodiment, Figure 7 As shown, a video processing device 700 is provided, including: a current video frame determination module 702, a historical pixel adjustment amount acquisition module 704, a current pixel adjustment amount determination module 706, an adjusted current video frame acquisition module 708 and a spliced ​​video frame acquisition module 710, wherein: the current video frame determination module 702 is used to determine a first current video frame to be spliced ​​in a first video, and a second current video frame in a second video corresponding to the first current video frame; the historical pixel adjustment amount acquisition module 704 is used to acquire a first historical pixel adjustment amount of a first historical video frame corresponding to the first current video frame, and a second historical pixel adjustment amount of a second historical video frame corresponding to the second current video frame; the current video frame determination module 702 is used to determine a first current video frame to be spliced ​​in a first video, and a second historical pixel adjustment amount of a second historical video frame corresponding to the second current video frame; The pixel adjustment amount determination module 706 is used to determine the first current pixel adjustment amount corresponding to the first current video frame and the second current pixel adjustment amount corresponding to the second current video frame according to the first historical pixel adjustment amount, the second historical pixel adjustment amount and the pixel adjustment constraint condition; the adjusted current video frame acquisition module 708 is used to adjust the first current video frame based on the first current pixel adjustment amount, and adjust the second current video frame based on the second current pixel adjustment amount to obtain the adjusted first current video frame and the adjusted second current video frame; the spliced ​​video frame acquisition module 710 is used to splice the adjusted first current video frame and the adjusted second current video frame to obtain a spliced ​​video frame.

[0149] In one embodiment, the current pixel adjustment amount determination module 706 is used to use the first historical pixel adjustment amount and the second historical pixel adjustment amount as the initial pixel adjustment amounts of the first current video frame and the second current video frame, respectively, and adjust the initial pixel adjustment amounts in a direction that satisfies the pixel adjustment constraint conditions to obtain the first current pixel adjustment amount and the second current pixel adjustment amount that satisfy the pixel adjustment constraint conditions.

[0150] In one embodiment, the current pixel adjustment amount determination module 706 is used to use the first historical pixel adjustment amount and the second historical pixel adjustment amount as the initial pixel adjustment amount of the first current video frame and the second current video frame respectively, and adjust the initial pixel adjustment amount in the direction of reducing the target value until the pixel adjustment constraint condition is satisfied, the pixel adjustment constraint condition includes at least one of the target value being less than a preset threshold value or the number of adjustments reaching a preset number of times; the target value is obtained by statistically analyzing the first value and the second value, the first value represents the pixel difference of the control point of the overlapping area between the first current video frame after pixel adjustment and the second current video frame after pixel adjustment, and the second value represents the size of the pixel adjustment change amount of the first current video frame and the size of the pixel adjustment change amount of the second current video frame.

[0151] In one embodiment, the current pixel adjustment amount determination module 706 is used to determine the target pixel difference corresponding to each pixel point in the overlapping area of ​​the first current video frame and the second current video frame; obtain the upper limit of the difference of the target pixel difference in the preset middle range as the first threshold, and obtain the lower limit of the difference of the target pixel difference in the preset middle range as the second threshold; determine the reliable range of the target pixel difference corresponding to the overlapping area based on the first threshold and the second threshold; determine the transition range of the target pixel difference corresponding to the reliable range; determine the first weight corresponding to the pixel points of the target pixel difference within the reliable range, and the second weight of the pixel points of the target pixel difference within the transition range, the first weight being greater than the second weight; determine the first value based on the first weight, the second weight and the pixel difference of the control point of the overlapping area.

[0152] In one embodiment, the current pixel adjustment amount determination module 706 is used to determine the pixel value of the pixel point whose target pixel difference is within the transition range; calculate the shortest distance between the pixel value and the threshold corresponding to the transition range; and determine the second weight of the pixel point whose target pixel difference is within the transition range based on the shortest distance, wherein the shortest distance is positively correlated with the second weight.

[0153] In one embodiment, the adjusted current video frame is obtained by module 708, and the pixel adjustment amount is used to interpolate the pixel adjustment amounts corresponding to multiple control points to obtain the pixel adjustment amount of each pixel point in the first current video frame; the pixel value of the pixel point in the first current video frame is adjusted according to the pixel adjustment amount of each pixel point in the first current video frame to obtain the adjusted first current video frame.

[0154] In one embodiment, the spliced ​​video frame obtaining module 710 is used to determine the overlapping area between the first current video frame and the second current video frame; perform weighted fusion of the adjusted first current video frame and the adjusted second current video frame in the overlapping area to obtain a fused area; and splice the fused area, the non-overlapping area in the adjusted first current video frame, and the non-overlapping area in the adjusted second current video frame to obtain a spliced ​​video frame.

[0155] For the specific definition of the video processing device, please refer to the definition of the video processing method above, which will not be repeated here. Each module in the above video processing device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.

[0156] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 8 As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a video processing method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.

[0157] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0158] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0159] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0160] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0161] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0162] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A video processing method, characterized in that: The method comprises: Determine a first current video frame to be spliced ​​in the first video, and a second current video frame in the second video corresponding to the first current video frame; Obtaining a first historical pixel adjustment amount of a first historical video frame corresponding to the first current video frame, and a second historical pixel adjustment amount of a second historical video frame corresponding to the second current video frame; Using the first historical pixel adjustment amount and the second historical pixel adjustment amount as initial pixel adjustment amounts of the first current video frame and the second current video frame respectively, and adjusting the initial pixel adjustment amounts in a direction that satisfies a pixel adjustment constraint condition, to obtain a first current pixel adjustment amount and a second current pixel adjustment amount that satisfy the pixel adjustment constraint condition; Adjusting the first current video frame based on the first current pixel adjustment amount, and adjusting the second current video frame based on the second current pixel adjustment amount, to obtain an adjusted first current video frame and an adjusted second current video frame; The adjusted first current video frame and the adjusted second current video frame are spliced ​​to obtain a spliced ​​video frame.

2. The method according to claim 1, characterized in that The using the first historical pixel adjustment amount and the second historical pixel adjustment amount as initial pixel adjustment amounts of the first current video frame and the second current video frame respectively, and adjusting the initial pixel adjustment amounts in a direction that satisfies the pixel adjustment constraint condition comprises: The first historical pixel adjustment amount and the second historical pixel adjustment amount are used as initial pixel adjustment amounts of the first current video frame and the second current video frame respectively, and the initial pixel adjustment amounts are adjusted in a direction of decreasing a target value until the pixel adjustment constraint condition is satisfied, wherein the pixel adjustment constraint condition includes at least one of the target value being less than a preset threshold value or the number of adjustments reaching a preset number of times; The target value is obtained by statistically analyzing the first value and the second value, wherein the first value represents the pixel difference of the control point of the overlapping area between the first current video frame after pixel adjustment and the second current video frame after pixel adjustment, and the second value represents the size of the pixel adjustment change of the first current video frame and the size of the pixel adjustment change of the second current video frame.

3. The method according to claim 2, characterized in that The step of obtaining the first value comprises: Determine a target pixel difference value corresponding to each pixel point in an overlapped area between the first current video frame and the second current video frame; Obtaining an upper limit of a difference of target pixel differences in a preset middle range as a first threshold, and obtaining a lower limit of a difference of target pixel differences in the preset middle range as a second threshold; Determine a reliable range of target pixel difference values ​​corresponding to the overlapped area based on the first threshold and the second threshold; Determine a transition range of target pixel difference values ​​corresponding to the reliable range; Determine a first weight corresponding to a pixel point whose target pixel difference is within a reliable range, and a second weight corresponding to a pixel point whose target pixel difference is within a transition range, wherein the first weight is greater than the second weight; The first value is determined based on the first weight, the second weight, and the pixel difference of the control points in the overlapping area.

4. The method according to claim 3, characterized in that The step of determining the second weight of the pixel point whose target pixel difference value is within the transition range comprises: Determine the pixel value of the pixel point whose target pixel difference value is within the transition range; Calculating the shortest distance between the pixel value and a threshold value corresponding to the transition range; A second weight of a pixel point whose target pixel difference value is within a transition range is determined based on the shortest distance, wherein the shortest distance is positively correlated with the second weight.

5. The method according to claim 1, characterized in that: The first current pixel adjustment amount includes pixel adjustment amounts corresponding to a plurality of control points, and the adjusting the first current video frame based on the first current pixel adjustment amount includes: Performing interpolation calculation on the pixel adjustment amounts corresponding to the multiple control points to obtain the pixel adjustment amount of each pixel point in the first current video frame; The pixel values ​​of the pixels in the first current video frame are adjusted according to the pixel adjustment amount of each pixel in the first current video frame to obtain an adjusted first current video frame.

6. The method according to claim 1, characterized in that The step of splicing the adjusted first current video frame and the adjusted second current video frame to obtain a spliced ​​video frame includes: Determining an overlapping area between the first current video frame and the second current video frame; Performing weighted fusion of the adjusted first current video frame and the adjusted second current video frame in the overlapping area to obtain a fused area; The fusion area, the adjusted non-overlapping area in the first current video frame, and the adjusted non-overlapping area in the second current video frame are spliced ​​to obtain a spliced ​​video frame.

7. A video processing device, characterized in that: The device comprises: A current video frame determination module, used to determine a first current video frame to be spliced ​​in the first video, and a second current video frame in the second video corresponding to the first current video frame; A historical pixel adjustment amount acquisition module, used to acquire a first historical pixel adjustment amount of a first historical video frame corresponding to the first current video frame, and a second historical pixel adjustment amount of a second historical video frame corresponding to the second current video frame; a current pixel adjustment amount determination module, configured to use the first historical pixel adjustment amount and the second historical pixel adjustment amount as initial pixel adjustment amounts of the first current video frame and the second current video frame, respectively, and adjust the initial pixel adjustment amounts in a direction that satisfies a pixel adjustment constraint condition, so as to obtain a first current pixel adjustment amount and a second current pixel adjustment amount that satisfy the pixel adjustment constraint condition; an adjusted current video frame obtaining module, configured to adjust the first current video frame based on the first current pixel adjustment amount, and adjust the second current video frame based on the second current pixel adjustment amount, to obtain an adjusted first current video frame and an adjusted second current video frame; The spliced ​​video frame obtaining module is used to splice the adjusted first current video frame and the adjusted second current video frame to obtain a spliced ​​video frame.

8. The device according to claim 7, characterized in that The current pixel adjustment amount determination module is further used to: The first historical pixel adjustment amount and the second historical pixel adjustment amount are used as initial pixel adjustment amounts of the first current video frame and the second current video frame respectively, and the initial pixel adjustment amounts are adjusted in a direction of decreasing a target value until the pixel adjustment constraint condition is satisfied, wherein the pixel adjustment constraint condition includes at least one of the target value being less than a preset threshold value or the number of adjustments reaching a preset number of times; The target value is obtained by statistically analyzing the first value and the second value, wherein the first value represents the pixel difference of the control point of the overlapping area between the first current video frame after pixel adjustment and the second current video frame after pixel adjustment, and the second value represents the size of the pixel adjustment change of the first current video frame and the size of the pixel adjustment change of the second current video frame.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Video splicing method, device and system, computer equipment and storage medium

    CN112437253A