Video anti-shake display method and electronic equipment

Through multi-threaded asynchronous parallel processing and interpolation algorithms, multiple smooth paths are generated, combined with the reconstructed transformation matrix group for video debounce, which solves the problems of low video debounce efficiency and insufficient result selectivity in the existing technology, and achieves high efficiency. , diverse video deshaking processing.

CN118741013AActive Publication Date: 2024-10-01HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202310350616.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-27
Publication Date
2024-10-01
Estimated Expiration
2043-03-27

AI Technical Summary

Technical Problem

The existing technology has low efficiency and high latency in video debounce processing, and users have a limited range of choices for debounce results, making it difficult to meet the needs of different scenarios.

Method used

Multi-threaded asynchronous parallel processing of video frames is used, video frame packets are obtained through multiple asynchronous threads, the jitter path is determined, and multiple smooth paths are generated using an interpolation algorithm, and image transformation is performed in combination with the reconstructed transformation matrix group to achieve video de-jittering.

Benefits of technology

It improves video debounce efficiency, reduces delay and blocking, retains more video image frame content, and meets the diverse needs of different users in different scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118741013A_ABST
    Figure CN118741013A_ABST
Patent Text Reader

Abstract

The invention discloses a video anti-shake display method and electronic equipment, and relates to the technical field of terminals, and the video anti-shake display method and the electronic equipment can improve the video anti-shake efficiency, reserve more video frame picture contents and obtain a plurality of anti-shake videos, and comprises the following steps: through each first asynchronous thread in a plurality of first asynchronous threads, obtaining a part of video frame packets in a video, processing a part of the video frame packet to obtain a jitter path of the reference pixel point between video frames of the video frame packet; determining the jitter path of the video according to the jitter path of the reference pixel point in the partial video frame obtained by processing each first asynchronous thread; smoothing jitter with the jitter amplitude smaller than a first threshold value and the jitter frequency larger than a second threshold value in the jitter path, and determining a first smooth path; determining at least one second smooth path in combination with an interpolation algorithm according to the at least two first smooth paths; determining a reconstruction transformation matrix group corresponding to the candidate smooth path through a second asynchronous thread; and determining a jitter-removed video according to the reconstructed transformation matrix group pair.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal technology, and in particular to a video anti-shake display method and an electronic device. Background Art

[0002] Before playing a video, an electronic device can perform post-processing operations on the video using video stabilization (de-shake) technology to automatically remove the extra jitter introduced during video shooting, thereby stabilizing the video content and improving video quality.

[0003] In the related art, electronic devices de-jitter videos frame by frame based on a sequential decoding framework. This method is limited by the speed of video frame input and has low de-jitter efficiency. Alternatively, videos are de-jittered using a pre-trained convolutional neural network, which has a large amount of computation, high latency, and low efficiency. In addition, users have a limited range of choices for de-jitter results, which makes it difficult to meet the needs of different scenarios. Summary of the invention

[0004] The present application provides a video anti-shake display method and electronic device, which can improve the efficiency of video de-shaking, retain more video image frame content, and obtain multiple de-shaking videos.

[0005] In order to achieve the above objectives, the embodiments of the present application provide the following technical solutions:

[0006] In a first aspect, the present application provides a video anti-shake display method, comprising: obtaining a portion of video frame packets in a video through each of a plurality of first asynchronous threads, and processing the portion of the video frame packets to obtain a jitter path of a reference pixel between video frames in the video frame packet; different first asynchronous threads process different video frame packets; the video frame packet comprises at least two adjacent video frames; determining the jitter path of the video according to the jitter path of the reference pixel in the portion of the video frames obtained by each first asynchronous thread; smoothing the jitter in the jitter path whose jitter amplitude is less than a first threshold and whose jitter frequency is greater than a second threshold to determine a first smooth path; determining at least one second smooth path according to at least two first smooth paths in combination with an interpolation algorithm; determining a reconstructed transformation matrix group corresponding to a candidate smooth path through a second asynchronous thread; the candidate smooth path comprises at least two first smooth paths and at least one second smooth path; the reconstructed transformation matrix group comprises a reconstructed transformation matrix corresponding to at least one video frame packet; the reconstructed transformation matrix is ​​obtained by performing image transformation on the video frame in the video frame packet; the reconstructed transformation matrix represents the correspondence between the video frame and the corresponding pixel points in the video frame after the image transformation; de-shaking the video through the reconstructed transformation matrix group to determine the de-shaking video.

[0007] In this way, the electronic device uses multi-threaded asynchronous parallel processing to de-jitter the video frame, which improves the de-jitter efficiency of the electronic device for the video and reduces delay and blocking. The jitter in the jitter path with a jitter amplitude less than the first threshold and a jitter frequency greater than the second threshold is smoothed. The jitter in the jitter path with a jitter amplitude too large and a jitter frequency too small is not processed, which reduces the screen cropping area and retains more video image content. An interpolation algorithm is used to generate multiple smoothing paths, thereby obtaining multiple de-jittered videos to meet the needs of different users for diverse de-jitter results in different scenarios.

[0008] For example, Figure 2 As shown, the mobile phone decodes the video frame by frame to obtain a video frame queue. Two consecutive video frames in the video frame queue are packaged to obtain multiple image pairs (video frame packets), and the multiple image pairs form a transit queue. The mobile phone can use multiple first asynchronous threads to perform asynchronous parallel feature matching and asynchronous parallel path estimation on multiple image pairs to obtain a jitter path. Afterwards, a mixed-order adaptive path smoothing optimization (MAPS) algorithm is used to smooth the jitter in the jitter path whose jitter amplitude is less than the first threshold and whose jitter frequency is greater than the second threshold to obtain a smooth path (first smooth path). According to at least two first smooth paths, at least one second smooth path is determined in combination with an interpolation algorithm. Afterwards, multiple second asynchronous threads are used to perform asynchronous parallel motion compensation and asynchronous parallel image transformation on the image pairs in each first smooth path and second smooth path (candidate smooth path) to obtain an unordered reconstruction transformation matrix corresponding to the image pair. Afterwards, the mobile phone can perform streaming sorting on multiple unordered reconstruction transformation matrices to obtain an ordered reconstruction transformation matrix group. Afterwards, the mobile phone can render and reconstruct the jittered video frame according to the ordered reconstruction transformation matrix group to obtain a de-shaked video frame, encode the de-shaked video frame, and obtain a final de-shaked stable video (de-shaked video).

[0009] In a possible implementation, each of the multiple first asynchronous threads obtains a portion of video frame packets in the video, and processes the portion of the video frame packets to obtain a jitter path of a reference pixel between video frames in the video frame packet, including: each first asynchronous thread determines the position of a reference pixel on each video frame in at least one video frame packet according to at least one video frame packet, and the jitter path is obtained by curve fitting the position of the reference pixel determined by each first asynchronous thread. In this way, the jitter path of the video can be quickly obtained.

[0010] For example, Fig. 7A and Figure 7BAs shown, the coordinates of the four vertices (reference pixel points) of the video frame are determined. The jitter paths of the four vertices of the video frame are calculated respectively according to the global homography transformation matrix gloH.

[0011] In a possible implementation, smoothing is performed on jitters in a jitter path whose jitter amplitude is less than a first threshold and whose jitter frequency is greater than a second threshold, and determining a first smoothing path, including: determining a smoothing parameter, the smoothing parameter at least including a maximum amplitude, a minimum amplitude, and a preset sliding window; smoothing is performed on jitters in a jitter path whose jitter amplitude is less than a first threshold and whose jitter frequency is greater than a second threshold according to the smoothing parameter, the jitter path, and the number of video frames, and determining the first smoothing path. In this way, jitters with "small amplitude" and "high frequency" in the jitter path can be removed. Jitters with larger amplitudes or lower frequencies in the jitter path are not removed, so that excessive de-jittering of video frames can be avoided, resulting in excessive black edges. The degree of cropping of video frames is reduced to retain more edge information of video frames.

[0012] Exemplarily, "small amplitude" jitter is jitter with a small jitter amplitude in the jitter path. For example, the jitter in which the global motion vector in the video frame is offset by less than 5% of the short side of the image. Exemplarily, the video frame is 100 pixels long from left to right, and the jitter distance of the video frame from left to right is less than 5 pixels. "High frequency" jitter is jitter with a high jitter frequency in the jitter path. For example, jitter in which the global vector direction changes more than 3 times within 1s. Exemplarily, within 1s, the video frame jitters from left to right and from right to left more than 3 times.

[0013] In a possible implementation, the method further includes: determining a first sliding window according to the maximum amplitude and the minimum amplitude, the first sliding window being used to remove jitter in the jitter path whose jitter amplitude is less than a first threshold; determining a second sliding window according to the maximum amplitude, the minimum amplitude and a preset sliding window, the second sliding window being used to remove jitter in the jitter path whose jitter frequency is greater than a second threshold; determining a third sliding window according to the first sliding window and the second sliding window, the third sliding window being used to remove jitter in the jitter path whose jitter amplitude is less than the first threshold and whose jitter frequency is greater than the second threshold; and smoothing the jitter path according to the third sliding window and the jitter path in combination with Gaussian filtering to determine a first smoothed path.

[0014] Exemplarily, a zero-order penalty term (zero-order velocity model modeling) is introduced to determine the sliding window M_spd (first sliding window) corresponding to the jitter of "small amplitude" in the jitter path, and a first-order penalty term (first-order acceleration model modeling) is introduced to determine the sliding window M_acc (second sliding window) corresponding to the jitter of "high frequency" in the jitter path. Then, a mixed-order model is constructed, and the Gaussian filter sliding window size M (third sliding window) for removing "small amplitude" and "high frequency" jitter is determined according to M_spd and M_acc. Finally, the mobile phone can perform Gaussian filtering according to the jitter path S and sliding window M input at each moment (each frame) to determine the smooth path S' at each moment (each frame).

[0015] In a possible implementation, determining at least one second smooth path based on at least two first smooth paths in combination with an interpolation algorithm includes: determining at least one second smooth path based on at least two first smooth paths in combination with a linear interpolation algorithm. In this way, multiple smooth paths can be quickly obtained, thereby obtaining multiple de-shaking videos, meeting the needs of different users for diverse de-shaking results in different scenarios.

[0016] For example, Fig. 9 As shown, the smooth path marked as 1 and the smooth path marked as 10 are interpolated in an asynchronous parallel manner, that is, multiple threads simultaneously interpolate the smooth path marked as 1 and the smooth path marked as 10, and n smooth paths can be quickly obtained, where n is an integer greater than or equal to 3.

[0017] In a possible implementation, a reconstruction transformation matrix group corresponding to a candidate smooth path is determined through multiple second asynchronous threads, including: for a candidate smooth path, a reconstruction transformation matrix of each video frame corresponding to the candidate smooth path is determined through multiple second asynchronous threads; and a stream sorting algorithm is used to sort the reconstruction transformation matrix of each video frame to determine a reconstruction transformation matrix group corresponding to the candidate smooth path. In this way, multiple reconstruction transformation matrices are obtained in an asynchronous parallel manner to improve the efficiency of video de-jittering.

[0018] Among them, the multiple reconstructed transformation matrices obtained by asynchronous parallelism are unordered reconstructed transformation matrices. It is necessary to use a stream sorting algorithm to sort the reconstructed transformation matrix of each video frame, and determine the sorted multiple reconstructed transformation matrices as a reconstructed transformation matrix group.

[0019] In a possible implementation, the method further includes storing the reconstruction transformation matrix group. In this way, the mobile phone can perform de-jitter processing on the video according to the stored reconstruction transformation matrix group, which occupies less memory and is highly efficient.

[0020] For example, the mobile phone can decode the video to obtain multiple video frames, and render and reconstruct the multiple video frames using the corresponding reconstruction transformation matrix in the reconstruction transformation matrix group to obtain de-jittered video frames. Then, the mobile phone can encode the de-jittered video frames to obtain de-jittered videos. Figure 4 In the video window 408 shown in (d).

[0021] In a possible implementation, the method further includes: displaying a first interface, the first interface including an anti-shake control; receiving a first operation of the user on the anti-shake control, the first operation being used to input a first anti-shake level; de-shaking the video by reconstructing a transformation matrix group, including: in response to receiving the first operation, de-shaking the video according to the reconstructed transformation matrix group corresponding to the first anti-shake level; the reconstructed transformation matrix group corresponding to the first anti-shake level represents the reconstructed transformation matrix group corresponding to the candidate smooth path corresponding to the first anti-shake level; wherein the anti-shake level corresponds to the candidate smooth path one by one. In this way, the video can be de-shaked quickly, and multiple de-shake videos can be obtained, thereby improving the user experience.

[0022] For example, the user can slide (or click) the intensity bar to determine the de-shaking level. Figure 5A As shown in (b), the user can slide the strength bar to the de-shaking gear 3 (first operation). In response to the user sliding the strength bar to the de-shaking gear 3, the mobile phone de-shakes the video. Among them, the de-shaking gears 1-10 correspond to the smoothing paths 1-10.

[0023] In another embodiment, if Figure 5B As shown in (a), the user can click the de-shaking control 413 (first operation) of the toolbar 411. In response to the user clicking the de-shaking control 413, the mobile phone can first de-shake the video.

[0024] Optionally, the above is only an example of the first operation, and the first operation may also be other operations, which is not limited in the embodiments of the present application.

[0025] In a second aspect, the present application provides an electronic device comprising: a processor and a memory, the memory being coupled to the processor, the memory being used to store computer program code, the computer program code comprising computer instructions, and when the processor reads the computer instructions from the memory, the electronic device executes the method described in the first aspect.

[0026] In a third aspect, the present application provides a computer-readable storage medium, in which instructions are stored. When the instructions are executed on an electronic device, the electronic device executes the method described in the first aspect.

[0027] In a fourth aspect, the present application provides a chip system comprising at least one processor and at least one interface circuit, wherein the at least one interface circuit is used to perform transceiver functions and send instructions to at least one processor, and when the at least one processor executes the instructions, the at least one processor executes a method as described in any one of the above-mentioned first aspects.

[0028] In a fifth aspect, the present application also provides a computer program product, comprising instructions, which, when executed on a computer, enables the computer to execute the method as described in any one of the first aspects.

[0029] In a sixth aspect, an embodiment of the present application provides a circuit system, the circuit system includes a processing circuit, and the processing circuit is configured to execute the method of the first aspect or any one of the implementations of the first aspect.

[0030] The technical effects corresponding to the second to sixth aspects and any one of the implementation methods of the second to sixth aspects can be referred to the technical effects corresponding to the above-mentioned first aspect and any one of the implementation methods of the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 A flow chart of a video anti-shake display method provided in an embodiment of the present application;

[0032] Figure 2 A flow chart of another video anti-shake display method provided in an embodiment of the present application;

[0033] Figure 3A A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0034] Figure 3B A schematic diagram of the structure of another electronic device provided in an embodiment of the present application;

[0035] Figure 3C A schematic diagram of a module of an electronic device provided in an embodiment of the present application;

[0036] Figure 4 A schematic diagram of an interface of an electronic device provided in an embodiment of the present application;

[0037] Figure 5A A schematic diagram of an interface of another electronic device provided in an embodiment of the present application;

[0038] Figure 5B A schematic diagram of an interface of another electronic device provided in an embodiment of the present application;

[0039] Figure 6 A schematic diagram of an interface of another electronic device provided in an embodiment of the present application;

[0040] Fig. 7A A schematic diagram of interface comparison provided in an embodiment of the present application;

[0041] Figure 7B Another interface comparison diagram provided in an embodiment of the present application;

[0042] Figure 8 A schematic diagram of a jitter curve provided in an embodiment of the present application;

[0043] Fig. 9 A flow chart of an interpolation method provided in an embodiment of the present application;

[0044] Fig.10 Another schematic diagram of a jitter curve provided in an embodiment of the present application;

[0045] Fig.11 A schematic diagram of an interface of another electronic device provided in an embodiment of the present application;

[0046] Fig.12 A flow chart of another video anti-shake display method provided in an embodiment of the present application;

[0047] Fig.13 A flow chart of another video anti-shake display method provided in an embodiment of the present application;

[0048] Fig.14 A flow chart of another video anti-shake display method provided in an embodiment of the present application;

[0049] Fig.15 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0050] Fig.16 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION

[0051] An operating method and an electronic device provided in an embodiment of the present application are described in detail below with reference to the accompanying drawings.

[0052] The terms "including" and "having" and any variations thereof mentioned in the description of the embodiments of the present application are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may optionally include other steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices.

[0053] It should be noted that, in the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.

[0054] In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more. The "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.

[0055] When shooting a video, if the shooting device is unstable, the shooting light is unstable, or the shooting environment is unstable (such as shooting in windy, rainy and other weather conditions), the video may shake. Before the electronic device plays the video, the video anti-shake (de-shake) technology can be used to de-shake the video so that the electronic device can play the video with stable content.

[0056] In the related art, electronic devices de-jitter frame by frame based on a sequential decoding framework, such as Figure 1 As shown in the figure, the electronic device performs feature matching, path estimation, jitter path calculation, path smoothing, motion compensation, image transformation and other operations on the video frame by frame, and finally outputs a stable frame after de-jittering. The whole process is carried out synchronously. If one of the steps is slow, it may block the whole process and reduce the efficiency of de-jittering processing.

[0057] Alternatively, the electronic device performs corner point detection on the current frame of video image to be displayed and the previous frame of video image that has been displayed, calculates the affine transformation matrix of the corresponding corner points, and determines the video frame after de-shaking according to the affine transformation matrix, so as to realize video anti-shake display.

[0058] However, this method is limited by the speed of video frame input, and the de-jittering efficiency is low. In addition, the stability of the current frame is based on the result of the previous frame. If there is an error after the previous frame is de-jittered, then the current frame will also have an error after de-jittering. There is an error accumulation effect, which makes the stability of the entire video after de-jittering worse.

[0059] Alternatively, the electronic device can extract feature key points in the video frame, input the feature key points into the video stabilization model, and output stabilization displacement data corresponding to each feature key point; re-render the video frame according to the stabilization displacement data to generate a stabilized video frame.

[0060] This method requires training the video stabilization model first and uses deep learning technology, which results in large amount of computation, high latency, and high hardware requirements for electronic devices. A large amount of data is required to train the neural network, which is costly and has a long training cycle.

[0061] To solve the above problems, the embodiment of the present application provides a video anti-shake display method, in which the electronic device can use a streaming asynchronous de-shake framework to de-shake the video. Specifically, Figure 2 As shown, the electronic device decodes the video frame by frame to obtain a video frame queue. Two consecutive video frames in the video frame queue are packaged to obtain multiple image pairs (video frame packets), and the multiple image pairs form a transit queue. The mobile phone can use multiple first asynchronous threads to perform asynchronous parallel feature matching and asynchronous parallel path estimation on multiple image pairs to obtain a jitter path. The jitter path is smoothed to obtain a smooth path. Then, multiple second asynchronous threads are used to perform asynchronous parallel motion compensation and asynchronous parallel image transformation on the image pairs in the smooth path to obtain an unordered reconstruction transformation matrix corresponding to the image pair. Then, the mobile phone can perform streaming sorting on the unordered reconstruction transformation matrix to obtain an ordered reconstruction transformation matrix group. Then, the mobile phone can render and reconstruct the jitter video frame according to the ordered reconstruction transformation matrix group to obtain a de-jittered video frame, encode the de-jittered video frame, and obtain a stable video (de-jittered video) after the final de-jittering. The entire de-jittering process adopts a streaming architecture. After the electronic device decodes the video, it immediately processes the decoded video frame, which can avoid reading the entire video and effectively reduce the memory overhead. Therefore, it can support the electronic device to process videos of any length without being limited by the memory size. Multiple processes are processed asynchronously and in parallel, and multiple video frames can be processed simultaneously with high efficiency.

[0062] Among them, the electronic device can use the mixed-order adaptive path smoothing optimization (MAPS) method to smooth the jitter path of the video to obtain a smooth path (stable path) of the video. The electronic device can also interpolate and generate multiple smooth paths based on two smooth paths using the infinite de-jitter method to obtain multiple stable videos. Among them, the infinite de-jitter method includes processing two smooth paths using an interpolation method to obtain multiple smooth paths.

[0063] The technical solution of the embodiment of the present application uses a streaming de-jitter framework to de-jitter the video, which improves the de-jitter efficiency of the electronic device for the video and reduces latency and blocking. The MAPS method is used to smooth the jitter path, reduce the image cropping area, and retain more image content. The infinite de-jitter method is used to generate multiple smooth paths, thereby obtaining multiple de-jittered videos, meeting the needs of different users for diverse de-jitter results in different scenarios.

[0064] In a possible implementation, the embodiment of the present application can be applied in an electronic device, and the electronic device can implement the above-mentioned video anti-shake display method. The electronic device can be a personal computer (PC), a mobile phone, a tablet computer (Pad), a laptop computer, a desktop computer, a laptop computer, a computer with a transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, a wireless terminal in industrial control, a wireless terminal in self-driving, a wireless terminal in remote medical, a wireless terminal in smart grid, a wireless terminal in transportation safety, a wireless terminal in smart city, a wireless terminal in smart home, a wearable device, a vehicle-mounted device and other terminal devices. The embodiment of the present application does not impose any special restrictions on the specific form of the electronic device.

[0065] Figure 3A The hardware structure diagram of the electronic device provided in the embodiment of the present application is shown. The electronic device may be the electronic device described above. The electronic device includes at least one processor 201, a communication line 202, a memory 203 and at least one communication interface 204. The memory 203 may also be included in the processor 201.

[0066] Figure 3A The hardware structure diagram of the electronic device provided in the embodiment of the present application is shown. The electronic device may be the first electronic device and / or the second electronic device described above. The electronic device includes at least one processor 201, a communication line 202, a memory 203 and at least one communication interface 204. The memory 203 may also be included in the processor 201.

[0067] The processor 201 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0068] The communication link 202 may include a pathway to transmit information between the above-mentioned components.

[0069] The communication interface 204 is used to communicate with other devices. In the embodiment of the present application, the communication interface can be a module, a circuit, a bus, an interface, a transceiver or other device capable of realizing a communication function, and is used to communicate with other devices. Optionally, when the communication interface is a transceiver, the transceiver can be an independently arranged transmitter, which can be used to send information to other devices, and the transceiver can also be an independently arranged receiver, which is used to receive information from other devices. The transceiver can also be a component that integrates the functions of sending and receiving information, and the embodiment of the present application does not limit the specific implementation of the transceiver.

[0070] The memory 203 may be a volatile memory or a nonvolatile memory, or may include both volatile and nonvolatile memories. Among them, the nonvolatile memory may be a read-only memory (ROM), a programmable ROM (PROM), an erasable programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchlink DRAM (SLDRAM) and direct rambus RAM (DR RAM) or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but not limited to this. The memory can be independent and connected to the processor 201 via the communication line 202. The memory 203 can also be integrated with the processor 201.

[0071] The memory 203 is used to store computer-executable instructions for implementing the solution of the present application, and the execution is controlled by the processor 201. The processor 201 is used to execute the computer-executable instructions stored in the memory 203, thereby implementing the carrier transmission method provided in the following embodiments of the present application.

[0072] Optionally, the computer-executable instructions in the embodiments of the present application may also be referred to as application code, instructions, computer program or other names, which are not specifically limited in the embodiments of the present application.

[0073] In a specific implementation, as an embodiment, the processor 201 may include one or more CPUs, such as Figure 3A CPU0 and CPU1 in.

[0074] In a specific implementation, as an embodiment, the electronic device may include multiple processors, such as Figure 3A 201 and processor 205 in the embodiment of the present invention. Each of these processors may be a single-CPU processor or a multi-CPU processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).

[0075] The above-mentioned electronic device may be a general device or a special device, and the embodiment of the present application does not limit the type of the electronic device.

[0076] It is understood that the structures illustrated in the embodiments of the present application do not constitute specific limitations on the first electronic device 100 and the second electronic device 200. In other embodiments of the present application, the first electronic device 100 and the second electronic device 200 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0077] In the embodiments of the present application, the electronic device is described as a mobile phone, but this does not constitute a limitation on the form, function, etc. of the electronic device. Figure 3B , is a schematic diagram of the structure of a mobile phone provided in an embodiment of the present application. The methods in the following embodiments can be implemented in a mobile phone having the above hardware structure.

[0078] like Figure 3B As shown, the mobile phone may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a camera 193, and a display screen 194. Optionally, the mobile phone may also include a mobile communication module 150, etc.

[0079] It is to be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the mobile phone. In other embodiments, the mobile phone may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0080] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0081] The controller can be the nerve center and command center of the mobile phone. The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.

[0082] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0083] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a USB interface, etc.

[0084] The charging management module 140 is used to receive charging input from the charger. While the charging management module 140 is charging the battery 142, it can also power the mobile phone through the power management module 141. The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 can also receive input from the battery 142 to power the mobile phone.

[0085] The wireless communication function of the mobile phone can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.

[0086] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the mobile phone can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0087] When the mobile phone includes the mobile communication module 150, the mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the mobile phone. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.

[0088] The modulation and demodulation processor may include a modulator and a demodulator, wherein the modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal.

[0089] The wireless communication module 160 can provide wireless communication solutions for mobile phones, including wireless local area networks (WLAN) (such as Wi-Fi networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), NFC, infrared technology (IR), etc. The wireless communication module 160 can be one or more devices integrating at least one communication processing module.

[0090] In some embodiments, the mobile phone's antenna 1 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the mobile phone can communicate with the network and other devices through wireless communication technology.

[0091] The mobile phone realizes the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connecting the display screen 194 and the application processor. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.

[0092] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the mobile phone may include 1 or N display screens 194, where N is a positive integer greater than 1. In some embodiments of the present application, during the de-shaking process of the mobile phone, the display screen 194 displays as follows: Figure 4 , Figure 5A , Figure 5B , Figure 6 The de-bounce interface shown in the figure.

[0093] The mobile phone can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor. In some embodiments, the mobile phone may include 1 or N cameras 193, where N is a positive integer greater than 1. In the embodiment of the present application, the mobile phone can de-shake the shaking video shot by the camera 193.

[0094] The external memory interface 120 can be used to connect an external memory card to expand the storage capacity of the mobile phone. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos can be stored in the external memory card.

[0095] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the mobile phone by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. In an embodiment of the present application, the internal memory 121 may store a reconstructed transformation matrix.

[0096] The mobile phone can realize audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the earphone interface 170D, and the application processor.

[0097] Figure 3C The electronic device provided in the embodiment of the present application is shown as a module schematic diagram. The electronic device includes an application module 301 and an algorithm module 302.

[0098] The application module 301 is used to obtain a jittery video, decode the jittery video into a jittery video frame, and pack two consecutive jittery video frames into an image pair. The application module 301 is also used to send the jittery video frame to the algorithm module 302. The application module 301 is also used to receive multiple reconstruction transformation matrix groups from the algorithm module 302 and store them in a local disk. The reconstruction transformation matrix H can represent the corresponding transformation relationship between the corresponding pixel points in the video frame after image transformation and the video frame before de-shaking. The reconstruction transformation matrix H can also represent the corresponding transformation relationship between the corresponding pixel points in the video frame after de-shaking and the video frame before de-shaking. The application module 301 is also used to render and reconstruct the video frames in sequence according to the reconstruction transformation matrices in the reconstruction transformation matrix group corresponding to the de-shaking gear selected by the user to obtain a de-shaking video.

[0099] The algorithm module 302 is used to receive an image pair from the application module. The algorithm module 302 is also used to perform asynchronous feature matching and asynchronous path estimation on the image pair in a streaming asynchronous de-jittering framework to obtain a jitter path. The algorithm module 302 is also used to smooth the jitter path according to a mixed-order adaptive path smoothing optimization algorithm to obtain a smooth path. The algorithm module 302 is also used to perform differential processing on the smooth path according to the infinite de-jittering method to obtain at least three smooth paths. The algorithm module 302 is also used to perform asynchronous motion compensation and asynchronous image transformation processing on the smooth path to obtain multiple reconstruction transformation matrix groups.

[0100] Figure 3C The functional modules in the electronic device and the connection relationship between the modules are only exemplarily shown. It should be understood that the electronic device may include more or fewer modules than shown in the figure, or combine some modules, or split some modules, or have different module arrangements and connection relationships. The modules shown in the figure can be implemented in hardware, software, or a combination of software and hardware.

[0101] Users usually edit videos before sharing or publishing them, such as trimming, removing jitters, adding special effects, etc., to obtain high-quality videos.

[0102] Optionally, the "video" involved in the embodiments of the present application can be a video of any type or length, for example, a short video or a long video. The video can be called a source video, a source video file, a video to be edited, a video file to be edited, a video file, or other similar names.

[0103] After receiving the de-shaking instruction input by the user, the mobile phone can use the algorithm of the relevant function to implement the de-shaking processing of the video. The video de-shaking method provided in the embodiment of the present application can be embedded in multimedia applications (application, APP) such as gallery and camera, and can also be embedded in applications such as video editing, without relying on the underlying hardware devices. The camera provides the ability to take photos or videos, and the gallery saves a variety of pictures and videos. The video editing application can import videos. When editing the video, the gallery can be used as a suitable entry, the camera can be used as an entry, and the video editing application can also be used as an entry.

[0104] The embodiment of the present application takes the implementation of the entry for video editing in a video editing application on a mobile phone as an example to illustrate the scenario of de-shaking the video.

[0105] like Figure 4As shown in (a), it is a schematic diagram of a main interface 401 of a mobile phone provided in an embodiment of the present application. The main interface 401 includes icons such as clock, calendar, gallery, memo, video clip 402, settings, music, calculator, camera, address book, phone, information, etc. The user can click on the video clip 402 in the main interface 40. In response to the user's operation of clicking on the video clip 402, the mobile phone displays the following Figure 4 The interface 403 shown in (b) of FIG. The interface 403 includes an import window 404, a draft, etc. The user can click the import window 404 of the interface 403. In response to the user clicking the import window 404, the mobile phone displays the following Figure 4 Interface 405 shown in (c) of FIG. 405 includes multiple videos stored in the mobile phone. Optionally, the user can select the video to be processed and click the import control 406. In response to the user clicking the import control 406, the mobile phone displays the following Figure 4 Interface 407 shown in (d).

[0106] Interface 407 includes video window 408, playback control 409, video playback progress bar area 410, toolbar 411, and export control 412. Toolbar 411 includes split control, speed control, de-shake control 413, delete control and other functional options. Toolbar 411 may also include other more or fewer functional options, which are not limited in the present embodiment.

[0107] The user clicks the play control 409 of the interface 407, and the mobile phone can play the video in the video window 408 in response to the user clicking the play control 409. And the mobile phone can display the play screen of the video at the corresponding moment in the play video progress bar area 410.

[0108] In one embodiment, if Figure 5A As shown in (a), the user can click the de-shaking control 413 of the toolbar 411, and the mobile phone can display the following in response to the user clicking the de-shaking control 413: Figure 5A The anti-shake frame 4130 shown in (b) of FIG. 4130 includes a deshake strength bar. The leftmost end of the strength bar is deshake level 1, which has the lowest deshake strength; the leftmost end of the strength bar is deshake level 10, which has the highest deshake strength. Afterwards, the user can slide (or click) the strength bar to determine the deshake level. For example, Figure 5A As shown in (b), the user can slide the intensity bar to the de-shaking gear 3. In response to the user sliding the intensity bar to the de-shaking gear 3, the mobile phone de-shakes the video and can display the following Figure 5A The de-shaking progress 414 shown in (c) of FIG. 1 is, for example, 5%. When the de-shaking progress 414 changes from 0% to 100%, it means that the video de-shaking is completed. After the de-shaking process is completed, the mobile phone can display the following Figure 5AThe prompt box "Anti-shake processing completed" shown in (d) prompts the user that the video de-shaking is completed. At the same time, the video window 408 can display the de-shaking video corresponding to the de-shaking gear 3.

[0109] In another embodiment, if Figure 5B As shown in (a), the user can click the de-shaking control 413 of the toolbar 411. In response to the user clicking the de-shaking control 413, the mobile phone can first de-shake the video and display the video as shown in FIG. Figure 5B The de-shaking progress 414 and the anti-shake frame 4130 are shown in (b). After the de-shaking process is completed, the mobile phone can display the following Figure 5B The "Anti-shake processing completed" prompt box shown in (c) of FIG. 1 prompts the user that the video anti-shake processing is completed. After that, the user can slide (or click) the intensity bar to determine the anti-shake level. For example, Figure 5B As shown in (d), the user can slide the strength bar to the de-shaking gear 3. In response to the user sliding the strength bar to the de-shaking gear 3, the mobile phone can display the de-shaking video corresponding to the de-shaking gear 3 in the video window 408.

[0110] In another embodiment, the developer may pre-set the de-shaking level for the first de-shaking. For example, the user clicks the de-shaking control 413 of the toolbar 411. In response to the user clicking the de-shaking control 413, the mobile phone may first de-shake the video and display the video as follows: Figure 5B The de-shaking progress 414 and the anti-shake frame 4130 are shown in (b). After the de-shaking process is completed, the mobile phone can display the following Figure 5B The "Anti-shake Processing Completed" prompt box shown in (c) of FIG. 1 prompts the user that the video anti-shake processing is completed. The default anti-shake level is level 3. Figure 5B As shown in (d), the video window 408 can display the de-shaking video corresponding to the de-shaking gear 3.

[0111] Optionally, the user can click the play control 409 of the interface 407 again, and the mobile phone can play the de-shaking video in the waiting video window 408 in response to the user clicking the play control 409. And the mobile phone can display the play screen of the de-shaking video in the play video progress bar area 410.

[0112] Optionally, the "Anti-shake Processing Completed" prompt box may be displayed for 3 seconds and then disappear. The display time of the prompt box in the embodiment of the present application does not impose any specific restriction on this.

[0113] Optionally, the user can slide the intensity bar again to determine a new de-shaking level. Figure 6 As shown in (a) of FIG. 1 , the user can slide the strength bar to the de-shaking gear 7. The mobile phone responds to the user's operation of sliding the strength bar to the de-shaking gear 7. Figure 6As shown in (b), the mobile phone can display the de-shaking video corresponding to the de-shaking gear 7 in the video window 408. In this way, the user can select multiple de-shaking gears to de-shake the video, covering a variety of de-shaking scenarios to meet the needs of various users.

[0114] Optionally, the mobile phone debounce process is as follows:

[0115] The mobile phone can decode the video uploaded by the user frame by frame to obtain the video frame queue and the corresponding interface parameter information. The mobile phone inputs the video frame queue and the corresponding interface parameter information (such as video information (video info), process information (proc info)) into the algorithm module, and uses the de-jitter algorithm in the algorithm module to process the video frame. The embodiment of the present application supports the expansion of interface parameter information and has high flexibility.

[0116] The interface parameter information may include video information parameters (videoinfo), processing information parameters (procinfo), etc. Among them, the video information parameters include the number of video frames, and the video information parameters are sent to the algorithm module so that the algorithm module can create a memory space of corresponding length to store the video information. The processing information parameters include the number of pyramid levels (int pryrlv), which indicates the number of image pyramids required for video frame feature matching; the feature point response threshold (int kpres), which indicates the feature point response threshold of the accelerated segmentation detection feature (features from accelerated segment test, FAST) method during feature point detection; the number of feature points (int kpnum), which indicates the maximum number of valid feature points during feature point detection. The maximum jitter pixel ratio (float shkmax) indicates the maximum jitter range that the mobile phone can handle.

[0117] Optionally, the algorithm module can be a set of software codes such as components / services with de-jitter functions. Among them, the component can be an independent individual divided by logic in the C / C++ language, and the files included in the component can be .h files, .so files, or .dll files, etc. A service refers to a module that can be deployed and run independently in a service-oriented scenario. The services coordinate and cooperate with each other to provide users with a logical business function. Each service runs in its own independent process, and services can cooperate with each other using a lightweight communication mechanism (usually a RESTful API based on the hypertext transfer protocol (HTTP) protocol). Exemplarily, the video frames and corresponding interface parameter information in the embodiments of the present application can be input into the .so file of the algorithm module.

[0118] Optionally, the mobile phone can pre-process each video frame in the video frame queue and convert the color RGB (red, green, blue) video frame into a grayscale video frame. After that, the mobile phone can package the current video frame and the next video frame into an image pair through a data packaging operation, and add multiple image pairs to the transit queue. The image pairs in the transit queue are distributed to multiple first asynchronous threads for processing to obtain the jitter path of the video.

[0119] Optionally, the number of image pairs is one less than the number of video frames.

[0120] For example, the mobile phone may package the first frame and the second frame into an image pair 1, the second frame and the third frame into an image pair 2, the third frame and the fourth frame into an image pair 3, and the fourth frame and the fifth frame into an image pair 4. The mobile phone may sequentially package the five decoded video frames into four image pairs and add the four image pairs to the transfer queue.

[0121] Optionally, multiple first asynchronous threads can process multiple image pairs simultaneously, thereby reducing latency and improving de-jittering efficiency.

[0122] Exemplarily, in the embodiment of the present application, four threads are used to process the image pairs in the transit queue. Among them, the first first asynchronous thread processes image pair 1, the second first asynchronous thread processes image pair 2, the third first asynchronous thread processes image pair 3, and the fourth first asynchronous thread processes image pair 4. After the first first asynchronous thread processes image pair 1, it continues to process image pair 5, after the second first asynchronous thread processes image pair 1, it continues to process image pair 6, after the third first asynchronous thread processes image pair 1, it continues to process image pair 7, and after the fourth first asynchronous thread processes image pair 1, it continues to process image pair 8. Similarly, multiple first asynchronous threads simultaneously process multiple image pairs in parallel to obtain the jitter path of the video.

[0123] Optionally, each first asynchronous thread may perform feature matching and motion estimation on the video frames in the image pair to determine a jitter path of the video.

[0124] Feature matching is based on the feature points in the video frame of the image pair. The mobile phone performs feature matching on the video frame in the image pair and can obtain the corresponding relationship between the feature points in the video frame in the image pair.

[0125] Among them, the methods used by the mobile phone to match the features of two video frames include but are not limited to the scale invariant feature transform (SIFT) method, the features from accelerated segment test (FAST) method, the oriented FAST and rotated BRIEF (ORB) method, the speeded up robust features (SURF) method, the super point method, etc. Among them, the full name of BRIEF is binary robust independent elementary features.

[0126] The embodiment of the present application takes the feature matching by FAST method as an example, in which the mobile phone can first perform feature detection on the two video frames in the image pair, determine multiple feature points, and then perform feature matching. The FAST method can quickly detect feature points, perform real-time feature matching on the video frames in the image pair, and reduce latency. For example, the mobile phone can determine the pixel points that are significantly different from enough pixel points in the surrounding neighborhood as feature points, and then perform feature matching on the feature points of the two video frames.

[0127] For example, Fig. 7A Shown are two video frames including a water cup. Fig. 7A (a) is the current video frame, Fig. 7A (b) is the previous video frame. The first asynchronous thread of the mobile phone can determine four feature points using the FAST method. Fig. 7A The feature points A1, B1, C1, D1, E1, F1 of the current video frame shown in (a) are as follows: Fig. 7A The feature points A2, B2, C2, D2, E2, and F2 of the previous video frame are shown in (b). Among them, feature point A1 matches feature point A2; feature point B1 matches feature point B2; feature point C1 matches feature point C2; feature point D1 matches feature point D2; feature point E1 matches feature point E2; and feature point F1 matches feature point F2.

[0128] Optionally, the mobile phone can determine six feature points of each frame in each image pair by FAST method.

[0129] It should be understood that the above-mentioned determination of the six feature points of the video frame in the image pair according to the FAST method and the feature matching of the six feature points of the video frame in the image pair is only an example, and multiple feature points of the video frame in the image pair can also be determined according to other methods, and feature matching of multiple feature points of the video frame in the image pair can be performed. The embodiments of the present application are not limited thereto.

[0130] Optionally, the mobile phone can use the Lucas–Kanade optical flow method to track multiple feature points, and based on the tracking results, estimate the paths of the four vertices of the video frame in the image pair to obtain the jitter paths of the four vertices of the video frame in the image pair. Among them, the optical flow method is a two-frame differential estimation algorithm, which can use the difference between the pixels in the previous frame and the current frame to calculate the motion information of the object corresponding to the pixel. Optionally, other methods can also be used to process the feature points to obtain the jitter paths of the four vertices of the video frame in the image pair, and the embodiments of the present application are not limited to this.

[0131] Specifically, the mobile phone can perform path estimation based on multiple feature points of the video frames in the image pair to obtain the global homography transformation matrix gloH between the video frames in the image pair. The global homography transformation matrix gloH is used to represent the corresponding transformation relationship between corresponding pixel points of two video frames in the image pair. For example, the transformation relationship between the six feature points of the current video frame and the six feature points of the previous video frame satisfies the global homography transformation matrix gloH. Optionally, the global homography transformation matrix gloH is a 3*3 matrix.

[0132] Afterwards, the mobile phone can calculate the jitter paths of the four vertices of the video frame respectively according to the global homography transformation matrix gloH, wherein the four vertices represent the upper left vertex, the upper right vertex, the lower left vertex, and the lower right vertex of the video frame.

[0133] Exemplarily, take the second frame of the video as an example. The first first asynchronous thread in the mobile phone can determine the coordinates of the upper left vertex of the second frame after transformation according to the coordinates of the upper left vertex of the first frame and the global homography transformation matrix gloH. Determine the coordinates of the upper right vertex of the second frame after transformation according to the coordinates of the upper right vertex of the first frame and the global homography transformation matrix gloH. Determine the coordinates of the lower left vertex of the second frame after transformation according to the coordinates of the lower left vertex of the first frame and the global homography transformation matrix gloH. Determine the coordinates of the lower right vertex of the second frame after transformation according to the coordinates of the lower right vertex of the first frame and the global homography transformation matrix gloH. Thus, the mobile phone can obtain the transformed coordinates of the four vertices of the second frame, that is, the jitter path of the four vertices of the second frame.

[0134] Similarly, while the first asynchronous thread performs feature matching and path estimation to determine the transformed coordinates of the four vertices of the second frame of the video, at least one other first asynchronous thread in the mobile phone can determine the transformed coordinates of the four vertices of at least one other video frame. In this way, the transformed coordinates of the four vertices of each video frame, that is, the jitter path of the four vertices of each video frame, can be obtained asynchronously and in parallel.

[0135] Afterwards, the mobile phone can determine the jitter path of the upper left corner vertex based on the jitter path of the upper left corner vertex in each frame of the video frame.

[0136] Similarly, the mobile phone can determine the jitter path of other vertices based on the coordinates of other vertices in each frame of the video frame. Figure 8 , assuming that the path marked as 0 is the jitter path corresponding to the upper left vertex. Among them, at time t1, the displacement of the transformed upper left vertex in the video frame compared to the upper left vertex in the previous frame is y1. At time t2, the displacement of the transformed upper left vertex in the video frame compared to the upper left vertex in the previous frame is y2.

[0137] After that, the mobile phone can obtain the shaking path of each of the four vertices of the entire video. The shaking path can represent the vertex, that is, the motion trajectory of the pixel point in the video frame. The shaking path of each of the four vertices of the entire video can be the shaking path of the video.

[0138] In some embodiments, the above is a process of determining the shaking path by four vertices, and the mobile phone can also use other numbers of pixels to determine the shaking path, and the number of pixels can be greater than or equal to 4. In other words, the mobile phone can use at least four pixels (or expressed as reference pixels) to determine the shaking path.

[0139] Afterwards, the mobile phone can smooth the jitter paths of the four vertices of the video frame to obtain smooth paths of the four vertices after smoothing.

[0140] Optionally, the mobile phone can use the MAPS algorithm to perform path smoothing on the jitter path of the video to obtain a smoothed path.

[0141] For example, Figure 7B (a) shows the image of the first frame of the video, which includes a water cup. Figure 7B (b) is the image of the second frame of the video, which also includes a water cup. Due to the shaking during video shooting, the position of the water cup in the second frame is different from that in the first frame. Figure 7BAs shown in (c), the mobile phone can perform translation and other transformations on the second frame image according to the results obtained by the MAPS algorithm to align the water cups in the two video frames. However, after the alignment, there will be uneven parts between the edges of the two video frames, which are the black edges of the video frames. The mobile phone needs to crop the black edges to obtain the cropped video frame, and then enlarge it to a suitable size to display it in the mobile phone interface.

[0142] Specifically, Figure 7B The coordinates of the upper left vertex of the first frame a shown in (a) are (a1, b1), the coordinates of the upper right vertex are (a2, b2), the coordinates of the lower left vertex are (a3, b3), and the coordinates of the lower right vertex are (a4, b4). Figure 7B The coordinates of the upper left vertex of the jittered second frame b shown in (b) are (a1', b1'), the coordinates of the upper right vertex are (a2', b2'), the coordinates of the lower left vertex are (a3', b3'), and the coordinates of the lower right vertex are (a4', b4').

[0143] The coordinates of the four vertices of the second frame after smoothing are determined by the MAPS algorithm. For example, Figure 7B As shown in (c), the coordinates of the upper left vertex of the second frame c after smoothing are (c1, d1), the coordinates of the upper right vertex are (a2', b2'), the coordinates of the lower left vertex are (a3, b3), and the coordinates of the lower right vertex are (c4, d4).

[0144] For the first frame a, the portion d other than the second frame c after smoothing is the black border region. For the first frame b, the portion e other than the second frame c after smoothing is the black border region.

[0145] Similarly, the coordinates of the upper left vertex of the third frame (m1, n1), the coordinates of the upper right vertex of the third frame (m2, n2), the coordinates of the lower left vertex (m3, n3), and the coordinates of the lower right vertex (m4, n4) (not shown in the figure) are determined by the MAPS algorithm. The coordinates of the four vertices of the third frame after smoothing are determined, and the black edge area of ​​the third frame after smoothing is determined.

[0146] Optionally, the black border area of ​​the video frame is an unaligned area between at least two video frames, and the embodiment of the present application does not impose any specific limitation on this.

[0147] The MAPS algorithm can introduce a zero-order penalty term (zero-order velocity model modeling) to determine the sliding window M_spd corresponding to the "small amplitude" jitter in the jitter path, and introduce a first-order penalty term (first-order acceleration model modeling) to determine the sliding window M_acc corresponding to the "high frequency" jitter in the jitter path.

[0148] Among them, the jitter of "small amplitude" is the jitter with small jitter amplitude in the jitter path. For example, the jitter of the global motion vector offset in the video frame is less than 5% of the short side of the image. Exemplarily, the video frame is 100 pixels long from left to right, and the jitter distance of the video frame from left to right is less than 5 pixels. The jitter of "high frequency" is the jitter with high jitter frequency in the jitter path. For example, the jitter of the global vector direction changes more than 3 times within 1s. Exemplarily, within 1s, the video frame jitters from left to right and from right to left more than 3 times. The sliding window M used to remove the "small amplitude" and "high frequency" jitter in the jitter path is determined according to the sliding window M_spd and the sliding window M_acc. Afterwards, the mobile phone can use a Gaussian filter with a sliding window of M to remove the "small amplitude" and "high frequency" jitter in the jitter path.

[0149] The input of the MAPS algorithm is a jitter path S with a path length of N. The path length is the number of frames of the input video. The output is an optimized smooth path S' with a path length of N.

[0150] Optionally, developers can pre-set smoothing parameters: maximum amplitude (maxamp), minimum amplitude (minamp), and preset sliding window (winsize).

[0151] The specific process of the MAPS algorithm is as follows:

[0152] Step 1. Build a zero-order velocity model

[0153] 1.1) Calculate speed weight

[0154] For the jitter path S input at each moment (each frame):

[0155] M_spd[t]=2*(1 / (1+np.exp(-S[t]*0.01))-0.5);

[0156] Wherein, M_spd[t] represents the speed weight of the jitter path at the tth moment, and S[t] represents the value of the jitter path S at each moment (each frame). The value of the jitter path S can be understood as the displacement amplitude of the pixel point of the video frame at the tth moment relative to the previous frame (also called the jitter amplitude), and np.exp() represents the power function of e (also called the exponential function).

[0157] Through this step, the speed weight value of the jitter path at each moment can be calculated.

[0158] 1.2) Mapping

[0159] M_spd[t]=np.cos(M_spd[t]*np.pi / 2)*(maxamp-minamp)+minamp;

[0160] Among them, np.cos represents the cosine function, np.pi represents pi, maxamp represents the maximum amplitude of the jitter path, and minamp represents the minimum amplitude of the jitter path.

[0161] Through this step, the speed weight M_spd[t] in the previous step 1.1 can be nonlinearly mapped to the corresponding Gaussian sliding window size.

[0162] 1.3) Smoothing

[0163] M_spd=gaussian_filter1d(M_spd,sigma=1)

[0164] Among them, M_spd represents the Gaussian filter sliding window size for removing "small amplitude" jitter in the jitter path, and sigma represents the standard deviation of the Gaussian kernel.

[0165] Through this step, the mobile phone can determine the Gaussian filter sliding window size M_spd for removing the "small amplitude" jitter in the jitter path according to the preset maximum amplitude and minimum amplitude. The larger the difference between the maximum amplitude and the minimum amplitude, the larger the M_spd, and the better the effect of removing the "small amplitude" jitter.

[0166] Step 2. First-order acceleration model building

[0167] 2.1) Number of zero crossings

[0168] grad=gradient(S)

[0169] zp_arr = grad / abs(grad)

[0170] zp_arr[t]=(zp_arr[t]–zp_arr[t-1]) / 2

[0171] Among them, grad represents the gradient of the jitter path S, zp_arr (zero-pass array) represents the array that stores the number of zero-passes, abs(grad) represents the absolute value of the grad, and zp_arr[t] represents the number of zero-passes at time t. The number of zero-passes represents the number of times the jitter path crosses the horizontal axis, that is, the number of times the gradient changes positively or negatively.

[0172] Through this step, the zero crossing number zp_arr of the jitter path S can be calculated.

[0173] 2.2) Zero-crossing rate

[0174] Get zp_pad through the padding function,

[0175] For each moment (each frame), the path length N is:

[0176] zp_val=sum(zp_pad[t:t+winsize])

[0177] if zp_val<2: zp_val=0

[0178] zp_ratio[t]=zp_val / winsize

[0179] Among them, zp_pad represents the number of zero crossings after padding, zp_val represents the sum of all zero crossings in the time period from t to t+winsize, zp_ratio[t] represents the zero crossing rate of the jitter path S, and winsize represents the preset threshold.

[0180] Through this step, the zero-crossing rate zp_ratio of the jitter path S can be calculated.

[0181] 2.3) Mapping

[0182] M_acc=np.sin(zp_ratio*np.pi / 2)*(maxamp-minamp)+minamp

[0183] Among them, np.sin represents the sine function, np.pi represents the pi, maxamp represents the maximum amplitude of the jitter path, and minamp represents the minimum amplitude of the jitter path.

[0184] Through this step, the zero-crossing rate zp_ratio in the above step 2.2 can be mapped to the Gaussian sliding window size.

[0185] 2.4) Smoothing

[0186] M_acc=gaussian_filter1d(M_acc,sigma=1)

[0187] Among them, M_acc represents the Gaussian filter sliding window size for removing "high frequency" jitter in the jitter path, and sigma represents the standard deviation of the Gaussian kernel.

[0188] Through this step, the mobile phone can determine the Gaussian filter sliding window size M_acc for removing the "high frequency" jitter in the jitter path according to the preset maximum amplitude, minimum amplitude, and sliding window size. The larger the difference between the maximum amplitude and the minimum amplitude, the minimum amplitude, and the preset sliding window, the larger M_acc is, and the better the effect of removing the "high frequency" jitter is.

[0189] Step 3. Build a mixed-order model

[0190] M=(M_spd+M_acc) / 2

[0191] Among them, M represents the Gaussian filter sliding window size for removing "small amplitude" and "high frequency" jitter in the jitter path, M_spd represents the Gaussian filter sliding window size for removing "small amplitude" jitter in the jitter path, and M_acc represents the Gaussian filter sliding window size for removing "high frequency" jitter in the jitter path.

[0192] Through this step, the mobile phone can determine that the Gaussian filter sliding window size M for removing "small amplitude" and "high frequency" jitters is based on M_spd and M_acc.

[0193] Step 4. Path smoothing

[0194] For each moment (each frame), the path length N is:

[0195] S'[t]=Gaussian_filter1d(S[t], winsize=M[t])

[0196] Wherein, S'[t] represents the smooth path S' at each moment (each frame).

[0197] Through this step, the mobile phone can perform Gaussian filtering according to the jitter path S and sliding window M input at each moment (each frame), and determine the smooth path S' at each moment (each frame). The smooth path S' at each moment (each frame) can correspond to the video frame after smoothing. In this way, the "small amplitude" and "high frequency" jitter in the jitter path can be removed to obtain a smooth path. And the MAPS algorithm is used to remove only the "small amplitude" and "high frequency" jitter in the jitter path, and the jitter with a larger amplitude or lower frequency in the jitter path is not removed. In this way, the video frame can be prevented from being de-jittered too much, resulting in too large black edges. Reduce the degree of cropping of the video frame to retain more video frame edge information.

[0198] For example, the developer can set the first set of smoothing parameters (the weakest parameter set): the zero-order velocity model parameters are minamp = 0.8, maxamp = 1.0, winsize = 31; the first-order acceleration model parameters are minamp = 0.8, maxamp = 1.0, winsize = 31. The first set of smoothing parameters can be expressed as (0.8, 1.0; 0.8, 1.0). The mobile phone can perform Gaussian filtering on the jitter path of the video according to the first set of smoothing parameters to obtain the smooth paths corresponding to the four vertices of the video.

[0199] Optionally, the mobile phone may determine a set of smooth paths of the video according to the smooth paths corresponding to the four vertices of the video.

[0200] When the parameters set by the MAPS algorithm are the first group of smoothing parameters, since the maximum amplitude and the minimum amplitude in the first group of smoothing parameters are small, the smoothing intensity of the jitter path is low, and the de-jittering effect of the obtained smoothed path is poor.

[0201] For example, the developer can also set a second set of smoothing parameters (the strongest parameter set): the zero-order velocity model parameters are minamp = 5.3, maxamp = 23.5, winsize = 31; the first-order acceleration model parameters are minamp = 5.3, maxamp = 23.5, winsize = 31. The second set of smoothing parameters can be expressed as (5.3, 23.5; 5.3, 23.5).

[0202] The mobile phone can perform path smoothing according to the second set of smoothing parameters to obtain a set of smoothed paths with higher stability. When the parameters set by the MAPS algorithm are the second set of smoothing parameters, since the maximum and minimum amplitudes in the second set of smoothing parameters are large, the smoothing intensity of the jitter path is high, and the smoothed path de-jittering effect is better.

[0203] The parameters of the zero-order velocity model and the parameters of the first-order acceleration model may be the same or different, and the embodiment of the present application does not limit this.

[0204] For example, Figure 8 As shown, it is a schematic diagram of the smoothing path obtained according to the smoothing parameters. The horizontal axis is time (or number of frames), and the vertical axis is the displacement of the pixel point. The vertical axis can be the displacement of the pixel point in the x direction (such as along the long side of the mobile phone), or the displacement of the pixel point in the y direction (such as along the short side of the mobile phone), or the amplitude of the vector representing the displacement of the pixel point in the x direction and the y direction, which is not limited in the embodiments of the present application. Figure 8 In the example, the jitter path is marked as 0; the smooth path obtained according to the first set of smoothing parameters (0.8, 1.0; 0.8, 1.0) is marked as 1; and the smooth path obtained according to the second set of smoothing parameters (5.3, 23.5; 5.3, 23.5) is marked as 10. Figure 8 The smooth path marked as 1 and the smooth path marked as 10 shown can be the average path of the smooth paths corresponding to the four vertices of the video. In another exemplary embodiment, the smooth path marked as 1 and the smooth path marked as 10 can be the smooth path of one vertex among the four vertices of the video. For example, the smooth path marked as 1 and the smooth path marked as 10 are the smooth paths of the upper left vertex of the video.

[0205] Among them, the winsize of the first set of smoothing parameters and the winsize of the second set of smoothing parameters are both 31, which means that the winsize of the smoothing parameters corresponding to the smoothing path marked as 1 and the smoothing path marked as 10 has not changed. Figure 8 The value of winsize is not shown.

[0206] Optionally, the mobile phone may use the infinite de-jitter method to perform interpolation processing on the smooth path marked as 1 and the smooth path marked as 10 to obtain multiple groups of smooth paths.

[0207] like Fig. 9 As shown, the jitter path is smoothed according to the weakest parameter group to obtain a smoothed path marked as 1. The jitter path is smoothed according to the strongest parameter group to obtain a smoothed path marked as 10. The smoothed path marked as 1 and the smoothed path marked as 10 are interpolated in an asynchronous parallel manner, that is, multiple threads simultaneously interpolate the smoothed path marked as 1 and the smoothed path marked as 10, so that n smoothed paths can be quickly obtained, where n is an integer greater than or equal to 3.

[0208] Optionally, the smooth path marked as 1 and the smooth path marked as 10 are interpolated to obtain a calculation formula for multiple smooth paths as shown in the following formula (1):

[0209] S2=S1*a+S10*b Formula (1)

[0210] Among them, S2 represents the smooth path obtained by interpolation, S1 represents the smooth path marked as 1, S10 represents the smooth path marked as 10, a and b are positive numbers less than 1, and a+b=1.

[0211] For example, Fig.10 As shown, it is a schematic diagram of 8 smooth paths obtained by interpolating the smooth path marked as 1 and the smooth path marked as 10. The horizontal axis is time (or frame number), and the vertical axis is the displacement of the pixel point. The vertical axis can be the displacement of the pixel point in the x direction or the displacement of the pixel point in the y direction, which is not limited in the embodiment of the present application.

[0212] Among them, the jitter path is marked as 0; the smooth path marked as 1 is the smooth path obtained according to the first set of smoothing parameters, the smooth path marked as 10 is the smooth path obtained according to the second set of smoothing parameters, and the smooth paths marked as 2-9 are 8 smooth paths obtained by interpolating the smooth path marked as 1 and the smooth path marked as 10. The de-jitter strength of the smooth path marked as 1 to the smooth path marked as 10 increases in sequence.

[0213] Optionally, each smoothing path may correspond to a de-shaking gear. Exemplarily, the smoothing path marked as 1 corresponds to de-shaking gear 1; the smoothing path marked as 2 corresponds to de-shaking gear 2... the smoothing path marked as 10 corresponds to de-shaking gear 10.

[0214] Optionally, the mobile phone can determine the smoothing parameters of the smoothed path according to the smoothed path obtained by interpolation. Exemplarily, the mobile phone interpolates the smoothed path marked 1 and the smoothed path marked 10 to obtain the smoothed path marked 2. According to the smoothed path marked 2, the smoothing parameters of the smoothed path marked 2 can be determined to be (1.3, 3.5; 1.3, 3.5). Correspondingly, according to the smoothed path marked 3, the smoothing parameters of the smoothed path marked 3 can be determined to be (1.8, 6.0; 1.8, 6.0). According to the smoothed path marked 4, the smoothing parameters of the smoothed path marked 4 can be determined to be (2.3, 8.5; 2.3, 8.5). According to the smoothed path marked 5, the smoothing parameters of the smoothed path marked 5 can be determined to be (2.8, 11.0; 2.8, 11.0). According to the smoothed path marked 6, the smoothing parameters of the smoothed path marked 6 can be determined to be (3.3, 13.5; 3.3, 13.5). According to the smooth path marked as 7, the smoothing parameters of the smooth path marked as 7 can be determined to be (3.8, 16.0; 3.8, 16.0). According to the smooth path marked as 8, the smoothing parameters of the smooth path marked as 8 can be determined to be (4.3, 18.5; 4.3, 18.5). According to the smooth path marked as 9, the smoothing parameters of the smooth path marked as 9 can be determined to be (4.8, 21.0; 4.8, 21.0).

[0215] In one embodiment, the mobile phone may perform motion compensation and image transformation (also referred to as cropping or cutting, etc.) on the video frames in the video in sequence to obtain a reconstruction transformation matrix H for each video frame in the video. The reconstruction transformation matrix H may represent the corresponding transformation relationship between the video frame after the image transformation and the video frame before the de-shaking.

[0216] For each group of smooth paths, the mobile phone may use multiple second asynchronous threads to perform motion compensation and image transformation on the video frames corresponding to the smooth paths, and obtain a reconstructed transformation matrix H of each video frame corresponding to the smooth paths.

[0217] The embodiment of the present application uses an image pair as an input unit and a video frame in the image pair as a processed unit, performs motion compensation and image transformation on the video frames in the image pair, and obtains a reconstructed transformation matrix H corresponding to the video frame in each image pair.

[0218] Optionally, the mobile phone may perform motion compensation and image transformation on the video frames in the image pair corresponding to the smooth path in parallel through four second asynchronous threads to obtain a reconstructed transformation matrix H of the video frames in each image pair. The mobile phone may also perform motion compensation and image transformation on the video frames in the image pair corresponding to the smooth path in parallel through three second asynchronous threads or more or fewer second asynchronous threads to obtain a reconstructed transformation matrix H of the video frames in each image pair, which is not limited in the embodiments of the present application.

[0219] Exemplarily, the first second asynchronous thread processes image pair 1, the second second asynchronous thread processes image pair 2, the third second asynchronous thread processes image pair 3, and the fourth second asynchronous thread processes image pair 4. Multiple second asynchronous threads process multiple image pairs simultaneously to obtain multiple reconstruction transformation matrices H of the multiple image pairs.

[0220] Among them, image pair 1 includes the first frame and the second frame of the video; image pair 2 includes the second frame and the third frame of the video; image pair 3 includes the third frame and the fourth frame of the video; image pair 4 includes the fourth frame and the fifth frame of the video.

[0221] Exemplarily, the elements of the reconstruction transformation matrix H of the first frame default to 1, the reconstruction transformation matrix H of image pair 1 can be the reconstruction transformation matrix H of the second frame after image transformation relative to the jittered second frame; the reconstruction transformation matrix H of image pair 2 can be the reconstruction transformation matrix H of the third frame after image transformation relative to the jittered third frame; the reconstruction transformation matrix H of image pair 3 can be the reconstruction transformation matrix H of the fourth frame after image transformation relative to the jittered fourth frame; the reconstruction transformation matrix H of image pair 4 can be the reconstruction transformation matrix H of the fifth frame after image transformation relative to the jittered fifth frame.

[0222] Or, illustratively, the reconstruction transformation matrix H of the image pair 1 may be the reconstruction transformation matrix H of the first frame after the image transformation relative to the jittered first frame; the reconstruction transformation matrix H of the image pair 2 may be the reconstruction transformation matrix H of the second frame after the image transformation relative to the jittered second frame; the reconstruction transformation matrix H of the image pair 3 may be the reconstruction transformation matrix H of the third frame after the image transformation relative to the jittered third frame; the reconstruction transformation matrix H of the image pair 4 may be the reconstruction transformation matrix H of the fourth frame after the image transformation relative to the jittered fourth frame. The reconstruction transformation matrix H of the fifth frame defaults to 1. The embodiments of the present application are not limited to this.

[0223] Optionally, the mobile phone may perform motion compensation on the video frame corresponding to the smooth path to obtain a motion residual, and then calculate a homography transformation matrix group between the jitter path and the smooth path based on the motion residual estimation.

[0224] Specifically, for each moment (each frame), the homography transformation matrix Homo between each frame of the shaking video and the video frame corresponding to the smoothed video is calculated according to the coordinates of the four vertices of each video frame corresponding to the shaking path and the coordinates of the four vertices of each video frame corresponding to the smoothing path. Optionally, the homography transformation matrix Homo is a 3*3 matrix.

[0225] Exemplarily, the first second asynchronous thread in the mobile phone can calculate the homography transformation matrix Homo1 between the second frame of the jittered video and the second frame of the smoothed video according to the coordinates of the four vertices of the second frame of the jittered video and the coordinates of the four vertices of the second frame of the smoothed video. Figure 7B , assuming that Figure 7B The coordinates of the upper left vertex of the second frame b shown in (b) are (a1, b1), the coordinates of the upper right vertex are (a2, b2), the coordinates of the lower left vertex are (a3, b3), and the coordinates of the lower right vertex are (a4, b4). After smoothing, the water cup in the second frame b is aligned with the water cup in the first frame. The coordinates of the upper left vertex of the smoothed second frame c are (c1, d1), the coordinates of the upper right vertex are (a2', b2'), the coordinates of the lower left vertex are (a3, b3), and the coordinates of the lower right vertex are (c4, d4). The first second asynchronous thread in the mobile phone can calculate the homography transformation matrix Homo1 between the jittered second frame b and the smoothed second frame c based on the coordinates of the four vertices of the second frame of the jittered video and the coordinates of the four vertices of the second frame of the smoothed video.

[0226] Similarly, while the first second asynchronous thread performs motion compensation and determines the homography transformation matrix Homo1 between the second frame of the jittered video and the second frame corresponding to the smoothed video, at least one other second asynchronous thread in the mobile phone can determine the homography transformation matrix Homo between at least one other jittered video frame and the corresponding smoothed video frame. In this way, the homography transformation matrix Homo between each jittered video frame and the corresponding smoothed video frame can be obtained asynchronously and in parallel.

[0227] Among them, multiple homography transformation matrices Homo corresponding to multiple shaking video frames and de-shaking video frames can form a homography transformation matrix group. The homography transformation matrix group can represent the corresponding transformation relationship between the shaking video and the smoothed video.

[0228] After the mobile phone uses the MAPS algorithm to smooth multiple video frames, black edges will be generated at the edges between the multiple video frames. The black edges are the parts that are not aligned between the multiple video frames after the video frames are smoothed.

[0229] The mobile phone can perform image transformation on each video frame in the motion compensated image pair, and remove the black edges of each smoothed video frame. Specifically, after the mobile phone obtains the homography transformation matrix Homo of the video frame through motion compensation, it can analyze the homography transformation matrix Homo of the video frame, determine the cropping coordinates of the smoothed video frame through an adaptive cropping algorithm, and perform cropping transformation on the smoothed video frame, and enlarge the video frame with the black edges cropped off to the same size as the jittered video frame to obtain the video frame after image transformation. The mobile phone can obtain the translation matrix Ht and scaling matrix Hs of the smoothed video frame relative to the image transformed video frame. Exemplarily, the translation matrix Ht and the scaling matrix Hs are both 3*3 matrices.

[0230] For example, Figure 7B As shown in (c), the smoothed video frame is cropped to obtain video frame c, as shown in Figure 7B As shown in (d), the video frame with the black edges cropped off is enlarged to the same size as the jittered video frame to obtain the video frame c' after image transformation.

[0231] The greater the de-shaking strength of the MAPS algorithm, the higher the degree of alignment between the smoothed video frames, the larger the black edges generated, the larger the part of the black edges that the mobile phone cuts out, and the smaller the pixels of the de-shaking video frames obtained in the end, and the lower the resolution. For example, the pixel size of the smoothed video frame is 100*100, and the video frame size is 10cm long and 10cm wide. The pixel size of the de-shaking video frame obtained after cutting out the black edges is 80*80, and the video frame size is 10cm long and 10cm wide.

[0232] For example, Fig.11 As shown, the video frame pixels of the jittered video are the largest. When the de-shaking gear is gear 1, corresponding to smoothing path 1, the de-shaking strength of the MAPS algorithm is relatively small, and the corresponding de-shaking video frame pixels obtained by cropping are relatively large. When the de-shaking gear is gear 5, corresponding to smoothing path 5, the de-shaking strength of the MAPS algorithm is relatively large, and the corresponding de-shaking video frame pixels obtained by cropping are relatively small. When the de-shaking gear is gear 10, corresponding to smoothing path 10, the de-shaking strength of the MAPS algorithm is the largest, and the corresponding de-shaking video frame pixels obtained by cropping are relatively small.

[0233] The mobile phone can calculate the reconstruction transformation matrix H of each video frame in each image pair in the smooth path according to the translation matrix Ht, scaling matrix Hs and homography transformation matrix Homo of the video frame in each image pair in the smooth path. Among them, the reconstruction transformation matrix H = Hs*Ht*Homo. Multiple reconstruction transformation matrices H can be obtained for multiple jittered video frames.

[0234] The reconstructed transformation matrix H can represent the corresponding transformation relationship between the video frame after image transformation and the jittered video frame. The reconstructed transformation matrix H can also represent the corresponding transformation relationship between the video frame after de-jittering and the jittered video frame. Afterwards, the mobile phone can process the decoded video frame again through the reconstructed transformation matrix H to obtain the de-jittered video frame.

[0235] Optionally, the mobile phone may sort multiple reconstruction transformation matrices H to obtain a reconstruction transformation matrix group.

[0236] Exemplarily, the second frame in image pair 1 corresponds to the reconstructed transformation matrix H1; the third frame in image pair 2 corresponds to the reconstructed transformation matrix H2; the fourth frame in image pair 3 corresponds to the reconstructed transformation matrix H3; and the fifth frame in image pair 4 corresponds to the reconstructed transformation matrix H4.

[0237] In some cases, the order of the reconstructed transformation matrix H obtained by the mobile phone through parallel processing of multiple second asynchronous threads may be reconstructed transformation matrix H1, reconstructed transformation matrix H4, reconstructed transformation matrix H3, and reconstructed transformation matrix H2. What is obtained is an unordered reconstructed transformation matrix H.

[0238] Optionally, the mobile phone may dynamically sort multiple reconstruction transformation matrices H by a stream sorting algorithm to obtain an ordered reconstruction transformation matrix H.

[0239] Exemplarily, the order of the sorted reconstructed transformation matrix H is: reconstructed transformation matrix H1, reconstructed transformation matrix H2, reconstructed transformation matrix H3, and reconstructed transformation matrix H4.

[0240] In each image pair corresponding to the smooth path marked as 1, one video frame corresponds to a reconstruction transformation matrix H, and multiple reconstruction transformation matrices H constitute a reconstruction transformation matrix group of a smooth path.

[0241] Exemplarily, the smoothed video includes five video frames, that is, four image pairs. The video includes four reconstruction transformation matrices H. For example, including reconstruction transformation matrix H1, reconstruction transformation matrix H2, reconstruction transformation matrix H3, reconstruction transformation matrix H4, reconstruction transformation matrix H1, reconstruction transformation matrix H2, reconstruction transformation matrix H3, reconstruction transformation matrix H4 can form a reconstruction transformation matrix group, and the reconstruction transformation matrix group corresponds to the smooth path marked as 1.

[0242] Optionally, the phone can Fig.10 The 10 smooth paths (smooth paths 1-10) shown are subjected to motion compensation and image transformation in sequence to obtain reconstruction transformation matrix group 1-reconstruction transformation matrix group 10 corresponding to the 10 smooth paths.

[0243] The mobile phone can store the 10 reconstruction transformation matrix groups in a text format in a local disk. Optionally, reconstruction transformation matrix group 1 to reconstruction transformation matrix group 10 can correspond to de-jittering gears 1-10.

[0244] Optionally, the mobile phone can render and reconstruct the jittered video frame according to the reconstruction transformation matrix group to obtain a de-jittered video frame. Then the mobile phone can encode the de-jittered video frame to obtain a de-jittered video. Figure 4 In the video window 408 shown in (d).

[0245] like Fig.12 As shown, the user clicks Figure 4 After the de-shaking control 413 shown in (d) is turned on, the user can slide the de-shaking intensity bar to select the de-shaking gear. In response to the user's operation, the mobile phone can use the MAPS algorithm to de-shake the video to obtain a de-shaking video.

[0246] For example, Figure 5A As shown in (b), the user slides the intensity bar to de-shaking gear 3 for the first time to de-shake the video. In response to the user sliding the intensity bar to de-shaking gear 3, the mobile phone processes the 10 smooth paths corresponding to the 10 gears, obtains the reconstruction transformation matrix group 1-10 corresponding to each smooth path, and stores them in text format on the local disk. Afterwards, the mobile phone can decode the jittery video again to obtain multiple video frames, and perform affine transformation on the jittery video frame according to the reconstruction transformation matrix group 3 stored in the local disk to obtain the rendered and reconstructed de-shaking video frame. The mobile phone encodes the de-shaking video frame to obtain a de-shaking video. As shown in FIG. Figure 5A In the video window 408 shown in (d).

[0247] Or, if Figure 5A As shown in (b), the user slides the intensity bar to de-shaking gear 3 for the first time to de-shake the video. In response to the user sliding the intensity bar to de-shaking gear 3, the mobile phone first processes the smooth path corresponding to gear 3 to obtain the reconstruction transformation matrix group 3 corresponding to the smooth path. Afterwards, the mobile phone can decode the jittered video again to obtain multiple video frames, and reconstruct the transformation matrix group 3 to perform affine transformation on the jittered video frame to obtain the rendered and reconstructed de-shaking video frame. The mobile phone encodes the de-shaking video frame to obtain the de-shaking video. As shown in FIG. Figure 5A The video window 408 shown in (d) is shown in FIG. 3. The reconstructed transformation matrix group 3 is stored in a text format on a local disk. Afterwards, the smooth paths corresponding to the remaining gears are processed to obtain a reconstructed transformation matrix group corresponding to each smooth path, which is stored in a text format on a local disk.

[0248] For example, Figure 5BAs shown in (a), the user clicks the de-shaking control 413 of the toolbar 411. In response to the user clicking the de-shaking control 413, the mobile phone can process the 10 smooth paths corresponding to the 10 gears, obtain the reconstructed transformation matrix group 1-10 corresponding to each smooth path, and store it in a text format on the local disk. At the same time, the mobile phone can display Figure 5B The "Anti-shake processing completed" prompt box shown in (c) prompts the user that the anti-shake processing is completed. Figure 5B As shown in (d), the user slides the intensity bar to the de-shaking gear 3. In response to the user sliding the intensity bar to the de-shaking gear 3, the mobile phone can perform an affine transformation on the jittered video frame according to the transformation matrix group 3 corresponding to gear 3 to obtain a de-shaking video frame after rendering and reconstruction. The mobile phone encodes the de-shaking video frame to obtain a de-shaking video. Figure 5B In the video window 408 shown in (d).

[0249] Optionally, when the user slides the intensity bar again and selects a new de-shaking gear, the mobile phone can determine the corresponding reconstruction transformation matrix group according to the new de-shaking gear, and render and reconstruct the de-shaking video frame according to the reconstruction transformation matrix group to obtain the de-shaking video.

[0250] Exemplarily, the user can slide the intensity bar to de-shaking gear 7 again. In response to the user sliding the intensity bar to de-shaking gear 7, the mobile phone determines the reconstruction transformation matrix group 7 corresponding to the de-shaking gear 7 from the local disk. The jittered video is decoded again to obtain multiple video frames. The video frames are affine transformed in turn according to the reconstruction transformation matrix H in the reconstruction transformation matrix group to obtain de-shaking video frames after rendering and reconstruction. The mobile phone encodes the de-shaking video frame to obtain a de-shaking video. The video can be displayed on a screen such as Figure 6 In the video window 408 shown in (b).

[0251] In some embodiments, the mobile phone can complete the de-jittering method described in this application offline, such as the mobile phone does not need to use other devices (such as servers) to implement the de-jittering method. Fig.13 The application module and algorithm module implementation are shown.

[0252] Exemplarily, the process of implementing the de-jittering method by the algorithm module of the above application module may include:

[0253] First, the application module can obtain the shaking video and decode the shaking video into shaking video frames. Then the application module can also pre-process the shaking video frames and convert the color shaking video frames into grayscale shaking video frames. Then, two consecutive shaking video frames are packaged into an image pair. The application module can also send the image pair to the algorithm module.

[0254] Then, the algorithm module can receive the image pair from the application module, and use the mixed-order adaptive path smoothing optimization algorithm to de-jitter the video frames in the image pair under the streaming asynchronous de-jitter framework to obtain a smooth path. After that, the algorithm module can use the infinite de-jitter method to perform differential processing on the two smooth paths to obtain multiple smooth paths. The multiple smooth paths can correspond to multiple de-jitter gears with different de-jitter strengths. The algorithm module can also perform motion compensation and image transformation on the multiple smooth paths to determine the reconstruction transformation matrix groups of the multiple smooth paths. Each reconstruction transformation matrix group corresponds to a de-jitter gear, and the reconstruction transformation matrix group includes the reconstruction transformation matrix corresponding to each video frame. The algorithm module can also send multiple reconstruction transformation matrix groups to the application module.

[0255] Finally, the application module can receive multiple reconstruction transformation matrix groups from the algorithm module and store them in the local disk. The application module can also render and reconstruct the video frames in sequence according to the reconstruction transformation matrix in the reconstruction transformation matrix group corresponding to the de-shaking gear selected by the user to obtain a de-shaking video.

[0256] The method of the embodiment of the present application is introduced as follows. Fig.14 As shown, the process of mobile phone video de-shaking is shown in steps S101-S106:

[0257] S101. The mobile phone obtains part of video frame packets in a video through each first asynchronous thread of a plurality of first asynchronous threads, and processes part of the video frame packets to obtain jitter paths of reference pixel points between video frames in the video frame packets.

[0258] like Figure 2 As shown, the mobile phone decodes the video to obtain a video frame queue. After that, the mobile phone can pre-process each video frame in the video frame queue and convert the color RGB (red, green, blue) video frame into a grayscale video frame. After that, the mobile phone can package the current video frame and the next video frame into an image pair (video frame packet) through a data packaging operation, and add multiple image pairs to the transfer queue.

[0259] Optionally, the mobile phone may distribute the multiple image pairs in the transfer queue to multiple first asynchronous multi-threads for processing to obtain the jitter path of the video, wherein different first asynchronous threads process different video frame packets.

[0260] Optionally, the mobile phone may perform feature matching and motion estimation on the video frames in the image pair through a plurality of first asynchronous threads to determine a jitter path of the reference pixel between the video frames in the video frame package.

[0261] Specifically, Fig. 7AAs shown, the mobile phone can perform feature detection on the two video frames in the image pair, determine multiple feature points, and then perform feature matching on the corresponding feature points in the two video frames using the FAST method. Afterwards, the mobile phone can use the Lucas–Kanade optical flow method to track the multiple feature points, and based on the tracking results, perform path estimation on the four vertices (reference pixel points) of the video frame in the image pair to obtain the jitter path of the four vertices in the video frame in the image pair.

[0262] Optionally, the number of reference pixels is greater than or equal to four.

[0263] S102: The mobile phone determines a jitter path of the video according to the jitter path of reference pixels in a portion of the video frames obtained by processing each first asynchronous thread.

[0264] Optionally, the mobile phone can determine the jitter path of the upper left vertex according to the jitter path of the upper left vertex of each video frame in the video frame. Exemplarily, the mobile phone can perform curve fitting on the coordinates of the upper left vertex of each video frame to obtain the jitter path of the upper left vertex of the video. Similarly, the mobile phone can perform curve fitting on the coordinates of the other three vertices of each video frame to obtain the jitter paths of the other three vertices of the video.

[0265] Optionally, the shaking path of each of the four vertices of the video is also the shaking path of the video.

[0266] S103: The mobile phone performs smoothing processing on the jitters in the jitter path whose jitter amplitude is less than the first threshold and whose jitter frequency is greater than the second threshold, to determine a first smoothing path.

[0267] Optionally, the mobile phone can use the MAPS algorithm to perform path smoothing on the jitter path of the video to obtain a smoothed path. The smoothed path S' at each moment (each frame) can correspond to the video frame after smoothing.

[0268] The developer can determine the smoothing parameters, where the smoothing parameters include at least a maximum amplitude, a minimum amplitude, and a preset sliding window.

[0269] The mobile phone can use the MAPS algorithm to smooth the jitter in the jitter path whose jitter amplitude is less than the first threshold and whose jitter frequency is greater than the second threshold according to the smoothing parameter, the jitter path and the number of video frames, and determine the first smoothing path.

[0270] Optionally, the first smooth path may include a smooth path labeled 1 obtained according to a first set of smoothing parameters (0.8, 1.0; 0.8, 1.0) and a smooth path labeled 10 obtained according to a second set of smoothing parameters (5.3, 23.5; 5.3, 23.5).

[0271] For details, please refer to the above-mentioned MAPS algorithm smoothing process, which will not be described here.

[0272] S104. The mobile phone determines at least one second smooth path according to the at least two first smooth paths in combination with an interpolation algorithm.

[0273] Optional, such as Fig. 9 As shown, the smooth path marked as 1 and the smooth path marked as 10 are interpolated in an asynchronous parallel manner, that is, multiple threads simultaneously interpolate the smooth path marked as 1 and the smooth path marked as 10, and n smooth paths can be quickly obtained, where n is an integer greater than or equal to 3.

[0274] For example, Fig.10 As shown, the smooth paths marked 2-9 (second smooth paths) are eight second smooth paths obtained by interpolating the smooth path marked 1 and the smooth path marked 10.

[0275] S105. The mobile phone determines, through the second asynchronous thread, a reconstruction transformation matrix group corresponding to the candidate smooth path.

[0276] The candidate smooth paths include at least two first smooth paths and at least one second smooth path. Fig.10 Shown are smooth paths labeled 1-10.

[0277] Optionally, motion compensation is performed on the video frame in the corresponding image pair for each candidate smoothing.

[0278] Specifically, for each moment (each frame), the homography transformation matrix Homo between each video frame of the shaking video and the video frame corresponding to the smoothed video is calculated according to the coordinates of the four vertices of each video frame corresponding to the shaking path and the coordinates of the four vertices of the video frame corresponding to the smoothing path. Figure 7B The video frame b shown in (c) is Figure 7B (b) The homography transformation matrix Homo between them.

[0279] Afterwards, the mobile phone can perform image transformation on the video frames in the smoothed image pair according to the homography transformation matrix Homo. The mobile phone analyzes the homography transformation matrix Homo of each video frame, determines the cropping coordinates of the smoothed video frame through the adaptive cropping algorithm, performs cropping transformation on the smoothed video frame, and enlarges the video frame with the black edges cropped off to the same size as the jittered video frame to obtain the video frame after image transformation.

[0280] For example, Figure 7B The video frame c' shown in (d) is the video frame after image transformation.

[0281] Optionally, the reconstruction transformation matrix group includes a reconstruction transformation matrix corresponding to at least one video frame packet. Each video frame packet corresponds to a reconstruction transformation matrix. The reconstruction transformation matrix represents the correspondence between the video frame and the corresponding pixel points in the video frame after the image transformation.

[0282] Optionally, the mobile phone may store the reconstruction transformation matrix group in a local disk in a text format.

[0283] S106. The mobile phone de-jitters the video by reconstructing the transformation matrix group to determine the de-jittered video.

[0284] Optionally, the mobile phone can decode the video to obtain multiple video frames, and render and reconstruct the multiple video frames using the corresponding reconstruction transformation matrix in the reconstruction transformation matrix group to obtain de-jittered video frames. Then, the mobile phone can encode the de-jittered video frames to obtain de-jittered videos. Figure 4 In the video window 408 shown in (d).

[0285] It should be noted that some operations in the processes of the above-mentioned method embodiments are optionally combined, and / or the order of some operations is optionally changed. In addition, the execution order between the steps of each process is only exemplary and does not constitute a limitation on the execution order between the steps. There may be other execution orders between the steps. It is not intended to indicate that the execution order is the only order in which these operations can be performed. A person of ordinary skill in the art will think of a variety of ways to reorder the operations described herein. In addition, it should be noted that the process details involved in a certain embodiment of this invention are also applicable to other embodiments in a similar manner, or different embodiments can be used in combination.

[0286] In addition, some steps in the method embodiment may be equivalently replaced by other possible steps. Alternatively, some steps in the method embodiment may be optional and may be deleted in certain usage scenarios. Alternatively, other possible steps may be added to the method embodiment.

[0287] Furthermore, the above method embodiments may be implemented separately or in combination.

[0288] Some other embodiments of the present application provide a device, which may be the above-mentioned second electronic device or the first electronic device or a component in the first electronic device or a component in the second electronic device (such as a chip system).

[0289] The device may include: a display screen, a memory, and one or more processors. The display screen, the memory, and the processor are coupled. The memory is used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device may execute the various functions or steps executed by the mobile phone in the above method embodiment.

[0290] Among them, the core structure of the electronic device can be expressed as Fig.15 As shown in the structure, the electronic device includes: a processing module 151, an input module 152, a storage module 153, a display module 154 and a communication module 155.

[0291] The processing module 151 may include at least one of a central processing unit (CPU), an application processor (AP) or a communication processor (CP). The processing module 151 may perform operations or data processing related to the control and / or communication of at least one of other components of the user electronic device. Optionally, the processing module 151 is used to support the first electronic device 100 and / or the second electronic device 200 to perform Fig.14 S101-S105 in;

[0292] The input module 152 is used to obtain the instructions or data input by the user and transmit the obtained instructions or data to other modules of the electronic device. Specifically, the input method of the input module 152 may include touch, gesture, approaching the screen, etc., or voice input. For example, the input module can be the screen of the electronic device, obtain the user's input operation and generate an input signal according to the obtained input operation, and transmit the input signal to the processing module 151. Optionally, the input module 152 is used to obtain the jitter video input by the user, which can be referred to Figure 4 The diagram shows the jitter video input interface.

[0293] The storage module 153 may include a volatile memory and / or a non-volatile memory. The storage module is used to store at least one instruction or data related to other modules of the user terminal device. Optionally, the storage module 153 is used for the first electronic device 100 and / or the second electronic device 200 to store the media interface state parameters of the first electronic device and the attribute information of the first electronic device.

[0294] The display module 154 may include, for example, a liquid crystal display (LCD), a light emitting diode (LED) display, an organic light emitting diode (OLED) display, a micro-electromechanical system (MEMS) display, or an electronic paper display. It is used to display content (e.g., text, images, videos, icons, symbols, etc.) that can be viewed by the user. Optionally, the display module 154 is used to display content such as Figure 4 , Figure 5A , Figure 5B , Figure 6 The content shown.

[0295] The communication module 155 is used to support the personal terminal to communicate with other personal terminals (through the communication network). For example, the communication module can be connected to the network via wireless communication or wired communication to communicate with other personal terminals or network servers. Wireless communication can adopt at least one of cellular communication protocols, such as Long Term Evolution (LTE), Advanced Long Term Evolution (LTE-A), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Universal Mobile Telecommunications System (UMTS), Wireless Broadband (WiBro) or Global System for Mobile Communications (GSM). Wireless communication may include, for example, short-range communication. Short-range communication may include at least one of wireless fidelity (Wi-Fi), Bluetooth, near field communication (NFC), magnetic stripe transmission (MST) or GNSS. For example, a mobile phone can receive jittery videos from other electronic devices.

[0296] Fig.15 The device shown may also include more or fewer components, or split some components, or have other ways of arranging components, which is not limited in the embodiments of the present application.

[0297] The present application also provides a chip system, such as Fig.16 As shown, the chip system includes at least one processor 161 and at least one interface circuit 162. The processor 161 and the interface circuit 162 can be interconnected via lines. For example, the interface circuit 162 can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit 162 can be used to send signals to other devices (such as the processor 161). Exemplarily, the interface circuit 162 can read instructions stored in the memory and send the instructions to the processor 161. When the instructions are executed by the processor 161, the electronic device can execute the various steps in the above embodiments. Of course, the chip system may also include other discrete devices, which are not specifically limited in the embodiments of the present application.

[0298] An embodiment of the present application also provides a computer storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device, the electronic device executes each function or step executed by the mobile phone in the above-mentioned method embodiment.

[0299] The embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute each function or step executed by the mobile phone in the above method embodiment.

[0300] Through the description of the above implementation methods, technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. The specific working process of the system, device and module described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0301] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0302] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0303] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0304] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0305] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims

1. A video anti-shake display method, characterized in that: include: Obtaining, through each of the plurality of first asynchronous threads, a portion of video frame packets in the video, and processing the portion of the video frame packets to obtain a jitter path of a reference pixel between video frames in the video frame packets; the video frame packets processed by different first asynchronous threads are different; and the video frame packets include at least two adjacent video frames; Determine a jitter path of the video according to the jitter paths of the reference pixels in the partial video frames obtained by processing each of the first asynchronous threads; Smoothing the jitters in the jitter path whose jitter amplitude is less than the first threshold and whose jitter frequency is greater than the second threshold, to determine a first smoothing path; Determine at least one second smooth path according to the at least two first smooth paths in combination with an interpolation algorithm; Determine, by a second asynchronous thread, a reconstruction transformation matrix group corresponding to a candidate smooth path; the candidate smooth path includes the at least two first smooth paths and the at least one second smooth path; the reconstruction transformation matrix group includes a reconstruction transformation matrix corresponding to at least one video frame packet; the reconstruction transformation matrix is ​​obtained by performing image transformation on a video frame in the video frame packet; the reconstruction transformation matrix represents a correspondence between the video frame and corresponding pixel points in the video frame after image transformation; The video is de-jittered by using the reconstructed transformation matrix group to determine the de-jittered video.

2. The method according to claim 1, characterized in that The method of obtaining a portion of video frame packets in a video through each of the plurality of first asynchronous threads, and processing the portion of video frame packets to obtain a jitter path of reference pixel points between video frames in the video frame packets includes: Each of the first asynchronous threads determines the position of the reference pixel point on each video frame in the at least one video frame packet based on at least one of the video frame packets, and the jitter path is obtained by performing curve fitting on the position of the reference pixel point determined by each of the first asynchronous threads.

3. The method according to claim 1 or 2, characterized in that: Smoothing the jitter in the jitter path whose jitter amplitude is less than the first threshold and whose jitter frequency is greater than the second threshold to determine a first smoothing path includes: Determine smoothing parameters, wherein the smoothing parameters at least include a maximum amplitude, a minimum amplitude, and a preset sliding window; According to the smoothing parameter, the jitter path and the number of the video frames, jitters in the jitter path whose jitter amplitude is less than a first threshold and whose jitter frequency is greater than a second threshold are smoothed to determine the first smoothing path.

4. The method according to claim 3, characterized in that The method further comprises: Determine a first sliding window according to the maximum amplitude and the minimum amplitude, wherein the first sliding window is used to remove jitters in the jitter path whose jitter amplitude is less than a first threshold; Determine a second sliding window according to the maximum amplitude, the minimum amplitude and the preset sliding window, wherein the second sliding window is used to remove jitters in the jitter path whose jitter frequency is greater than a second threshold; determining a third sliding window according to the first sliding window and the second sliding window, wherein the third sliding window is used to remove jitters in the jitter path whose jitter amplitude is less than a first threshold and whose jitter frequency is greater than a second threshold; The jitter path is smoothed according to the third sliding window and the jitter path in combination with Gaussian filtering to determine the first smoothed path.

5. The method according to claim 1, characterized in that Determining at least one second smooth path based on the at least two first smooth paths in combination with an interpolation algorithm includes: determining at least one second smooth path based on the at least two first smooth paths in combination with a linear interpolation algorithm.

6. The method according to any one of claims 1 to 5, characterized in that: Determining a reconstruction transformation matrix group corresponding to the candidate smooth path through multiple second asynchronous threads includes: For one of the candidate smooth paths, determining a reconstruction transformation matrix of each video frame corresponding to the one of the candidate smooth paths through a plurality of second asynchronous threads; A flow sorting algorithm is used to sort the reconstructed transformation matrix of each video frame to determine a reconstructed transformation matrix group corresponding to the candidate smooth path.

7. The method according to any one of claims 1 to 6, characterized in that: The method also includes storing the reconstruction transformation matrix group.

8. The method according to any one of claims 1 to 7, characterized in that: Also includes: Displaying a first interface, wherein the first interface includes an anti-shake control; receiving a first operation of the anti-shake control by a user, where the first operation is used to input a first anti-shake level; De-shaking the video by reconstructing the transformation matrix group, including: In response to receiving the first operation, the video is de-shaked according to the reconstruction transformation matrix group corresponding to the first anti-shake level; the reconstruction transformation matrix group corresponding to the first anti-shake level represents the reconstruction transformation matrix group corresponding to the candidate smooth path corresponding to the first anti-shake level; wherein the anti-shake level corresponds one-to-one to the candidate smooth path.

9. An electronic device, characterized in that: include: A processor and a memory, wherein the memory is coupled to the processor, the memory is used to store computer program code, the computer program code includes computer instructions, and when the processor reads the computer instructions from the memory, the electronic device executes the method as described in any one of claims 1-8.

10. A computer-readable storage medium, wherein instructions are stored in the computer-readable storage medium, characterized in that: When the instructions are executed on an electronic device, the electronic device is caused to execute the method as claimed in any one of claims 1 to 8.

Citation Information

Patent Citations

  • An efficient video stabilization method based on geometric interpolation

    CN105282400A

  • Video image stabilization method, terminal equipment and computer readable storage medium

    CN114079725A

  • Video recording method, electronic equipment and storage medium

    CN114390191A

  • Video processing method and mobile terminal

    WO2021218694A1

  • Video Anti-shake processing method and apparatus, electronic device, and storage medium

    WO2022214037A1