Image processing method, device and shooting equipment
By using the inertial measurement unit and Kalman filter technology in the shooting equipment to calculate and correct the posture, the problem of poor anti-shake effect of the shooting equipment is solved, and the stability and clarity of the video frame are improved.
Patent Information
- Application Number
- CN202410238649.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-01
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-03-01
AI Technical Summary
Existing shooting equipment has poor anti-shake effects, resulting in unclear videos.
An inertial measurement unit, including an angular velocity meter, is used to obtain the angular velocity vector, calculate the target state transition matrix and process noise covariance matrix, combine it with the Kalman filter for attitude correction, and rotate the image to achieve the anti-shake effect.
It significantly improves the video frame stability of the shooting equipment, achieves better anti-shake effect, and improves the clarity of the video shooting.
Smart Images

Figure CN118200726B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of image processing technology, and in particular, relates to image processing methods, devices and photographing equipment. Background Art
[0002] In recent years, with the continuous development of science and technology, various terminal devices have sprung up in people's lives, such as shooting equipment. However, the current shooting equipment still has some shortcomings that need to be solved. For example, once the shooting equipment is unstable during shooting, the overall picture (image) will shake, resulting in unclear video, that is, the quality of the captured video is poor. Therefore, the current shooting equipment generally has an anti-shake function, however, the anti-shake effect of the current shooting equipment is still poor. Summary of the invention
[0003] The embodiments of the present application provide an image processing method, apparatus, photographing device, and computer-readable storage medium, which can solve the problem of poor anti-shake effect of current photographing devices.
[0004] In a first aspect, an embodiment of the present application provides an image processing method, which is applied to a shooting device, wherein an inertial measurement unit is provided in the shooting device, and the inertial measurement unit includes an angular velocity meter. The image processing method includes: obtaining ω k , where the ω k is the three-axis angular velocity vector obtained by subtracting the zero-point bias data of the angular velocity meter from the three-axis angular velocity vector at the kth moment output by the angular velocity meter, where k is a positive integer greater than or equal to 2; according to the ω k and the first prediction value to obtain a second prediction value, wherein the first prediction value is the prediction value of the quaternion corresponding to the posture of the shooting device at the k-1th moment, and the second prediction value is the prediction value of the quaternion corresponding to the posture of the shooting device at the kth moment; according to the ω k Calculate a target state transfer matrix, the target state transfer matrix is a state transfer matrix from the k-1th moment to the kth moment; calculate a covariance matrix of the process noise at the k-1th moment according to the first predicted value; calculate a covariance matrix of the process noise at the k-1th moment according to the target state transfer matrix, the covariance matrix of the process noise at the k-1th moment, and P k-1 Get The P k-1 is used to represent the covariance of the Kalman filter at the k-1th moment, Used to represent the predicted state covariance at the kth moment; according to the And the second prediction value is calculated Said The quaternion used to represent the corrected posture of the photographing device at the kth moment; The image captured by the shooting device is rotated.
[0005] In a possible implementation manner of the first aspect, the target state transfer matrix, the covariance matrix of the process noise at the k-1th moment, and P k-1 Get Including: according to the target state transfer matrix, the covariance matrix of the process noise at the k-1th moment, P k-1 And the first relation obtains The first relation is Among them, the F k is used to represent the target state transfer matrix, ∑ k-1 The covariance matrix used to represent the process noise at the k-1th moment.
[0006] In a possible implementation manner of the first aspect, the inertial measurement unit further includes an accelerometer and a magnetometer. And the second prediction value is calculated Before, it includes: establishing the attitude estimation state observation equation corresponding to the kth moment through the data of the accelerometer and the data of the magnetometer; calculating the Kalman gain according to the attitude estimation state observation equation corresponding to the kth moment, the Kalman gain Among them, H k It is used to represent the observation matrix corresponding to the attitude estimation state observation equation corresponding to the kth moment, R k-1 Used to represent the covariance matrix of the observation noise at the k-1th moment; correspondingly, according to the And the second prediction value is calculated Including: According to the The Kalman gain and the second prediction value calculation
[0007] In a possible implementation manner of the first aspect, according to the target state transfer matrix, the covariance matrix of the process noise at the k-1th moment, and P k-1 Get Before, including: based on the system state residual threshold calculation ∈ k-1 , where the ∈ k-1 Used to indicate the The corresponding adaptive factor, Used to represent the predicted state covariance at the k-1th moment; based on the ∈ k-1 Get P k-1 , wherein the P k-1 Used to indicate that The calculated covariance, ∈ k-1 , the P k-1 , The following relations are satisfied:
[0008]
[0009] Among them, H k-1 ,I 4×4 , 0 4×6 , 0 6×4 , γ are used to represent the observation matrix corresponding to the attitude estimation state observation equation corresponding to the k-1th moment, the 4*4 unit matrix, the 4*6 zero matrix, the 6*4 zero matrix, and the target parameters respectively.
[0010] In a possible implementation manner of the first aspect, in the k-1 Get P k-1 Before, it includes: calculating the target Jacobian matrix according to the first predicted value, the target Jacobian matrix is the Jacobian matrix corresponding to the noise covariance of the angular velocity meter at the k-1th moment; constructing a cost function Among them, ||·|| 2 is the two-norm, express W k-1 Used to represent the target Jacobian matrix; solve J* based on the cost function, J* is used to represent the optimal solution of J; based on the relationship J * ≤γ 2 Determine γ.
[0011] In a possible implementation manner of the first aspect, k is a positive integer greater than or equal to 3, and before calculating the Kalman gain according to the attitude estimation state observation equation corresponding to the k-th moment, the method includes:
[0012] like If established, let R k-1 =R k-2 ,in, U b , L b They are used to represent the first specified parameter and the second specified parameter respectively;
[0013] like If not established, then in, δ is the third specified parameter.
[0014] In a possible implementation manner of the first aspect, the system state residual threshold calculation ∈ k-1Including: based on the system state residual threshold and the third relationship calculation ∈ k-1 , the third relation is in c2 is used to represent the system state residual threshold, Said Used to express the attitude estimation state observation equation corresponding to the k-1th moment.
[0015] In a second aspect, an embodiment of the present application provides an image processing device, the image processing device is applied to a shooting device, the shooting device is provided with an inertial measurement unit, the inertial measurement unit includes an angular velocity meter, and the image processing device includes:
[0016] The first acquisition unit is used to acquire ω k , where the ω k is the three-axis angular velocity vector obtained by subtracting the zero-point bias data of the angular velocity meter from the three-axis angular velocity vector at the kth moment output by the angular velocity meter, where k is a positive integer greater than or equal to 2;
[0017] The second acquisition unit is used to obtain the k and the first prediction value to obtain a second prediction value, wherein the first prediction value is a prediction value of the quaternion corresponding to the posture of the shooting device at the k-1th moment, and the second prediction value is a prediction value of the quaternion corresponding to the posture of the shooting device at the kth moment;
[0018] The first calculation unit is used to calculate the k Calculating a target state transfer matrix, wherein the target state transfer matrix is a state transfer matrix from the k-1th moment to the kth moment;
[0019] A second calculation unit, used for calculating the covariance matrix of the process noise at the k-1th moment according to the first prediction value;
[0020] The third acquisition unit is used to obtain the target state transfer matrix, the covariance matrix of the process noise at the k-1th moment, and P k-1 Get The Pk-1 is used to represent the covariance of the Kalman filter at the k-1th moment. Used to represent the predicted state covariance at the k-th moment;
[0021] The third computing unit is used to calculate the And the second prediction value is calculated Said A quaternion used to represent the calibrated posture of the camera at the k-th moment;
[0022] Rotating unit for use according to the The image captured by the shooting device is rotated.
[0023] In a third aspect, an embodiment of the present application provides a shooting device, comprising an inertial measurement unit, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the inertial measurement unit comprises an angular velocity meter, and the processor implements any of the methods described above when executing the computer program.
[0024] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements any of the methods described above.
[0025] It can be understood that the beneficial effects of the second to fourth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here.
[0026] Compared with the prior art, the embodiment of the present application has the following beneficial effects: the image processing method in the embodiment of the present application is applied to a shooting device, wherein the shooting device is provided with an inertial measurement unit, wherein the inertial measurement unit includes an angular velocity meter, and the image processing method includes: obtaining ω k , where the ω k is the three-axis angular velocity vector obtained by subtracting the zero-point bias data of the angular velocity meter from the three-axis angular velocity vector at the kth moment output by the angular velocity meter, where k is a positive integer greater than or equal to 2; according to the ω k and the first prediction value to obtain a second prediction value, wherein the first prediction value is the prediction value of the quaternion corresponding to the posture of the shooting device at the k-1th moment, and the second prediction value is the prediction value of the quaternion corresponding to the posture of the shooting device at the kth moment; according to the ω k Calculate the target state transfer matrix, which is the state transfer matrix from the k-1th moment to the k-th moment; calculate the covariance matrix of the process noise at the k-1th moment according to the first predicted value, that is, the covariance matrix of the process noise at the k-1th moment can be calculated more accurately according to the predicted value of the quaternion corresponding to the posture of the shooting device at the k-1th moment; then calculate the covariance matrix of the process noise at the k-1th moment according to the target state transfer matrix, the covariance matrix of the process noise at the k-1th moment and P k-1 Get The P k-1 is used to represent the covariance of the Kalman filter at the k-1th moment, Used to represent the predicted state covariance at the kth moment; according to the And the second prediction value can be calculated more accurately Said The quaternion used to represent the corrected posture of the photographing device at the kth moment; and then according to the The image captured by the shooting device is rotated so that the video frame of the shooting device can be stabilized, that is, a better anti-shake effect can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0028] Figure 1 is a flowchart of an image processing method provided by an embodiment of the present application;
[0029] Figure 2 is a schematic diagram of an image processing device provided by an embodiment of the present application;
[0030] Figure 3 It is a schematic diagram of a shooting device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0031] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0032] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0033] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0034] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0035] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0036] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0037] Embodiment 1
[0038] Figure 1 A flow chart of an image processing method provided by an embodiment of the present application is shown, and the image processing method is applied to a shooting device. As an example but not limitation, the shooting device is a panoramic camera. The shooting device is provided with an inertial measurement unit, and the inertial measurement unit includes an angular velocity meter. The image processing method includes: step S101, step S102, step S103, step S104, step S105, step S106 and step S107. The details are as follows:
[0039] Step S101: Obtain ω k , where the ω k It is the three-axis angular velocity vector obtained by subtracting the zero point bias data of the angular velocity meter from the three-axis angular velocity vector at the kth moment output by the angular velocity meter, where k is a positive integer greater than or equal to 2.
[0040] In this article, the k-1th moment and the kth moment are adjacent moments, the k-1th moment is the moment before the kth moment, and the interval between the k-1th moment and the kth moment is equal to the sampling interval of the inertial measurement unit.
[0041] For the convenience of description, a three-axis coordinate system may be set, wherein the three axes include an x-axis, a y-axis, and a z-axis. k It can be expressed as [ω x,k ,ω y,k ,ω z,k ] T The zero-point bias data of the angular velocity meter includes: the (signal) data output by the angular velocity meter when the angular velocity meter is stationary. For example, when the angular velocity meter is stationary, the angular velocity meter outputs [ω x,bias ,ω y,bias ,ω z,bias ] T ,ω x,bias ,ω y,bias ,ω z,bias They are used to represent the angular velocity on the x-axis, y-axis, and z-axis output by the angular velocity meter when it is stationary, ω x,k =ω x1,k -ω x,bias ,ω y,k =ω y1,k -ω y,bias ,ω z,k =ω z1,k -ω z,bias , where the ω x1,k ,ω y1,k ,ω z1,k They are respectively used to represent the angular velocities on the x-axis, y-axis, and z-axis output by the angular velocity meter at the kth moment.
[0042] In some embodiments, before step S101, ω1 is obtained, where ω1 is used to represent the three-axis angular velocity vector output by the angular velocity meter at the first moment minus the zero-point bias data of the angular velocity meter. ω1 can be expressed as [ω x,1 ,ω y,1 ,ω z,1 ] T , the first moment is the moment when the camera is powered on and initialized.
[0043] In some embodiments, the inertial measurement unit also includes an accelerometer and a magnetometer, and the image processing method also includes: before step S101, obtaining a1 and m1, wherein a1 is used to represent the three-axis acceleration vector obtained by subtracting the zero-point bias data of the accelerometer from the three-axis acceleration vector output by the accelerometer at the first moment, and the zero-point bias data of the accelerometer includes: the (signal) data output by the accelerometer when the accelerometer is stationary, and m1 is used to represent the three-axis magnetic field intensity vector obtained by subtracting the zero-point bias data of the magnetometer from the three-axis magnetic field intensity vector output by the magnetometer at the first moment, and the zero-point bias data of the magnetometer includes: the (signal) data output by the magnetometer when the magnetometer is stationary.
[0044] In addition, a1 can be expressed as [a x,1 , a y,1 , a z,1 ] T , a x,1 、a y,1 、a z,1 They are used to represent the components of a1 on the x-axis, y-axis, and z-axis. m1 can be expressed as [m x,1 , m y,1 , m z,1 ] T , m x,1 , m y,1 , m z,1 They are used to represent the components of m1 on the x-axis, y-axis, and z-axis respectively.
[0045] Optionally, the image processing method further includes: calculating an initial posture of the shooting device, the initial posture being a posture at a first moment.
[0046] In some embodiments, the calculating the initial posture of the camera device includes: if the motion amplitude of the camera device at the first moment is less than the specified motion amplitude, and a z,1 ≥0, the initial posture is determined as Wherein, g is the value of gravity acceleration; if the movement amplitude of the camera at the first moment is less than the specified movement amplitude, and a z,1 <0, the initial posture is determined as
[0047] In some embodiments, the calculating the initial posture of the camera device includes: if the movement amplitude of the camera device at the first moment is greater than or equal to the specified movement amplitude, then determining the initial posture as [1, 0, 0, 0] T .
[0048] Step S102: According to the kA second prediction value is obtained by summing the first prediction value, wherein the first prediction value is the prediction value of the quaternion corresponding to the posture of the shooting device at the k-1th moment, and the second prediction value is the prediction value of the quaternion corresponding to the posture of the shooting device at the kth moment.
[0049] For example, the second prediction value may be The first prediction value can be expressed as [q w,k-1 ,q x,k-1 ,q y,k-1 ,q z,k-1 ] T ,
[0050]
[0051] Wherein, ΔT is used to represent the sampling interval duration of the inertial measurement unit, Δθ k =(ω x,k ΔT) 2 +(ω y,k ΔT) 2 +(ω z,k ΔT) 2 , for example, ΔT = 1.25 milliseconds.
[0052] Step S103: According to the k A target state transfer matrix is calculated, where the target state transfer matrix is a state transfer matrix from the k-1th moment to the kth moment.
[0053] For ease of description, the target state transfer matrix can be expressed as k express,
[0054]
[0055] Step S104: Calculate the covariance matrix of the process noise at the k-1th moment according to the first prediction value.
[0056] For example, the covariance matrix of the process noise at the k-1th moment can be expressed as ∑ k-1 Indicates, ∑ k-1 equal Multiply
[0057]
[0058] Where d1 is equal to d2 is equal to d3 is equal to d4 is equal to d5 is equal to d6 is equal to d7 is equal to d8 is equal to They are used to represent the noise density covariance of the angular velocity meter on the x-axis, y-axis, and z-axis respectively.
[0059] Step S105: according to the target state transfer matrix, the covariance matrix of the process noise at the k-1th moment and P k-1 Get The P k-1 is used to represent the covariance of the Kalman filter at the k-1th moment, Used to represent the predicted state covariance at the k-th moment.
[0060] For example, when k is equal to 2, the covariance matrix of the process noise at the first moment and P1 are used to obtain
[0061] Optionally, the step S105 includes: obtaining according to the target state transfer matrix, the covariance matrix of the process noise at the k-1th moment, Pk-1 and the first relational expression The first relation is
[0062] In some embodiments, when k is 2, the covariance matrix Σ1 of the process noise at the first moment is a pre-stored covariance matrix.
[0063] Step S106: According to the And the second prediction value is calculated Said The quaternion used to represent the corrected posture of the photographing device at the k-th moment.
[0064] For example, when k is equal to 2, according to the And the second prediction value is calculated
[0065] Optionally, the inertial measurement unit further includes an accelerometer and a magnetometer. Correspondingly, before step S106, the steps include: establishing a posture estimation state observation equation corresponding to the kth moment through the data of the accelerometer and the data of the magnetometer; calculating a Kalman gain according to the posture estimation state observation equation corresponding to the kth moment, wherein the Kalman gain Among them, H k It is used to represent the observation matrix corresponding to the attitude estimation state observation equation corresponding to the kth moment, R k-1 The covariance matrix used to represent the observation noise at the k-1th moment; correspondingly, the step S106 includes: according to the The Kalman gain and the second prediction value calculation
[0066] As an example but not limitation, the attitude estimation state observation equation corresponding to the k-th time can be used express, It can be expressed as [q 0w,k ,q 0x,k ,q 0y,k ,q 0z,k ] T ,
[0067] in, Used to indicate The corresponding rotation matrix, ν k-1 It is used to represent the measurement noise of the accelerometer and the magnetometer, and the data of the accelerometer includes g ENU , the magnetometer data includes m ENU , g ENU =[0,0,1] T is the normalized gravity vector in the northeast celestial coordinate system, m ENU =[0,1,0] T is the normalized magnetic field vector in the northeast celestial coordinate system, correspondingly, According to the The Kalman gain and the second prediction value calculation Including: According to the The Kalman gain, the second prediction value and the second relational expression are used to calculate The second relation is in a k :[a x,k ,a y,k ,a z,k ] T 、m k :[m x,k ,m y,k ,m z,k ] T , the a k It is used to represent the three-axis acceleration vector obtained by subtracting the zero-point bias data of the accelerometer from the three-axis acceleration vector output by the accelerometer at the kth moment. k It is used to represent the three-axis magnetic field intensity vector obtained by subtracting the zero point bias data of the magnetometer from the three-axis magnetic field intensity vector at the kth moment output by the magnetometer.
[0068] Optionally, before step S105, the following steps are included:
[0069] Based on the system state residual threshold calculation ∈ k-1 , where the ∈ k-1 Used to indicate the The corresponding adaptive factor, Used to represent the predicted state covariance at the k-1th moment;
[0070] Based on the ∈ k-1 Get P k-1 , wherein the P k-1 Used to indicate that The calculated covariance, ∈ k-1 , the P k-1 , The following relations are satisfied:
[0071]
[0072]
[0073] Among them, H k-1 ,I 4×4 , 0 4×6 , 0 6×4 , γ are used to represent the observation matrix corresponding to the attitude estimation state observation equation corresponding to the k-1th moment, the 4*4 unit matrix, the 4*6 zero matrix, the 6*4 zero matrix, and the target parameters respectively.
[0074] The target parameters may be pre-stored in the photographing device.
[0075] Optionally, in the based on the ∈ k-1 Get P k-1 Before, it includes: calculating the target Jacobian matrix according to the first predicted value, the target Jacobian matrix is the Jacobian matrix corresponding to the noise covariance of the angular velocity meter at the k-1th moment; constructing a cost function Among them, ||·|| 2 is the two-norm, express Wk-1 is used to represent the target Jacobian matrix; based on the cost function, J is solved * , J * Used to represent the optimal solution of J; based on the relation J * ≤γ 2 Determine γ.
[0076] For example, determine γ as 1.52, N as a preset parameter,
[0077]
[0078] Optionally, k is a positive integer greater than or equal to 3, and before calculating the Kalman gain according to the attitude estimation state observation equation corresponding to the k-th moment, the method includes:
[0079] like If established, let R k-1 =R k-2 ,in, U b , L b They are used to represent the first specified parameter and the second specified parameter respectively;
[0080] like If not established, then in, δ is the third specified parameter.
[0081] Where δ∈(0,1). For example, 6=0.87, U b =1.2, L b =0.8.
[0082] In some embodiments, k is a positive integer greater than or equal to 3, and the ∑ k-1 The following relations are satisfied:
[0083] Among them, c1 is the fourth specified parameter,
[0084] Wherein, c1 is pre-stored in the photographing device. For example, c1=0.87.
[0085] In some embodiments, the system state residual threshold calculation ∈ k-1 Including: based on the system state residual threshold and the third relationship calculation ∈ k-1 , the third relation is in c2 is used to represent the system state residual threshold.
[0086] For example, c2=1.26.
[0087] Step S107: The image captured by the shooting device is rotated.
[0088] Specifically, determine The corresponding rotation matrix is used to rotate the image captured by the shooting device based on the rotation matrix, so that the video frame of the shooting device can be stabilized, that is, a better anti-shake effect can be achieved.
[0089] The image processing method in the embodiment of the present application is applied to a photographing device, wherein the photographing device is provided with an inertial measurement unit, wherein the inertial measurement unit includes an angular velocity meter, and the image processing method includes: obtaining ω k , where the ω k is the three-axis angular velocity vector obtained by subtracting the zero-point bias data of the angular velocity meter from the three-axis angular velocity vector at the kth moment output by the angular velocity meter, where k is a positive integer greater than or equal to 2; according to the ω k and the first prediction value to obtain a second prediction value, wherein the first prediction value is the prediction value of the quaternion corresponding to the posture of the shooting device at the k-1th moment, and the second prediction value is the prediction value of the quaternion corresponding to the posture of the shooting device at the kth moment; according to the ω k Calculate the target state transfer matrix, which is the state transfer matrix from the k-1th moment to the k-th moment; calculate the covariance matrix of the process noise at the k-1th moment according to the first predicted value, that is, the covariance matrix of the process noise at the k-1th moment can be calculated more accurately according to the predicted value of the quaternion corresponding to the posture of the shooting device at the k-1th moment; then calculate the covariance matrix of the process noise at the k-1th moment according to the target state transfer matrix, the covariance matrix of the process noise at the k-1th moment and P k-1 Get The P k-1 is used to represent the covariance of the Kalman filter at the k-1th moment, Used to represent the predicted state covariance at the kth moment; according to the And the second prediction value can be calculated more accurately Said The quaternion used to represent the corrected posture of the photographing device at the kth moment; and then according to the The image captured by the shooting device is rotated so that the video frame of the shooting device can be stabilized, that is, a better anti-shake effect can be achieved.
[0090] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0091] Embodiment 2
[0092] Corresponding to the image processing method described in the above embodiment, Figure 2 A schematic diagram of an image processing device provided in an embodiment of the present application is shown. For ease of explanation, only the parts related to the embodiment of the present application are shown.
[0093] The image processing device 2 is applied to a photographing device, in which an inertial measurement unit is provided, and the inertial measurement unit includes an angular velocity meter. The image processing device 2 includes: a first acquisition unit 201, a second acquisition unit 202, a first calculation unit 203, a second calculation unit 204, a third acquisition unit 205, a third calculation unit 206 and a rotation unit 207, wherein:
[0094] The first acquisition unit 201 is used to: acquire ω k , where the ω k It is the three-axis angular velocity vector obtained by subtracting the zero point bias data of the angular velocity meter from the three-axis angular velocity vector at the kth moment output by the angular velocity meter, where k is a positive integer greater than or equal to 2.
[0095] In some embodiments, the image processing device 2 further includes: a fourth acquisition unit.
[0096] The fourth acquisition unit is used to: execute the acquisition of ω in the first acquisition unit 201 k Before, ω1 is obtained, where ω1 is used to represent the three-axis angular velocity vector output by the angular velocity meter at the first moment minus the zero-point bias data of the angular velocity meter. ω1 can be expressed as [ω x,1 ,ω y,1 ,ω z,1 ] T , the first moment is the moment when the camera is powered on and initialized.
[0097] In some embodiments, the inertial measurement unit further includes an accelerometer and a magnetometer, and the fourth acquisition unit is used to: execute the acquisition of the first acquisition unit 201 k Previously, a1 and m1 were obtained, wherein a1 was used to represent the three-axis acceleration vector obtained by subtracting the zero-point bias data of the accelerometer from the three-axis acceleration vector output by the accelerometer at the first moment, and m1 was used to represent the three-axis magnetic field intensity vector obtained by subtracting the zero-point bias data of the magnetometer from the three-axis magnetic field intensity vector output by the magnetometer at the first moment.
[0098] Optionally, the image processing device 2 further includes: a fourth computing unit.
[0099] The fourth calculation unit is used to calculate an initial posture of the shooting device, where the initial posture is the posture at the first moment.
[0100] The second acquisition unit 202 is used to: kA second prediction value is obtained by summing the first prediction value, wherein the first prediction value is the prediction value of the quaternion corresponding to the posture of the shooting device at the k-1th moment, and the second prediction value is the prediction value of the quaternion corresponding to the posture of the shooting device at the kth moment.
[0101] The first calculation unit 203 is used to: k A target state transfer matrix is calculated, where the target state transfer matrix is a state transfer matrix from the k-1th moment to the kth moment.
[0102] The second calculation unit 204 is used to calculate the covariance matrix of the process noise at the k-1th moment according to the first prediction value.
[0103] The third acquisition unit 205 is used to acquire according to the target state transfer matrix, the covariance matrix of the process noise at the k-1th moment and Pk-1 The Pk-1 is used to represent the covariance of the Kalman filter at the k-1th moment. Used to represent the predicted state covariance at the k-th moment.
[0104] The third calculation unit 206 is used to calculate the And the second prediction value is calculated Said The quaternion used to represent the corrected posture of the photographing device at the k-th moment.
[0105] For example, when k is equal to 2, according to the And the second prediction value is calculated
[0106] Optionally, the inertial measurement unit further includes an accelerometer and a magnetometer. Correspondingly, the third computing unit 206 performs the And the second prediction value is calculated Previously, it was also used to establish the attitude estimation state observation equation corresponding to the kth moment through the data of the accelerometer and the data of the magnetometer; the Kalman gain was calculated according to the attitude estimation state observation equation corresponding to the kth moment, and the Kalman gain Among them, H k It is used to represent the observation matrix corresponding to the attitude estimation state observation equation corresponding to the kth moment, R k-1 The covariance matrix used to represent the observation noise at the k-1th moment; correspondingly, the third calculation unit 206 performs the calculation according to the And the second prediction value is calculated When used according to the The Kalman gain and the second prediction value calculation
[0107] Optionally, the third acquisition unit 205 performs the acquisition based on the target state transfer matrix, the covariance matrix of the process noise at the k-1th moment, and P k-1 Get Previously, it was also used to calculate ∈ based on the system state residual threshold k-1 , where the ∈ k-1 Used to indicate the The corresponding adaptive factor, Used to represent the predicted state covariance at the k-1th moment; based on the ∈ k-1 Get P k-1 , wherein the P k-1 Used to indicate that The calculated covariance, ∈ k-1 , the P k-1 , The following relations are satisfied:
[0108] Among them, H k-1 ,I 4×4 , 0 4×6 , 0 6×4 , γ are used to represent the observation matrix corresponding to the attitude estimation state observation equation corresponding to the k-1th moment, the 4*4 unit matrix, the 4*6 zero matrix, the 6*4 zero matrix, and the target parameters respectively.
[0109] The target parameters may be pre-stored in the photographing device.
[0110] Optionally, the third acquisition unit 205 performs the k-1 Get P k-1 Before, it is also used to: calculate the target Jacobian matrix according to the first predicted value, the target Jacobian matrix is the Jacobian matrix corresponding to the noise covariance of the angular velocity meter at the k-1th moment; construct a cost function Among them, ||·|| 2 is the two-norm, express W k-1 Used to represent the target Jacobian matrix; solving J based on the cost function * , J * Used to represent the optimal solution of J; based on the relation J * ≤γ 2 Determine γ.
[0111] Optionally, k is a positive integer greater than or equal to 3, and before executing the calculation of the Kalman gain according to the attitude estimation state observation equation corresponding to the k-th moment, the third calculation unit 206 is further used to:
[0112] like If established, let R k-1 =R k-2 ,in, U b , L b They are used to represent the first specified parameter and the second specified parameter respectively;
[0113] like If not established, then in, δ is the third specified parameter.
[0114] Where δ∈(0,1). For example, 6=0.87, U b =1.2, L b =0.8.
[0115] In some embodiments, k is a positive integer greater than or equal to 3, and ∑k-1 satisfies the following relationship:
[0116] Among them, c1 is the fourth specified parameter,
[0117] Wherein, c1 is pre-stored in the photographing device. For example, c1=0.87.
[0118] In some embodiments, the system state residual threshold calculation ∈ k-1 Including: based on the system state residual threshold and the third relationship calculation ∈ k-1 , the third relation is in c2 is used to represent the system state residual threshold.
[0119] Rotating unit 207, used according to the The image captured by the shooting device is rotated.
[0120] The image processing device in the embodiment of the present application is applied to a photographing device, wherein the photographing device is provided with an inertial measurement unit, wherein the inertial measurement unit includes an angular velocity meter, and the image processing device includes: a first acquisition unit, configured to acquire ω k , where the ω kThe three-axis angular velocity vector is obtained by subtracting the zero-point bias data of the angular velocity meter from the three-axis angular velocity vector at the kth moment output by the angular velocity meter, where k is a positive integer greater than or equal to 2; the second acquisition unit is used to obtain the three-axis angular velocity vector according to the ω k and the first prediction value to obtain a second prediction value, wherein the first prediction value is a prediction value of the quaternion corresponding to the posture of the shooting device at the k-1th moment, and the second prediction value is a prediction value of the quaternion corresponding to the posture of the shooting device at the kth moment; a first calculation unit is used to obtain a second prediction value according to the ω k The target state transfer matrix is calculated, and the target state transfer matrix is the state transfer matrix from the k-1th moment to the k-th moment; the second calculation unit is used to calculate the covariance matrix of the process noise at the k-1th moment according to the first prediction value; the third acquisition unit is used to calculate the covariance matrix of the process noise at the k-1th moment according to the target state transfer matrix, the covariance matrix of the process noise at the k-1th moment, and P k-1 Get The P k-1 is used to represent the covariance of the Kalman filter at the k-1th moment, used to represent the predicted state covariance at the kth moment; a third calculation unit, used to calculate the state covariance according to the And the second prediction value is calculated Said A quaternion for representing the corrected posture of the photographing device at the kth moment; a rotation unit for representing the posture of the photographing device at the kth moment according to the The image captured by the shooting device is rotated so that the video frame of the shooting device can be stabilized, that is, a better anti-shake effect can be achieved.
[0121] It should be noted that for technical details not fully described in this embodiment, reference may be made to the image processing methods provided in the various embodiments in the above-mentioned embodiment 1.
[0122] Embodiment 3
[0123] The shooting device 3 in this embodiment includes: an inertial measurement unit 30, at least one processor 31, a memory 32, and a computer program 33 stored in the memory 32 and executable on the at least one processor 31. When the processor 31 executes the computer program 33, the steps in any of the above-mentioned image processing method embodiments are implemented.
[0124] When the processor 31 executes the computer program 33, the steps in the above-mentioned various image processing method embodiments are implemented, for example: Figure 1 Alternatively, when the processor 31 executes the computer program 33, the functions of each unit in the above-mentioned device embodiments are realized, for example, Figure 2 Functions of the illustrated units 201 to 207. As an example but not a limitation, the photographing device 3 may be a panoramic camera.
[0125] Those skilled in the art will understand that this embodiment is merely an example of the shooting device 3 and does not constitute a limitation on the shooting device 3. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, etc.
[0126] The processor 31 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 any conventional processor, etc.
[0127] In some embodiments, the memory 32 may be an internal storage unit of the photographing device 3, such as a hard disk or memory of the photographing device 3. In other embodiments, the memory 32 may also be an external storage device of the photographing device 3, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the photographing device 3. Further, the memory 32 may also include both an internal storage unit and an external storage device of the photographing device 3. The memory 32 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program 33. The memory 32 may also be used to temporarily store data that has been output or is to be output.
[0128] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0129] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0130] The embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program 33. When the computer program 33 is executed by the processor 31, the steps in the above-mentioned method embodiments can be implemented.
[0131] The embodiment of the present application provides a computer program 33 product. When the computer program 33 product runs on the shooting device 3, the shooting device 3 can implement the steps in the above-mentioned method embodiments when executing.
[0132] 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 computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program 33. The computer program 33 can be stored in a computer-readable storage medium. When the computer program 33 is executed by the processor 31, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program 33 includes a computer program 33 code, and the computer program 33 code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device capable of carrying the computer program 33 code to the shooting device 3, a recording medium, a computer memory 32, a read-only memory 32 (ROM, Read-Only Memory), a random access memory 32 (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0133] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0134] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0135] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely 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 system, 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.
[0136] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0137] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. An image processing method, characterized in that: The image processing method is applied to a photographing device, wherein the photographing device is provided with an inertial measurement unit, wherein the inertial measurement unit includes an angular velocity meter, an accelerometer, and a magnetometer, and the image processing method includes: Get ω k , where the ω k is the three-axis angular velocity vector obtained by subtracting the zero-point bias data of the angular velocity meter from the three-axis angular velocity vector at the kth moment output by the angular velocity meter, where k is a positive integer greater than or equal to 2; According to the k and the first prediction value to obtain a second prediction value, wherein the first prediction value is a prediction value of the quaternion corresponding to the posture of the shooting device at the k-1th moment, and the second prediction value is a prediction value of the quaternion corresponding to the posture of the shooting device at the kth moment; According to the k Calculating a target state transfer matrix, wherein the target state transfer matrix is a state transfer matrix from the k-1th moment to the kth moment; Calculate the covariance matrix of the process noise at the k-1th moment according to the first predicted value; According to the target state transfer matrix, the covariance matrix of the process noise at the k-1th moment and P k-1 Get The P k-1 is used to represent the covariance of the Kalman filter at the k-1th moment, Used to represent the predicted state covariance at the k-th moment; According to the And the second prediction value is calculated Said A quaternion used to represent the calibrated posture of the camera at the k-th moment; According to the Rotating the image captured by the shooting device; In the step of obtaining the target state transfer matrix, the covariance matrix of the process noise at the k-1th moment, and Pk-1 Before, including: based on the system state residual threshold calculation ∈k-1, wherein the ∈ k-1 Used to indicate the The corresponding adaptive factor, Used to represent the predicted state covariance at the k-1th moment; based on the ∈ k-1 Get P k-1 , wherein the P k-1 Used to indicate that The calculated covariance, ∈ k-1 , the P k-1 , The following relations are satisfied: Among them, H k-1 ,I 4×4 , 0 4×6 , 0 6×4 , γ are used to represent the observation matrix corresponding to the attitude estimation state observation equation corresponding to the k-1th moment, the 4*4 unit matrix, the 4*6 zero matrix, the 6*4 zero matrix, and the target parameters respectively; In the based on the ∈ k-1 Get P k-1 Before, it includes: calculating the target Jacobian matrix according to the first predicted value, the target Jacobian matrix is the Jacobian matrix corresponding to the noise covariance of the angular velocity meter at the k-1th moment; constructing a cost function Among them, ||·|| 2 is the two-norm, express W k-1 is used to represent the target Jacobian matrix, It is used to express the attitude estimation state observation equation corresponding to the k-th moment, The a x,k , the a y,k 、the a z,k Used to represent a k The components on the x-axis, y-axis, and z-axis, a k It is used to represent the three-axis acceleration vector obtained by subtracting the zero-point bias data of the accelerometer from the three-axis acceleration vector at the kth moment output by the accelerometer, wherein m x,k 、The m y,k 、The m z,k Used to represent m k The components on the x-axis, the y-axis, and the z-axis, the m k The three-axis magnetic field intensity vector obtained by subtracting the zero-point bias data of the magnetometer from the three-axis magnetic field intensity vector at the kth moment output by the magnetometer is used to solve J based on the cost function. * , J * Used to represent the optimal solution of J, based on the relation J * ≤γ 2 Determine γ.
2. The image processing method according to claim 1, characterized in that: The target state transfer matrix, the covariance matrix of the process noise at the k-1th moment and P k-1 Get include: According to the target state transfer matrix, the covariance matrix of the process noise at the k-1th moment, P k-1 And the first relation obtains The first relation is Among them, the F k is used to represent the target state transfer matrix, ∑ k-1 The covariance matrix used to represent the process noise at the k-1th moment.
3. The image processing method according to claim 1, characterized in that: In the said according to the And the second prediction value is calculated Previously, including: Establishing a posture estimation state observation equation corresponding to the kth moment through the data of the accelerometer and the data of the magnetometer; Correspondingly, according to the And the second prediction value is calculated include: According to the The Kalman gain is calculated by the attitude estimation state observation equation corresponding to the kth moment. Among them, H k It is used to represent the observation matrix corresponding to the attitude estimation state observation equation corresponding to the kth moment, R k-1 A covariance matrix for representing the observation noise at the k-1th moment; Calculate according to the Kalman gain, the second prediction value and the second relational expression The second relation is Said Used to represent the second predicted value.
4. The image processing method according to claim 3, characterized in that: k is a positive integer greater than or equal to 3, and before calculating the Kalman gain according to the attitude estimation state observation equation corresponding to the k-th moment, it includes: like If established, let R k-1 =R k-2 ,in, U b , L b They are used to represent the first specified parameter and the second specified parameter respectively; like If not established, then in, δ is the third specified parameter.
5. The image processing method according to claim 1, wherein: The system state residual threshold calculation ∈ k-1 include: Based on the system state residual threshold and the third relation ∈ k-1 , the third relation is in c2 is used to represent the system state residual threshold, Said Used to express the attitude estimation state observation equation corresponding to the k-1th moment.
6. An image processing device, characterized in that: The image processing device is applied to a photographing device, wherein the photographing device is provided with an inertial measurement unit, wherein the inertial measurement unit includes an angular velocity meter, an accelerometer, and a magnetometer, and the image processing device includes: The first acquisition unit is used to acquire ω k , where the ω k is the three-axis angular velocity vector obtained by subtracting the zero-point bias data of the angular velocity meter from the three-axis angular velocity vector at the kth moment output by the angular velocity meter, where k is a positive integer greater than or equal to 2; The second acquisition unit is used to obtain the k and the first prediction value to obtain a second prediction value, wherein the first prediction value is a prediction value of the quaternion corresponding to the posture of the shooting device at the k-1th moment, and the second prediction value is a prediction value of the quaternion corresponding to the posture of the shooting device at the kth moment; The first calculation unit is used to calculate the k Calculating a target state transfer matrix, wherein the target state transfer matrix is a state transfer matrix from the k-1th moment to the kth moment; A second calculation unit, used for calculating the covariance matrix of the process noise at the k-1th moment according to the first prediction value; The third acquisition unit is used to obtain the target state transfer matrix, the covariance matrix of the process noise at the k-1th moment, and P k-1 Get The P k-1 is used to represent the covariance of the Kalman filter at the k-1th moment, Used to represent the predicted state covariance at the k-th moment; The third computing unit is used to calculate the And the second prediction value is calculated Said A quaternion used to represent the calibrated posture of the camera at the k-th moment; Rotating unit for use according to the Rotating the image captured by the shooting device; The third acquisition unit performs the step of: k-1 Get Previously, it was also used to calculate ∈ based on the system state residual threshold k-1 , where the ∈ k-1 Used to indicate the The corresponding adaptive factor, Used to represent the predicted state covariance at the k-1th moment; based on the ∈ k-1 Get P k-1 , wherein the P k-1 Used to indicate that The calculated covariance, ∈ k-1 , the P k-1 , The following relations are satisfied: Among them, H k-1 ,I 4×4 , 0 4×6 , 0 6×4 , γ are used to represent the observation matrix corresponding to the attitude estimation state observation equation corresponding to the k-1th moment, the 4*4 unit matrix, the 4*6 zero matrix, the 6*4 zero matrix, and the target parameters respectively; The third acquisition unit executes the k-1 Get P k-1 Before, it is also used to: calculate the target Jacobian matrix according to the first predicted value, the target Jacobian matrix is the Jacobian matrix corresponding to the noise covariance of the angular velocity meter at the k-1th moment; construct a cost function Among them, ||·|| 2 is the two-norm, express W k-1 is used to represent the target Jacobian matrix, It is used to express the attitude estimation state observation equation corresponding to the k-th moment, The a x,k , the a y,k 、the a z,k Used to represent a k The components on the x-axis, y-axis, and z-axis, a k It is used to represent the three-axis acceleration vector obtained by subtracting the zero-point bias data of the accelerometer from the three-axis acceleration vector at the kth moment output by the accelerometer, wherein m x,k 、The m y,k 、The m z,k Used to represent m k The components on the x-axis, the y-axis, and the z-axis, the m k The three-axis magnetic field intensity vector obtained by subtracting the zero-point bias data of the magnetometer from the three-axis magnetic field intensity vector at the kth moment output by the magnetometer is used to solve J based on the cost function. * , J * Used to represent the optimal solution of J, based on the relation J * ≤γ 2 Determine γ.
7. A photographing device, comprising an inertial measurement unit, a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the inertial measurement unit comprises an angular velocity meter, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 5 is implemented.
8. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
