Video processing method and device, electronic equipment and readable storage medium

By calculating the rotation matrix and replacing the fuzzy frame area, the problem of sudden fuzzy frames in clear frames in videos shot at night is solved, and the video is stable and the generation of clear frames is achieved, and the viewing experience is improved.

CN118890554AActive Publication Date: 2024-11-01VIVO MOBILE COMM CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410908115.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-08
Publication Date
2024-11-01
Estimated Expiration
2044-07-08

AI Technical Summary

Technical Problem

When shooting videos at night, due to the long exposure time, a series of blurry frames are prone to appear suddenly in a series of clear frames, which affects the viewing experience of the video. The existing technology such as increasing the optical anti-shake angle or reducing the intensity of electronic anti-shake cannot completely solve this problem. question.

Method used

By obtaining the shooting data of three consecutive frames of images, including Hall data and gyroscope data, the rotation matrix is ​​calculated to determine the offset between frame images, speculate the contents of clear frames, and use it to replace the blurry frames in the video area, generate target image.

Benefits of technology

Effectively eliminate blurred frames in the video, improve the viewing experience of the video, and ensure the clarity of the image in each frame.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118890554A_ABST
    Figure CN118890554A_ABST
Patent Text Reader

Abstract

The invention discloses a video processing method and device, electronic equipment and a readable storage medium, and belongs to the technical field of image processing. Under the condition that the first frame image and the third frame image are clear frames and the second frame image is a fuzzy frame, acquiring first shooting data corresponding to the first frame image, second shooting data corresponding to the second frame image and third shooting data corresponding to the third frame image; determining a first rotation matrix and a second rotation matrix based on the first shooting data, the second shooting data and the third shooting data; determining a first mapping image based on the first frame image and the first rotation matrix, and determining a second mapping image based on the third frame image and the second rotation matrix; and replacing the blurred image area in the second frame image based on the first mapping image and the second mapping image to obtain a target image.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of image processing technology, and specifically relates to a video processing method, device, electronic device and readable storage medium. Background Art

[0002] When shooting videos at night, a longer exposure time is selected to obtain sufficient light input, which will result in blurry frames in the video. In particular, if a blurry frame suddenly appears in a series of clear frames, it will greatly affect the viewing experience of the video.

[0003] In the related technical solutions, the stabilization angle of optical image stabilization can be increased to improve blurry frames, but the stabilization angle of optical image stabilization is limited and cannot guarantee that every frame is a clear frame. It is also possible to reduce the stabilization intensity of electronic image stabilization so that the captured video has tremors, reducing the impact of blurry frames on the viewing experience, but this method will sacrifice the stability of the entire video and reduce the viewing experience of the video. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a video processing method, device, electronic device and readable storage medium, which can solve the problem of a blurred frame suddenly appearing in a series of clear frames.

[0005] In a first aspect, an embodiment of the present application provides a video processing method, comprising: when a first frame image and a third frame image are clear frames and a second frame image is a blurred frame, obtaining first shooting data corresponding to the first frame image, second shooting data corresponding to the second frame image, and third shooting data corresponding to the third frame image, wherein the first frame image, the second frame image, and the third frame image are three consecutive frames of images in the video, and the first shooting data, the second shooting data, and the third shooting data all include Hall data and gyroscope data; determining a first rotation matrix and a second rotation matrix based on the first shooting data, the second shooting data, and the third shooting data; wherein the first rotation matrix is ​​used to represent the offset between the first frame image and the second frame image, and the second rotation matrix is ​​used to represent the offset between the third frame image and the second frame image; determining a first mapping image based on the first frame image and the first rotation matrix, and determining a second mapping image based on the third frame image and the second rotation matrix; replacing the blurred image area in the second frame image based on the first mapping image and the second mapping image to obtain a target image.

[0006] In a second aspect, an embodiment of the present application provides a video processing device, comprising: an acquisition module, for acquiring first shooting data corresponding to the first frame image, second shooting data corresponding to the second frame image, and third shooting data corresponding to the third frame image when the first frame image and the third frame image are clear frames and the second frame image is a blurred frame, wherein the first frame image, the second frame image and the third frame image are three consecutive frames of images in the video, and the first shooting data, the second shooting data and the third shooting data all include Hall data and gyroscope data; a first determination module, for determining a first rotation matrix and a second rotation matrix based on the first shooting data, the second shooting data and the third shooting data; wherein the first rotation matrix is ​​used to represent the offset between the first frame image and the second frame image, and the second rotation matrix is ​​used to represent the offset between the third frame image and the second frame image; a second determination module, for determining a first mapping image based on the first frame image and the first rotation matrix, and determining a second mapping image based on the third frame image and the second rotation matrix; a processing module, for replacing the blurred image area in the second frame image based on the first mapping image and the second mapping image to obtain a target image.

[0007] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor and a memory, wherein the memory stores programs or instructions that can be executed on the processor, and when the programs or instructions are executed by the processor, the steps of the method of the first aspect are implemented.

[0008] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method of the first aspect are implemented.

[0009] In a fifth aspect, an embodiment of the present application provides a chip, the chip including a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the method of the first aspect.

[0010] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the method of the first aspect.

[0011] In an embodiment of the present application, a video processing method is proposed. In the video processing method, if it is detected that the first frame image and the third frame image are clear frames and the second frame image is a blurred frame in three consecutive frames of images, the first shooting data corresponding to the first frame image, the second shooting data corresponding to the second frame image, and the third shooting data corresponding to the third frame image are obtained, and the first rotation matrix and the second rotation matrix are determined by using the first shooting data, the second shooting data, and the third shooting data, wherein the first rotation matrix is ​​used to represent the offset between the first frame image and the second frame image. Therefore, the first rotation matrix can be used to infer the same content in the first frame image as the second frame image, that is, the first mapping image. Similarly, the second rotation matrix can be used to infer the same content in the third frame image as the second frame image, that is, the second mapping image. The first frame image and the third frame image are clear frames. Obviously, the first mapping image and the second mapping image are also clear. After using the first mapping image and the second mapping image to replace the blurred image area in the second frame image, the blurred frame in the video can be eliminated, thereby improving the viewing experience of the video. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] Figure 1 A schematic diagram of a process flow of a video processing method provided by an embodiment of the present application is shown;

[0013] Figure 2 A schematic diagram showing the N-1th frame image in an embodiment of the present application is shown;

[0014] Figure 3 A schematic diagram showing the Nth frame image in an embodiment of the present application is shown;

[0015] Figure 4 A schematic diagram showing the N+1th frame image in an embodiment of the present application is shown;

[0016] Figure 5 A schematic diagram showing a first mapping image in an embodiment of the present application is shown;

[0017] Figure 6 A schematic diagram showing a second mapping image in an embodiment of the present application is shown;

[0018] Figure 7 A schematic diagram showing an Nth frame image after replacement in an embodiment of the present application is shown;

[0019] Figure 8 A schematic diagram of a completed first mapping image in an embodiment of the present application is shown;

[0020] Fig. 9 A schematic diagram of a completed second mapping image in an embodiment of the present application is shown;

[0021] Fig.10A schematic diagram showing the N-1th frame image in an embodiment of the present application is shown;

[0022] Fig.11 A schematic diagram showing a first mapping image in an embodiment of the present application is shown;

[0023] Fig.12 A schematic diagram showing the Nth frame image in an embodiment of the present application is shown;

[0024] Fig.13 A schematic diagram of an image before migration in an embodiment of the present application is shown;

[0025] Fig.14 A schematic diagram of an image after migration in an embodiment of the present application is shown;

[0026] Fig.15 A schematic diagram showing the fine-tuning of the Nth frame image after replacement in an embodiment of the present application is shown;

[0027] Fig.16 A schematic diagram showing the relationship between the posture angle and the focal length in an embodiment of the present application is shown;

[0028] Fig.17 A schematic diagram showing a first detection area, exposure time, start exposure time and end exposure time in an embodiment of the present application is shown;

[0029] Fig.18 The overall flow diagram of the video processing method provided by the embodiment of the present application is shown;

[0030] Fig.19 A schematic diagram of a process flow of a video processing device provided by an embodiment of the present application is shown;

[0031] Fig. 20 is a schematic block diagram of an electronic device in an embodiment of the present application;

[0032] Fig.21 It is a schematic diagram of the hardware structure of the electronic device in the embodiment of the present application. DETAILED DESCRIPTION

[0033] The following will be combined with the drawings in the embodiments of the present application to clearly describe the embodiments in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of this application.

[0034] The terms "first", "second", etc. in the specification of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are usually a class, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0035] The video processing method, device, electronic device and readable storage medium provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.

[0036] In one embodiment, if Figure 1 As shown, a video processing method is proposed, comprising:

[0037] Step 102, when the first frame image and the third frame image are clear frames and the second frame image is a blurred frame, obtain first shooting data corresponding to the first frame image, second shooting data corresponding to the second frame image, and third shooting data corresponding to the third frame image, wherein the first frame image, the second frame image and the third frame image are three consecutive frames of images in the video, and the first shooting data, the second shooting data and the third shooting data all include Hall data and gyroscope data.

[0038] In some embodiments of the present application, the first frame image, the second frame image and the third frame image are three consecutive frame images in the captured video, which may be the first three frame images in the video, or any three consecutive frame images in the video.

[0039] Exemplarily, when a video includes the 1st frame image, the 2nd frame image, the 3rd frame image, the 4th frame image... the N-1th frame image, the Nth frame image and the N+1th frame image in sequence, the first frame image, the second frame image and the third frame image may be the 1st frame image, the 2nd frame image and the 3rd frame image, respectively, or may be the N-1th frame image, the Nth frame image and the N+1th frame image, respectively.

[0040] Step 104, determining a first rotation matrix and a second rotation matrix based on the first shooting data, the second shooting data and the third shooting data, wherein the first rotation matrix is ​​used to represent the offset between the first frame image and the second frame image, and the second rotation matrix is ​​used to represent the offset between the third frame image and the second frame image.

[0041] Step 106: determine a first mapped image based on the first frame image and the first rotation matrix, and determine a second mapped image based on the third frame image and the second rotation matrix.

[0042] Step 108: Replace the blurred image area in the second frame image based on the first mapped image and the second mapped image to obtain a target image.

[0043] In an embodiment of the present application, a video processing method is proposed. In the video processing method, if it is detected that the first frame image and the third frame image are clear frames and the second frame image is a blurred frame in three consecutive frames of images, the first shooting data corresponding to the first frame image, the second shooting data corresponding to the second frame image, and the third shooting data corresponding to the third frame image are obtained, and the first rotation matrix and the second rotation matrix are determined by using the first shooting data, the second shooting data and the third shooting data, wherein the first rotation matrix is ​​used to represent the offset between the first frame image and the second frame image. Therefore, the first rotation matrix can be used to infer the same content in the first frame image as the second frame image, that is, the first mapping image. Similarly, the second rotation matrix can be used to infer the same content in the third frame image as the second frame image, that is, the second mapping image. The first frame image and the third frame image are clear frames. Obviously, the first mapping image and the second mapping image are also clear. After using the first mapping image and the second mapping image to replace the blurred image area in the second frame image, the blurred frame in the video can be eliminated, thereby improving the viewing experience of the video.

[0044] In some embodiments of the present application, determining a first rotation matrix and a second rotation matrix based on first shooting data, second shooting data, and third shooting data specifically includes: determining a first position offset when shooting a first frame of image and a second position offset that has been compensated for the first frame of image by optical image stabilization based on the first shooting data, determining a third position offset when shooting a second frame of image and a fourth position offset that has been compensated for the second frame of image by optical image stabilization based on the second shooting data, and determining a fifth position offset when shooting a third frame of image and a sixth position offset that has been compensated for the third frame of image by optical image stabilization based on the third shooting data; obtaining a first product value of the second position offset and a conversion coefficient, a second product value of the fourth position offset and the conversion coefficient, and a third product value of the sixth position offset and the conversion coefficient; obtaining a first difference between the first position offset and the first product value, a second difference between the third position offset and the second product value, and a third difference between the fifth position offset and the third product value; determining a first rotation matrix based on the first difference and the second difference, and determining a second rotation matrix based on the second difference and the third difference; wherein the conversion coefficient is a proportional coefficient corresponding to the Hall data when the Hall data is converted into gyroscope data.

[0045] In this embodiment, the position offset when shooting each frame of image and the position offset of each frame of image compensated by optical image stabilization can be determined according to the shooting data. Specifically, the first position offset and the second position offset are the position offsets corresponding to the first frame of image, and the third position offset and the fourth position offset are the position offsets corresponding to the second frame of image. Therefore, after obtaining the first position offset, the second position offset, the third position offset, and the fourth position offset, the offset between the first frame of image and the second frame of image, that is, the first difference and the second difference, can be known based on the first position offset, the second position offset, the third position offset, and the fourth position offset, and then the first rotation matrix is ​​determined according to the first difference and the second difference.

[0046] Similarly, the fifth position offset when shooting the third frame image and the sixth position offset that has been compensated for the third frame image by optical image stabilization can be obtained, and then the offset between the second frame image and the third frame image, that is, the second difference and the third difference, can be known according to the third position offset, the fourth position offset, the fifth position offset and the sixth position offset, and then the second rotation matrix can be determined according to the second difference and the third difference.

[0047] In this process, by determining the first rotation matrix and the second rotation matrix, the first frame image can be mapped to the second frame image, and the third frame image can be mapped to the second frame image, so as to obtain a clear second frame image by calculation.

[0048] In the above embodiment, the conversion coefficient is set to convert the position offset compensated by the optical image stabilization into the position offset when the image is captured. In this process, the source of data can be unified to ensure the accuracy of the first rotation matrix and the second rotation matrix.

[0049] In some embodiments of the present application, the first shooting data includes: multiple groups of first gyroscope data, multiple first timestamps corresponding to the multiple groups of first gyroscope data, multiple groups of first Hall data, multiple second timestamps corresponding to the multiple groups of first Hall data, each group of first gyroscope data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in the spatial rectangular coordinate system, and each group of first Hall data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in the spatial rectangular coordinate system; the second shooting data includes: multiple groups of second gyroscope data, multiple third timestamps corresponding to the multiple groups of second gyroscope data, multiple groups of second Hall data, multiple fourth timestamps corresponding to the multiple groups of second Hall data, Each group of second gyroscope data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in the spatial rectangular coordinate system, and each group of second Hall data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in the spatial rectangular coordinate system; the third shooting data includes: multiple groups of third gyroscope data, multiple fifth timestamps corresponding to the multiple groups of third gyroscope data, multiple groups of third Hall data, multiple sixth timestamps corresponding to the multiple groups of third Hall data, each group of third gyroscope data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in the spatial rectangular coordinate system, and each group of third Hall data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in the spatial rectangular coordinate system.

[0050] Determine a first position offset when shooting a first frame of image based on the first shooting data and a second position offset that has been compensated for the first frame of image by optical image stabilization, determine a third position offset when shooting a second frame of image based on the second shooting data and a fourth position offset that has been compensated for the second frame of image by optical image stabilization, and determine a fifth position offset when shooting a third frame of image based on the third shooting data and a sixth position offset that has been compensated for the third frame of image by optical image stabilization, specifically including: determining the first position offset based on multiple groups of first gyroscope data and multiple first timestamps; determining the second position offset based on multiple groups of first Hall data and multiple second timestamps; determining the third position offset based on multiple groups of second gyroscope data and multiple third timestamps; determining the fourth position offset based on multiple groups of second Hall data and multiple fourth timestamps; determining the fifth position offset based on multiple groups of third gyroscope data and multiple fifth timestamps; and determining the sixth position offset based on multiple groups of third Hall data and multiple sixth timestamps.

[0051] In this embodiment, during the shooting process, it takes a period of time to shoot each frame of image, and the shooting data will change during this period of time.

[0052] In an embodiment of the present application, multiple groups of first gyroscope data, multiple first timestamps corresponding one-to-one to the multiple groups of first gyroscope data, multiple groups of first Hall data, and multiple second timestamps corresponding one-to-one to the multiple groups of first Hall data are obtained, so as to determine the first position offset and the second position offset based on the multiple groups of data obtained. In this process, the accuracy of the first position offset and the second position offset can be improved.

[0053] Specifically, let the N-1th frame image obtain n N-1 Group 1 gyroscope data and n N-1 The first Hall data is a set of data, wherein the first gyroscope data is also Gyro data, which is expressed as The first Hall data, also known as Hall data, is expressed as in, Represents the Gyro data of the i-th group of x, y, and z axes. Indicates the timestamp of the i-th group of Gyro data, Represents the Hall data of the i-th group of x, y, and z axes. Indicates the timestamp of the i-th group of Hall data.

[0054] Then the first position offset s corresponding to the N-1th frame image is N-1 The expression formula is as follows:

[0055]

[0056] The second position offset h corresponding to the N-1th frame image N-1 The expression formula is as follows:

[0057]

[0058] Among them, the N-1th frame image, that is, the first frame image in this application, It is the timestamp of the i+1th group of Gyro data, that is, the first timestamp. It is the timestamp of the i+1th group of Hall data, that is, the second timestamp.

[0059] Similarly, the second position offset s corresponding to the Nth frame image can be obtained: N and the third position offset h N , wherein the Nth frame image is also the second frame image in this application.

[0060] Based on this, the image offset between the two frames can be calculated as:

[0061] ΔX N,N-1 =s N -ch N -(s N x1-chN-1 )

[0062] Where Δx N,N-1 It represents the image offset between the Nth frame image and the N-1th frame image, and c is the conversion coefficient.

[0063] Specifically, when photographing an object at infinity, it is considered that the movement of the electronic device is only rotation, not translation, so the first rotation matrix R N-1,N The relationship between the image offset between the Nth frame image and the N-1th frame image is as follows:

[0064] s N -ch N =R N-1,N (s N-1 -ch N-1 )

[0065] Among them, R N-1,N The expression is as follows:

[0066]

[0067] Among them, γ N-1,N , β N-1,N , α N-1,N is the first rotation matrix R N-1,N The three offsets in represents the components on the x-axis, y-axis and z-axis, cosα, sinα, c0sβ, sinβ, cosγγ and sinγ are the sin function values ​​and cos function values ​​of α, β and γ respectively, and α, β and γ are unknowns to be solved.

[0068] Specifically, s N -ch N is a 3×1 vector with three values, R N-1,N is a 3×3 matrix, s N-1 -ch N-1 is a 3×1 vector, so R N-1,N (s N-1 -ch N-1 ) is also a 3×1 vector.

[0069] s N -ch N =R N-1,N (s N-1 -ch N-1 )

[0070] In the above formula, both the left and right sides of the equal sign are 3×1 vectors, so the three equations can be solved to obtain the three unknowns α, β, and γ, and the first rotation matrix R is obtained N-1,N .

[0071] Similarly, the second rotation matrix R can be calculated N+1,N .

[0072] Let the N-1th frame image be I N-1 , the N+1th frame image is I N+1 , then the real image when the N-1th frame image is mapped to the Nth frame image is I N-1,N , which is the first mapping image in this application.

[0073] Then, I N-1,N =R N-1,N I N-1 .

[0074] Similarly, we can get the true image I when the N+1th frame image is mapped to the Nth frame image. N+1,N , which is the second mapping image in this application.

[0075] Then, I N+1,N =R N+1,N I N+1 .

[0076] Among them, the missing parts in the N+1th frame image and the N-1th frame image are filled with black edges.

[0077] Figure 2 A schematic diagram showing the N-1th frame image in an embodiment of the present application is shown. Figure 3 A schematic diagram showing the Nth frame image in an embodiment of the present application is shown, Figure 4 A schematic diagram showing the N+1th frame image in an embodiment of the present application is shown. Figure 5 A schematic diagram of a first mapping image in an embodiment of the present application is shown. Figure 6 A schematic diagram of a second mapping image proposed in an embodiment of the present application is shown. Figure 7 FIG. 4 is a schematic diagram showing an Nth frame image after replacement in an embodiment of the present application, wherein: Figure 5 The black edges of the first mapped image after the offset are filled, and the following is obtained: Figure 8 The image shown, Figure 8 FIG. 4 shows a schematic diagram of the completed first mapping image in an embodiment of the present application. Similarly, Figure 6 The black edges of the second mapped image after the shift are filled, and the following is obtained: Fig. 9 The image shown, Fig. 9 A schematic diagram of a completed second mapping image in an embodiment of the present application is shown.

[0078] like Figure 2 , Figure 3 , Figure 4 , Figure 5 , Figure 6 , Figure 7 , Figure 8 and Fig. 9 As shown, Figure 2 , Figure 3 , Figure 4 After applying the video processing method proposed in this application, the image shown in Figure 5 The first mapping image shown and Figure 6 The second mapping image shown, and Figure 7 The Nth frame image after replacement is shown in FIG. , and the first mapped image and the second mapped image are obtained after completion as shown in FIG. Figure 8 and Fig. 9 Image shown.

[0079] For example, Fig.10 A schematic diagram showing the N-1th frame image in an embodiment of the present application is shown. Fig.11 A schematic diagram of a first mapping image in an embodiment of the present application is shown. Fig.12 FIG. 4 shows a schematic diagram of the Nth frame image in an embodiment of the present application, such as Fig.10 , Fig.11 and Fig.12 As shown, it can be Fig.10 and Fig.12 Calculated Fig.11 .

[0080] In some embodiments of the present application, a target image is obtained by replacing a blurred image area in a second frame image based on a first mapping image and a second mapping image, specifically comprising: obtaining a first affine function between a partitioned first mapping image and a partitioned second frame image, and a second affine function between a partitioned second mapping image and a partitioned second frame image; determining a first linear optimization model based on the first affine function and a first constraint; determining a second linear optimization model based on the second affine function and the second constraint; solving the first linear optimization model to obtain a first offset, and solving the second linear optimization model to obtain a second offset; matching the first mapping image and the second frame image based on the first offset, and matching the second mapping image and the second frame image based on the second offset; replacing the blurred image area in the second frame image based on the matched first mapping image and the second mapping image to obtain the target image.

[0081] In some embodiments of the present application, it also includes: using a preset grid to grid the first mapping image, the second mapping image and the second frame image to obtain a partitioned first image, a partitioned second image and a partitioned second frame image.

[0082] In this embodiment, the first offset and the second offset are calculated so as to fine-tune the first mapped image and the second mapped image according to the first offset and the second offset, thereby eliminating the distortion caused by shooting in different orientations and reducing the distortion of the target image.

[0083] Specifically, when When , it means that the gradient of this point is completely consistent with the gradient of the Nth frame image, where I N (i, j) is the pixel point corresponding to the pixel coordinates (i, j) in the Nth frame image. is an affine function, is the product of the pixel point with pixel coordinates (i, j) in the first mapping image and the affine function, that is, when When it is the smallest, it indicates the first mapping image I N-1,N With the Nth frame image I N Already aligned to the maximum extent, Represents the affine function of the grid where the point with pixel coordinates (i, j) in the image is located. The specific expression is as follows:

[0084]

[0085] c 00 、c 01 、c 02 、c 10 、c 11 and c 12 is the affine parameter, i and j are the pixel coordinates. Each grid has its own affine parameter. At the same time, in order to ensure the continuity of the grid, the intersection of two grids needs to be equal, that is, there is a constraint, which is the first constraint condition in this application, specifically expressed as:

[0086]

[0087] in, and Indicates the values ​​at gridx and gridx+1. and Represents the values ​​at gridy and gridy+1, w and h are the values ​​of i and j, gridx represents the x-coordinate of the grid point after grid division, and gridy represents the y-coordinate of the grid point after grid division.

[0088] Then the first linear optimization model is expressed as follows:

[0089]

[0090] The first offset is obtained by solving the first linear optimization model. Similarly, the second linear optimization model is solved to obtain the second offset.

[0091] Specifically, the first linear optimization model is a linear programming model. Since the first mapping image and the second mapping image have been determined, the solution range can be set, and the enumeration method can be used to find the local optimal solution to obtain the first offset.

[0092] After solving the first linear optimization model, the consistent parts of the first mapping image and the second frame image can be obtained, so the corresponding image in the second frame image can be replaced based on the first mapping image. Similarly, the second mapping image can replace the corresponding image in the second frame image to obtain the replaced second frame image, so that the second frame image is transformed from a blurred frame to a clear frame.

[0093] For example, the input image size is 1920×1080, which is divided into 27×35 grids, so the length and width of a grid are approximately 54 and 40 respectively. Therefore, by enumerating the direct values ​​of the grid points x-25~x+25, y-20~y+20, the minimum value can be obtained to determine the grid fixed point position on the image after fine matching, and then the color of each pixel in each grid can be calculated according to the grid fixed point position to obtain the image after fine matching.

[0094] Fig.13 FIG. 1 shows a schematic diagram of an image before migration in an embodiment of the present application. Fig.14 A schematic diagram of an image after migration in an embodiment of the present application is shown.

[0095] The image changes within the grid can be controlled by grid points, such as Fig.13 and Fig.14 As shown, the distortion of the image is changed by offsetting, thereby completing the fine matching of the image.

[0096] Fig.15 FIG. 4 shows a schematic diagram of the Nth frame image after replacement in an embodiment of the present application, such as Fig.15 As shown, compared to Figure 3 As shown in the image, the clarity of the image is significantly improved.

[0097] In some embodiments of the present application, before obtaining first shooting data corresponding to the first frame image, second shooting data corresponding to the second frame image, and third shooting data corresponding to the third frame image, the video processing method also includes: obtaining a shooting focal length corresponding to the second frame image, and obtaining an angle corresponding to the second frame image, the angle corresponding to the second frame image being an attitude angle not compensated for optical image stabilization; obtaining the product value of the angle corresponding to the second frame image and the shooting focal length; and when the product value is greater than a comparison threshold, determining that the second frame image is a blurred frame.

[0098] In this embodiment, the shooting focal length corresponding to the second frame image and the angle corresponding to the second frame image are obtained so as to calculate the product value of the shooting focal length corresponding to the second frame image and the angle corresponding to the second frame image, wherein the product value can objectively characterize the blurriness of the second frame image, and by setting a comparison threshold, it is determined whether the second frame image is a blurred frame based on the comparison result between the product value and the comparison threshold.

[0099] During this process, the blurred frames in the video can be accurately identified and automatically replaced to improve the viewing experience of the video.

[0100] Specifically, Fig.16 A schematic diagram showing the relationship between the posture angle and the focal length in the embodiment of the present application is shown in FIG. Fig.16 As shown, the angle corresponding to the second frame image, that is, the posture angle is the angle of rotation of the lens during the exposure time. The focal length and the blur amount are geometrically two right-angled sides of a right triangle, and there is a corresponding relationship of trigonometric function tan (posture angle) = blur amount / focal length; because the posture angle at the millisecond level is very small, it can be approximated as posture angle = blur amount / focal length, then blur amount = posture angle × focal length, where the blur amount is also the product value in this embodiment.

[0101] In some embodiments of the present application, the comparison threshold value may be determined according to actual usage requirements.

[0102] Exemplarily, at a resolution of 1080p, when the product value is between 4 pixels and 10 pixels, it is considered to be severely blurred, and when the product value is greater than 10 pixels, it is considered to be severely blurred, where pixel is a pixel.

[0103] In some embodiments of the present application, obtaining the angle corresponding to the second frame image specifically includes: determining a first detection area in the second frame image, the first detection area having a corresponding starting exposure time and an ending exposure time; determining a first starting posture based on the starting exposure time, the exposure time, and the gyroscope data in the second shooting data; determining a first ending posture based on the ending exposure time, the exposure time, and the gyroscope data in the second shooting data; determining a second starting posture based on the starting exposure time, the exposure time, and the Hall data in the second shooting data; determining a second ending posture based on the ending exposure time, the exposure time, and the Hall data in the second shooting data; determining a first posture difference based on the first ending posture and the first starting posture; determining a second posture difference based on the second ending posture and the second starting posture; and determining the difference between the first posture difference and the second posture difference as the angle corresponding to the second frame image.

[0104] In this embodiment, a first detection area can be selected in the second frame image, wherein the first detection area corresponds to a starting exposure time and an ending exposure time. Based on the starting exposure time and the ending exposure time, the gyroscope data in the second shooting data and the Hall data in the second shooting data are calculated to obtain a first posture difference and a second posture difference, and the difference between the first posture difference and the second posture difference is used as the angle corresponding to the second frame image.

[0105] During this process, the corresponding angle of the second frame image can be automatically calculated based on the gyroscope data and Hall data, and the posture angle that is not compensated by the optical image stabilization can be accurately evaluated.

[0106] Specifically, the first starting posture is GyroPos t0 Indicates that the first ending posture is GyroPos t1 Indicates that GyroPos t0 The expression is as follows:

[0107]

[0108] GyroPos t1 The expression is as follows:

[0109]

[0110] Among them, ROI t1 It is the end of exposure time, ROI t0 is the initial exposure time, Te xp is the exposure time, and gyro(t) is the gyroscope data changing with time t.

[0111] Then the first posture difference GyroDiffROI is expressed as follows:

[0112] GyroDiffROI=GyroPos t1 -GyroPos t0

[0113] Using the same principle, the second posture difference can be calculated, and then the angle corresponding to the second frame image can be calculated.

[0114] In the above embodiment, the size of the first detection area is half of the size of the second frame image. Therefore, in the above embodiment, t0 Add T on the basis exp / 2, in ROI t1 Based on the reduction of T exp / 2.

[0115] Fig.17FIG. 1 is a schematic diagram showing the first detection area, exposure time, start exposure time and end exposure time in an embodiment of the present application. Fig.17 As shown, the first detection area can be cut out from the second frame image, so as to calculate the angle corresponding to the second frame image.

[0116] Fig.18 The overall flow chart of the video processing method provided by the embodiment of the present application is shown as follows: Fig.18 As shown, by running the video processing method proposed in this application, a replaced second frame image, namely, I~(N), can be obtained.

[0117] The video processing method provided in the embodiment of the present application can be executed by a video processing device. In the embodiment of the present application, the video processing device provided in the embodiment of the present application is described by taking the video processing method executed by the video processing device as an example.

[0118] In some embodiments of the present application, Fig.19 As shown, a video processing device 1900 is provided, including: an acquisition module 1902, which is used to acquire first shooting data corresponding to the first frame image, second shooting data corresponding to the second frame image, and third shooting data corresponding to the third frame image when the first frame image and the third frame image are clear frames and the second frame image is a blurred frame, wherein the first frame image, the second frame image and the third frame image are three consecutive frames of images in the video, and the first shooting data, the second shooting data and the third shooting data all include Hall data and gyroscope data; a first determination module 1904, which is used to determine a first rotation matrix and a second rotation matrix based on the first shooting data, the second shooting data and the third shooting data; wherein the first rotation matrix is ​​used to represent the offset between the first frame image and the second frame image, and the second rotation matrix is ​​used to represent the offset between the third frame image and the second frame image; a second determination module 1906, which is used to determine a first mapping image based on the first frame image and the first rotation matrix, and to determine a second mapping image based on the third frame image and the second rotation matrix; a processing module 1908, which is used to replace the blurred image area in the second frame image based on the first mapping image and the second mapping image to obtain a target image.

[0119] In the embodiment of the present application, if it is detected that the first and third frames of three consecutive images are clear frames and the second frame is a blurred frame, the first shooting data corresponding to the first frame, the second shooting data corresponding to the second frame, and the third shooting data corresponding to the third frame are obtained, and the first rotation matrix is ​​determined by using the first shooting data and the second shooting data, and the second rotation matrix is ​​determined by using the second shooting data and the third shooting data, wherein the first rotation matrix is ​​used to represent the offset between the first frame and the second frame. Therefore, the first rotation matrix can be used to infer the same content in the first frame as the second frame, that is, the first mapping image. Similarly, the second rotation matrix can be used to infer the same content in the third frame as the second frame, that is, the second mapping image. The first and third frames are clear frames, and obviously, the first mapping image and the second mapping image are also clear. After using the first mapping image and the second mapping image to replace the blurred image area in the second frame, the blurred frame in the video can be eliminated, thereby improving the viewing experience of the video.

[0120] In some embodiments of the present application, the first determination module 1904 is specifically used to: determine a first position offset when shooting a first frame of image and a second position offset that has been compensated for the first frame of image by the optical image stabilization based on the first shooting data, determine a third position offset when shooting a second frame of image and a fourth position offset that has been compensated for the second frame of image by the optical image stabilization based on the second shooting data, and determine a fifth position offset when shooting a third frame of image and a sixth position offset that has been compensated for the third frame of image by the optical image stabilization based on the third shooting data; obtain a first product value of the second position offset and a conversion coefficient, a second product value of the fourth position offset and the conversion coefficient, and a third product value of the sixth position offset and the conversion coefficient; obtain a first difference between the first position offset and the first product value, a second difference between the third position offset and the second product value, and a third difference between the fifth position offset and the third product value; determine a first rotation matrix based on the first difference and the second difference, and determine a second rotation matrix based on the second difference and the third difference; wherein the conversion coefficient is a proportional coefficient corresponding to the Hall data when the Hall data is converted into gyroscope data.

[0121] In some embodiments of the present application, the first shooting data includes: multiple groups of first gyroscope data, multiple first timestamps corresponding to the multiple groups of first gyroscope data, multiple groups of first Hall data, multiple second timestamps corresponding to the multiple groups of first Hall data, each group of first gyroscope data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in the spatial rectangular coordinate system, and each group of first Hall data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in the spatial rectangular coordinate system; the second shooting data includes: multiple groups of second gyroscope data, multiple third timestamps corresponding to the multiple groups of second gyroscope data, multiple groups of second Hall data, multiple fourth timestamps corresponding to the multiple groups of second Hall data, each group of second gyroscope data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in the spatial rectangular coordinate system, and each group of second Hall data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in the spatial rectangular coordinate system; the third shooting data includes: multiple a plurality of groups of third gyroscope data, a plurality of fifth timestamps corresponding one-to-one to the plurality of groups of third gyroscope data, a plurality of groups of third Hall data, a plurality of sixth timestamps corresponding one-to-one to the plurality of groups of third Hall data, each group of third gyroscope data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in a spatial rectangular coordinate system, and each group of third Hall data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in a spatial rectangular coordinate system; a first determination module 1904 is specifically used to: determine a first position offset based on a plurality of groups of first gyroscope data and a plurality of first timestamps; determine a second position offset based on a plurality of groups of first Hall data and a plurality of second timestamps; determine a third position offset based on a plurality of groups of second gyroscope data and a plurality of third timestamps; determine a fourth position offset based on a plurality of groups of second Hall data and a plurality of fourth timestamps; determine a fifth position offset based on a plurality of groups of third gyroscope data and a plurality of fifth timestamps; determine a sixth position offset based on a plurality of groups of third Hall data and a plurality of sixth timestamps.

[0122] In some embodiments of the present application, the processing module 1908 is specifically used to: obtain a first affine function between the first mapped image after partitioning and the second frame image after partitioning, and a second affine function between the second mapped image after partitioning and the second frame image after partitioning; determine a first linear optimization model based on the first affine function and the first constraint; determine a second linear optimization model based on the second affine function and the second constraint; solve the first linear optimization model to obtain a first offset, and solve the second linear optimization model to obtain a second offset; match the first mapped image and the second frame image based on the first offset, and match the second mapped image and the second frame image based on the second offset; replace the blurred image area in the second frame image based on the matched first mapped image and second mapped image to obtain a target image.

[0123] In some embodiments of the present application, before obtaining the first shooting data corresponding to the first frame image, the second shooting data corresponding to the second frame image, and the third shooting data corresponding to the third frame image, the acquisition module 1902 is further used to: obtain the shooting focal length corresponding to the second frame image, and obtain the angle corresponding to the second frame image, the angle corresponding to the second frame image is the posture angle not compensated by optical image stabilization; and obtain the product value of the angle corresponding to the second frame image and the shooting focal length; the processing module 1908 is further used to: when the product value is greater than a comparison threshold, determine that the second frame image is a blurred frame.

[0124] In some embodiments of the present application, the acquisition module 1902 is specifically used to: determine a first detection area in the second frame image, the first detection area having a corresponding starting exposure time and an ending exposure time; determine a first starting posture based on the starting exposure time, the exposure time and the gyroscope data in the second shooting data; determine a first ending posture based on the ending exposure time, the exposure time and the gyroscope data in the second shooting data; determine a second starting posture based on the starting exposure time, the exposure time and the Hall data in the second shooting data; determine a second ending posture based on the ending exposure time, the exposure time and the Hall data in the second shooting data; determine a first posture difference based on the first ending posture and the first starting posture; determine a second posture difference based on the second ending posture and the second starting posture; and determine the difference between the first posture difference and the second posture difference as the angle corresponding to the second frame image.

[0125] The video processing device in the embodiment of the present application can be an electronic device, or a component in the electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal, or other devices other than a terminal. Exemplarily, the electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted electronic device, a mobile Internet device (Mobile Internet Device, MID), an augmented reality (augmented reality, AR) / virtual reality (virtual reality, VR) device, a robot, a wearable device, an ultra-mobile personal computer (ultra-mobile personal computer, UMPC), a netbook or a personal digital assistant (personal digital assistant, PDA), etc., and can also be a server, a network attached storage (Network Attached Storage, NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.

[0126] The video processing device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.

[0127] The video processing device provided in the embodiment of the present application can achieve Figure 1 The various processes implemented by the video processing method embodiment can achieve the same technical effect. To avoid repetition, they will not be described here.

[0128] like Fig. 20 As shown, an embodiment of the present application further provides an electronic device 2000, including a processor 2002 and a memory 2004, wherein the memory 2004 stores programs or instructions that can be executed on the processor 2002, and when the program or instructions are executed by the processor 2002, the various steps of the above-mentioned video processing method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, they are not described here.

[0129] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.

[0130] Fig.21 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of the present application.

[0131] like Fig.21 As shown, the electronic device 2100 includes but is not limited to: a radio frequency unit 2101, a network module 2102, an audio output unit 2103, an input unit 2104, a sensor 2105, a display unit 2106, a user input unit 2107, an interface unit 2108, a memory 2109, and a processor 2110 and other components.

[0132] Those skilled in the art will appreciate that the electronic device 2100 may also include a power source (such as a battery) for supplying power to each component, and the power source may be logically connected to the processor 2110 through a power management system, thereby implementing functions such as managing charging, discharging, and power consumption management through the power management system. Fig.21 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be described in detail here.

[0133] In some embodiments of the present application, the processor 2110 is used to: when the first frame image and the third frame image are clear frames and the second frame image is a blurred frame, obtain first shooting data corresponding to the first frame image, second shooting data corresponding to the second frame image, and third shooting data corresponding to the third frame image, wherein the first frame image, the second frame image and the third frame image are three consecutive frames of images in the video, and the first shooting data, the second shooting data and the third shooting data all include Hall data and gyroscope data; determine a first rotation matrix and a second rotation matrix based on the first shooting data, the second shooting data and the third shooting data; wherein the first rotation matrix is ​​used to represent the offset between the first frame image and the second frame image, and the second rotation matrix is ​​used to represent the offset between the third frame image and the second frame image; determine a first mapping image based on the first frame image and the first rotation matrix, and determine a second mapping image based on the third frame image and the second rotation matrix; replace the blurred image area in the second frame image based on the first mapping image and the second mapping image to obtain a target image.

[0134] In some embodiments of the present application, the processor 2110 is specifically used to: determine a first position offset when shooting a first frame of image and a second position offset that has been compensated for the first frame of image by optical image stabilization based on the first shooting data, determine a third position offset when shooting a second frame of image and a fourth position offset that has been compensated for the second frame of image by optical image stabilization based on the second shooting data, and determine a fifth position offset when shooting a third frame of image and a sixth position offset that has been compensated for the third frame of image by optical image stabilization based on the third shooting data; obtain a first product value of the second position offset and a conversion coefficient, a second product value of the fourth position offset and the conversion coefficient, and a third product value of the sixth position offset and the conversion coefficient; obtain a first difference between the first position offset and the first product value, a second difference between the third position offset and the second product value, and a third difference between the fifth position offset and the third product value; determine a first rotation matrix based on the first difference and the second difference, and determine a second rotation matrix based on the second difference and the third difference; wherein the conversion coefficient is a proportional coefficient corresponding to the Hall data when the Hall data is converted into gyroscope data.

[0135] In some embodiments of the present application, the first shooting data includes: multiple groups of first gyroscope data, multiple first timestamps corresponding to the multiple groups of first gyroscope data, multiple groups of first Hall data, multiple second timestamps corresponding to the multiple groups of first Hall data, each group of first gyroscope data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in the spatial rectangular coordinate system, and each group of first Hall data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in the spatial rectangular coordinate system; the second shooting data includes: multiple groups of second gyroscope data, multiple third timestamps corresponding to the multiple groups of second gyroscope data, multiple groups of second Hall data, multiple fourth timestamps corresponding to the multiple groups of second Hall data, each group of second gyroscope data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in the spatial rectangular coordinate system, and each group of second Hall data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in the spatial rectangular coordinate system; the third shooting data includes : multiple groups of third gyroscope data, multiple fifth timestamps corresponding to the multiple groups of third gyroscope data one by one, multiple groups of third Hall data, multiple sixth timestamps corresponding to the multiple groups of third Hall data one by one, each group of third gyroscope data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in the spatial rectangular coordinate system, and each group of third Hall data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in the spatial rectangular coordinate system; the processor 2110 is specifically used to: determine the first position offset based on multiple groups of first gyroscope data and multiple first timestamps; determine the second position offset based on multiple groups of first Hall data and multiple second timestamps; determine the third position offset based on multiple groups of second gyroscope data and multiple third timestamps; determine the fourth position offset based on multiple groups of second Hall data and multiple fourth timestamps; determine the fifth position offset based on multiple groups of third gyroscope data and multiple fifth timestamps; determine the sixth position offset based on multiple groups of third Hall data and multiple sixth timestamps.

[0136] In some embodiments of the present application, the processor 2110 is specifically used to: obtain a first affine function between a partitioned first mapping image and a partitioned second frame image, and a second affine function between a partitioned second mapping image and a partitioned second frame image; determine a first linear optimization model based on the first affine function and a first constraint; determine a second linear optimization model based on the second affine function and the second constraint; solve the first linear optimization model to obtain a first offset, and solve the second linear optimization model to obtain a second offset; match the first mapping image and the second frame image based on the first offset, and match the second mapping image and the second frame image based on the second offset; replace the blurred image area in the second frame image based on the matched first mapping image and second mapping image to obtain a target image.

[0137] In some embodiments of the present application, before obtaining first shooting data corresponding to the first frame image, second shooting data corresponding to the second frame image, and third shooting data corresponding to the third frame image, the processor 2110 is also used to: obtain the shooting focal length corresponding to the second frame image, and obtain the angle corresponding to the second frame image, the angle corresponding to the second frame image is the posture angle not compensated by optical image stabilization; obtain the product value of the angle corresponding to the second frame image and the shooting focal length; when the product value is greater than a comparison threshold, determine that the second frame image is a blurred frame.

[0138] In some embodiments of the present application, the processor 2110 is specifically used to: determine a first detection area in the second frame image, the first detection area having a corresponding starting exposure time and an ending exposure time; determine a first starting posture based on the starting exposure time, the exposure time and the gyroscope data in the second shooting data; determine a first ending posture based on the ending exposure time, the exposure time and the gyroscope data in the second shooting data; determine a second starting posture based on the starting exposure time, the exposure time and the Hall data in the second shooting data; determine a second ending posture based on the ending exposure time, the exposure time and the Hall data in the second shooting data; determine a first posture difference based on the first ending posture and the first starting posture; determine a second posture difference based on the second ending posture and the second starting posture; and determine the difference between the first posture difference and the second posture difference as the angle corresponding to the second frame image.

[0139] In an embodiment of the present application, if it is detected that the first and third frames of three consecutive images are clear frames and the second frame is a blurred frame, the first shooting data corresponding to the first frame, the second shooting data corresponding to the second frame, and the third shooting data corresponding to the third frame are obtained, and the first rotation matrix and the second rotation matrix are determined using the first shooting data, the second shooting data, and the third shooting data, wherein the first rotation matrix is ​​used to represent the offset between the first frame and the second frame. Therefore, the first rotation matrix can be used to infer the same content in the first frame as the second frame, that is, the first mapping image. Similarly, the second rotation matrix can be used to infer the same content in the third frame as the second frame, that is, the second mapping image. The first and third frames are clear frames, and obviously, the first mapping image and the second mapping image are also clear. After using the first mapping image and the second mapping image to replace the blurred image area in the second frame, the blurred frame in the video can be eliminated, thereby improving the viewing experience of the video.

[0140] It should be understood that in the embodiment of the present application, the input unit 2104 may include a graphics processor (Graphics Processing Unit, GPU) 21041 and a microphone 21042, and the graphics processor 21041 processes the image data of the static picture or video obtained by the image capture device (such as a camera) in the video capture mode or the image capture mode. The display unit 2106 may include a display panel 21061, and the display panel 21061 may be configured in the form of a liquid crystal display, an organic light emitting diode, etc. The user input unit 2107 includes a touch panel 21071 and at least one of other input devices 21072. The touch panel 21071 is also called a touch screen. The touch panel 21071 may include two parts: a touch detection device and a touch controller. Other input devices 21072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.

[0141] The memory 2109 can be used to store software programs and various data. The memory 2109 may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory 2109 may include a volatile memory or a non-volatile memory, or the memory 2109 may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), a static random access memory (SRAM), a dynamic random access memory (DRAM), a synchronous dynamic random access memory (SDRAM), a double data rate synchronous dynamic random access memory (DDRSDRAM), an enhanced synchronous dynamic random access memory (ESDRAM), a synchronous link dynamic random access memory (SLDRAM) and a direct memory bus random access memory (DRRAM). The memory 2109 in the embodiment of the present application includes but is not limited to these and any other suitable types of memory.

[0142] The processor 2110 may include one or more processing units; optionally, the processor 2110 integrates an application processor and a modem processor, wherein the application processor mainly processes operations related to an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor 2110.

[0143] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned video processing method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0144] The processor is the processor in the electronic device in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0145] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned video processing method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0146] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0147] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned video processing method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0148] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "including one" do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0149] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the embodiments of the present application are essentially or partly contributed to the prior art can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a disk, an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of each embodiment of the present application.

[0150] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A video processing method, characterized in that: include: When the first frame image and the third frame image are clear frames and the second frame image is a blurred frame, first shooting data corresponding to the first frame image, second shooting data corresponding to the second frame image, and third shooting data corresponding to the third frame image are acquired, wherein the first frame image, the second frame image, and the third frame image are three consecutive frames of images in the video, and the first shooting data, the second shooting data, and the third shooting data all include Hall data and gyroscope data; Determine a first rotation matrix and a second rotation matrix based on the first shooting data, the second shooting data and the third shooting data; wherein the first rotation matrix is ​​used to represent the offset between the first frame image and the second frame image, and the second rotation matrix is ​​used to represent the offset between the third frame image and the second frame image; Determine a first mapped image based on the first frame image and the first rotation matrix, and determine a second mapped image based on the third frame image and the second rotation matrix; The blurred image area in the second frame image is replaced based on the first mapping image and the second mapping image to obtain a target image.

2. The video processing method according to claim 1, characterized in that: The determining of the first rotation matrix and the second rotation matrix based on the first shooting data, the second shooting data and the third shooting data specifically includes: Determine a first position offset when shooting the first frame of image and a second position offset that has been compensated for the first frame of image by optical image stabilization based on the first shooting data, determine a third position offset when shooting the second frame of image and a fourth position offset that has been compensated for the second frame of image by optical image stabilization based on the second shooting data, and determine a fifth position offset when shooting the third frame of image and a sixth position offset that has been compensated for the third frame of image by optical image stabilization based on the third shooting data; Acquire a first product value of the second position offset and a conversion coefficient, a second product value of the fourth position offset and the conversion coefficient, and a third product value of the sixth position offset and the conversion coefficient; Obtaining a first difference between the first position offset and the first product value, a second difference between the third position offset and the second product value, and a third difference between the fifth position offset and the third product value; determining a first rotation matrix based on the first difference and the second difference, and determining a second rotation matrix based on the second difference and the third difference; The conversion coefficient is a proportional coefficient corresponding to the Hall data when the Hall data is converted into the gyroscope data.

3. The video processing method according to claim 2, characterized in that: The first shooting data includes: multiple groups of first gyroscope data, multiple first timestamps corresponding to the multiple groups of the first gyroscope data, multiple groups of first Hall data, multiple second timestamps corresponding to the multiple groups of the first Hall data, each group of the first gyroscope data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in a spatial rectangular coordinate system, and each group of the first Hall data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in a spatial rectangular coordinate system; The second shooting data includes: multiple groups of second gyroscope data, multiple third timestamps corresponding to the multiple groups of second gyroscope data, multiple groups of second Hall data, multiple fourth timestamps corresponding to the multiple groups of second Hall data, each group of the second gyroscope data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in a spatial rectangular coordinate system, and each group of the second Hall data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in a spatial rectangular coordinate system; The third shooting data includes: multiple sets of third gyroscope data, multiple fifth time stamps corresponding to the multiple sets of third gyroscope data, multiple sets of third Hall data, multiple sixth time stamps corresponding to the multiple sets of third Hall data, each set of the third gyroscope data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in the spatial rectangular coordinate system, and each set of the third Hall data includes the rotation rate of the x-axis, the rotation rate of the y-axis, and the rotation rate of the z-axis in the spatial rectangular coordinate system; The method of determining a first position offset when shooting the first frame of image and a second position offset that has been compensated for the first frame of image by optical image stabilization based on the first shooting data, determining a third position offset when shooting the second frame of image and a fourth position offset that has been compensated for the second frame of image by optical image stabilization based on the second shooting data, and determining a fifth position offset when shooting the third frame of image and a sixth position offset that has been compensated for the third frame of image by optical image stabilization based on the third shooting data, comprises: determining the first position offset based on multiple sets of the first gyroscope data and multiple first timestamps; determining the second position offset based on a plurality of sets of the first Hall data and a plurality of the second timestamps; determining the third position offset based on a plurality of sets of the second gyroscope data and a plurality of the third timestamps; determining the fourth position offset based on a plurality of sets of the second Hall data and a plurality of the fourth time stamps; determining the fifth position offset based on the plurality of sets of the third gyroscope data and the plurality of the fifth time stamps; The sixth position offset is determined based on the plurality of sets of the third Hall data and the plurality of the sixth time stamps.

4. The video processing method according to any one of claims 1 to 3, characterized in that: The step of replacing the blurred image area in the second frame image based on the first mapping image and the second mapping image to obtain the target image specifically includes: Acquire a first affine function between the first mapped image after partitioning and the second frame image after partitioning, and a second affine function between the second mapped image after partitioning and the second frame image after partitioning; Determine a first linear optimization model based on the first affine function and the first constraint condition; Determine a second linear optimization model based on the second affine function and the second constraint condition; Solving the first linear optimization model to obtain a first offset, and solving the second linear optimization model to obtain a second offset; Matching the first mapped image with the second frame image based on the first offset, and matching the second mapped image with the second frame image based on the second offset; The blurred image area in the second frame image is replaced based on the matched first mapping image and the second mapping image to obtain a target image.

5. The video processing method according to any one of claims 1 to 3, characterized in that: Before acquiring the first shooting data corresponding to the first frame image, the second shooting data corresponding to the second frame image, and the third shooting data corresponding to the third frame image, the method further includes: Acquire a shooting focal length corresponding to the second frame of image, and acquire an angle corresponding to the second frame of image, where the angle corresponding to the second frame of image is a posture angle not compensated by optical image stabilization; Obtaining a product value of an angle corresponding to the second frame image and the shooting focal length; When the product value is greater than the comparison threshold, it is determined that the second frame image is the blurred frame.

6. The video processing method according to claim 5, characterized in that: The obtaining the angle corresponding to the second frame image specifically includes: Determine a first detection area in the second frame image, the first detection area having a corresponding start exposure time and end exposure time; Determine a first starting posture based on the starting exposure moment, the exposure time, and the gyroscope data in the second shooting data; determining a first ending posture based on the end exposure moment, the exposure time, and the gyroscope data in the second shooting data; Determine a second starting posture based on the starting exposure moment, the exposure time, and the Hall data in the second shooting data; Determine a second ending posture based on the end exposure moment, the exposure time, and the Hall data in the second shooting data; determining a first posture difference based on the first ending posture and the first starting posture; determining a second posture difference based on the second ending posture and the second starting posture; The difference between the first posture difference and the second posture difference is determined as the angle corresponding to the second frame image.

7. A video processing device, characterized in that: include: an acquisition module, configured to acquire, when the first frame image and the third frame image are clear frames and the second frame image is a blurred frame, first shooting data corresponding to the first frame image, second shooting data corresponding to the second frame image, and third shooting data corresponding to the third frame image, wherein the first frame image, the second frame image, and the third frame image are three consecutive frames of images in a video, and the first shooting data, the second shooting data, and the third shooting data all include Hall data and gyroscope data; A first determination module is used to determine a first rotation matrix and a second rotation matrix based on the first shooting data, the second shooting data and the third shooting data; wherein the first rotation matrix is ​​used to represent the offset between the first frame image and the second frame image, and the second rotation matrix is ​​used to represent the offset between the third frame image and the second frame image; a second determining module, configured to determine a first mapping image based on the first frame image and the first rotation matrix, and to determine a second mapping image based on the third frame image and the second rotation matrix; A processing module is used to replace the blurred image area in the second frame image based on the first mapping image and the second mapping image to obtain a target image.

8. The video processing device according to claim 7, characterized in that: The first determining module is specifically configured to: Determine a first position offset when shooting the first frame of image and a second position offset that has been compensated for the first frame of image by optical image stabilization based on the first shooting data, determine a third position offset when shooting the second frame of image and a fourth position offset that has been compensated for the second frame of image by optical image stabilization based on the second shooting data, and determine a fifth position offset when shooting the third frame of image and a sixth position offset that has been compensated for the third frame of image by optical image stabilization based on the third shooting data; Acquire a first product value of the second position offset and a conversion coefficient, a second product value of the fourth position offset and the conversion coefficient, and a third product value of the sixth position offset and the conversion coefficient; Obtaining a first difference between the first position offset and the first product value, a second difference between the third position offset and the second product value, and a third difference between the fifth position offset and the third product value; determining a first rotation matrix based on the first difference and the second difference, and determining a second rotation matrix based on the second difference and the third difference; The conversion coefficient is a proportional coefficient corresponding to the Hall data when the Hall data is converted into the gyroscope data.

9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a program or instruction that can be run on the processor, and when the program or instruction is executed by the processor, the steps of the video processing method according to any one of claims 1 to 6 are implemented.

10. A readable storage medium, characterized in that: The readable storage medium stores a program or an instruction, and when the program or the instruction is executed by the processor, the steps of the video processing method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Video processing method and related equipment thereof

    CN115546042A

  • Video processing method and related equipment thereof

    CN115546043A

  • Video detection method and device, electronic equipment and storage medium

    CN116503640A

  • Video anti-shake method and device, equipment and storage medium

    CN117835063A

  • Video enhancement

    US20060257042A1