CN-122027895-A - Photographing anti-shake method, electronic device, storage medium, and program product
Abstract
The application relates to the technical field of shooting, and provides a shooting anti-shake method, electronic equipment, a storage medium and a program product, which are applied to the electronic equipment, wherein the electronic equipment comprises a shooting module and an inertia measurement unit; the method comprises the steps that for a preview image to be sent and displayed, which is acquired at a first image moment by a camera module, the electronic equipment carries out anti-shake processing on the preview image based on a first equipment pose before smoothing and a target equipment pose after smoothing at the same image acquisition moment, and then sends and displays the preview image, wherein the smoothing processing of the target equipment pose is carried out by combining with a predicted second equipment pose. Therefore, more and richer equipment pose change information is included between the first equipment pose and the target equipment pose, and more equipment pose change information can be referred to by carrying out anti-shake processing on the preview image based on the first equipment pose and the target equipment pose, so that the anti-shake effect of the preview image can be improved, and the stability and the smoothness of a moving mirror of the preview image are ensured.
Inventors
- ZHANG WU
- WANG NING
- LU SHENGQING
- LI YAOPENG
Assignees
- 荣耀终端股份有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20241111
Claims (14)
- 1. The photographing anti-shake method is characterized by being applied to electronic equipment, wherein the electronic equipment comprises a photographing module and an inertial measurement unit, the photographing module is used for collecting images, the inertial measurement unit is used for collecting inertial measurement data, and the method comprises the following steps: Receiving a first operation; Displaying a shooting interface based on the first operation, wherein the shooting interface comprises a target preview image; The target preview image is obtained by carrying out anti-shake processing on a first image acquired by the camera module at a first image acquisition time, wherein the anti-shake processing is carried out based on a first equipment pose and a target equipment pose corresponding to the first image acquisition time; The smoothing processing is performed based on the first equipment pose, a historical equipment pose corresponding to a historical image acquisition moment and a predicted second equipment pose corresponding to a second image acquisition moment, the historical image acquisition moment is before the first image acquisition moment, the second image acquisition moment is the next image acquisition moment after the first image acquisition moment, and the second equipment pose is predicted based on the inertial measurement data.
- 2. The method of claim 1, wherein the capture interface comprises a capture interface in a capture mode or a record interface in a record mode.
- 3. The method according to claim 1 or 2, characterized in that the method further comprises: Acquiring first inertial measurement data corresponding to a first data acquisition time and at least one historical inertial measurement data corresponding to at least one historical data acquisition time, wherein the first data acquisition time is the same as or before the first image acquisition time; Respectively predicting second inertial measurement data corresponding to at least one second data acquisition time by using the first inertial measurement data and the at least one historical inertial measurement data, wherein the second data acquisition time is after the first data acquisition time; and estimating the pose based on second inertial measurement data corresponding to the at least one second data acquisition moment to obtain the pose of the second equipment.
- 4. A method according to claim 3, wherein said predicting, using said first inertial measurement data and said at least one historical inertial measurement data, respectively, results in second inertial measurement data corresponding to at least one second data acquisition instant, comprising: training the initial prediction model by using training data to obtain a target prediction model, wherein the training data comprises the first inertial measurement data, the first data acquisition time, the at least one historical inertial measurement data and the at least one historical data acquisition time; And inputting at least one second data acquisition time to the target prediction model, and respectively outputting corresponding second inertial measurement data by the target prediction model based on each second data acquisition time.
- 5. A method according to claim 3, wherein said predicting, using said first inertial measurement data and said at least one historical inertial measurement data, respectively, results in second inertial measurement data corresponding to at least one second data acquisition instant, comprising: Taking the first data acquisition time and the at least one historical data acquisition time as input of an initial polynomial, taking the first inertial measurement data and the at least one historical inertial measurement data as output of the initial polynomial, performing polynomial fitting on the initial polynomial, and determining polynomial coefficients; replacing coefficients in the initial polynomial with the polynomial coefficients to obtain a target polynomial; And respectively inputting each second data acquisition time to the target polynomial, and performing polynomial calculation with the polynomial coefficients to obtain second inertial measurement data corresponding to each second data acquisition time.
- 6. The method of claim 5, wherein the expression of the target polynomial is as follows: P(t)=a 0 +a 1 t+a 2 t 2 +…+a n t n ; wherein P (t) is the second inertial measurement data, t 2 ,…,t n are different second data acquisition moments, a 1 ,a 2 …a n is the polynomial coefficient, and n is a positive integer.
- 7. The method according to any one of claims 3-6, wherein said estimating a pose based on second inertial measurement data corresponding to the at least one second data acquisition instant, to obtain the second device pose, comprises: For each second data acquisition time, respectively carrying out pose estimation based on corresponding second inertial measurement data and third equipment poses of adjacent previous data acquisition time to obtain third equipment poses corresponding to at least one second data acquisition time one by one; under the condition that the data acquisition time and the image acquisition time are not coincident, the third equipment pose corresponding to the data acquisition time is converted to the image acquisition time, and the second equipment pose corresponding to the second image acquisition time is obtained; and under the condition that the data acquisition time coincides with the image acquisition time, taking a third equipment pose corresponding to a second data acquisition time identical to the second image acquisition time as the second equipment pose.
- 8. The method of claim 7, wherein said transforming the third device pose corresponding to the data acquisition time to an image acquisition time to obtain the second device pose corresponding to the second image acquisition time comprises: Determining a first target time and a second target time which are adjacent to the second image acquisition time in the at least one second data acquisition time, wherein the first target time is a time before the second target time; Determining a first pose weight corresponding to a first candidate pose and a second pose weight corresponding to a second candidate pose, wherein the first candidate pose is a third equipment pose at the first target moment, the second candidate pose is a third equipment pose at the second target moment, the first pose weight is a difference value between the second target moment and the second image acquisition moment, and the second pose weight is a difference value between the second image acquisition moment and the first target moment; And carrying out weighted summation according to the first candidate pose, the first pose weight, the second candidate pose and the second pose weight to obtain the second equipment pose.
- 9. The method according to claim 7 or 8, wherein the expression of the pose estimation is: Wherein, the The third equipment pose at the time t+1; The position and the posture of the third device at the time t are determined, V t+1 is inertia measurement data V at the time t+1, deltat is the time interval between two inertia measurement data adjacent to each other at the time t, and the time t+1 is the next data acquisition time adjacent to the time t.
- 10. The method of any of claims 1-9, wherein the anti-shake process includes a warp correction, the method further comprising: determining a distortion correction matrix according to the first equipment pose and the target equipment pose; and performing distortion correction on the first image according to the distortion correction matrix to obtain the target preview image.
- 11. The method according to any one of claims 1-10, further comprising: and carrying out smoothing processing on the first equipment pose, the historical equipment pose and the second equipment pose by using a smoothing algorithm to obtain the target equipment pose, wherein the smoothing algorithm comprises filtering, quadratic programming or machine learning.
- 12. An electronic device comprising one or more processors and memory coupled to the processors, the memory having stored therein one or more computer program code comprising computer instructions that, when executed by the processor, cause the electronic device to perform the photography anti-shake method of any of claims 1-11.
- 13. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when executed by a processor of an electronic device, causes the electronic device to perform the photographing anti-shake method according to any of claims 1-11.
- 14. A computer program product comprising a computer program which, when executed by a processor in an electronic device, causes the electronic device to perform the photographing anti-shake method according to any of claims 1-11.
Description
Photographing anti-shake method, electronic device, storage medium, and program product Technical Field The embodiment of the application relates to the technical field of shooting, in particular to a shooting anti-shake method, electronic equipment, a storage medium and a program product. Background In order to reduce the frame shake of a captured image and improve the frame effect, electronic devices typically perform anti-shake processing on video and preview images. For the preview image, it is necessary to ensure the processing speed and real-time performance of the preview image, and at present, the anti-shake effect of the preview image is poor, so that the stability and the mirror smoothness of the preview image are poor. Disclosure of Invention The embodiment of the application provides a shooting anti-shake method, electronic equipment, a storage medium and a program product, which are used for carrying out anti-shake processing on a preview picture so as to improve the stability of the preview picture and the smoothness of a mirror. In order to achieve the above purpose, the embodiment of the present application adopts the following technical scheme: The method comprises the steps of receiving a first operation, displaying a shooting interface based on the first operation, enabling the shooting interface to comprise a target preview image, wherein the target preview image is obtained by conducting anti-shake processing on a first image acquired by the shooting module at a first image acquisition time, the anti-shake processing is conducted based on a first equipment pose corresponding to the first image acquisition time and a target equipment pose, the target equipment pose is the equipment pose of the first equipment pose after smoothing processing, smoothing processing is conducted based on the first equipment pose, a historical equipment pose corresponding to the historical image acquisition time and a predicted second equipment pose corresponding to a second image acquisition time, the historical image acquisition time is before the first image acquisition time, the second image acquisition time is the next image acquisition time after the first image acquisition time, and the second equipment pose is obtained based on inertia measurement data prediction. In this implementation, since the target device pose that acts on the anti-shake processing of the preview image is a device pose that is obtained by performing smoothing processing in combination with the predicted second device pose, the target device pose and the first device pose before smoothing include more and more abundant device pose change information. Furthermore, when the electronic device performs anti-shake processing on the first image based on the pose of the target device and the pose of the first device, more pose change information can be referred to, so that the anti-shake processing effect of the preview image can be improved, and the preview image can also have good stability and mirror smoothness like a picture in a stored video. Meanwhile, the future pose of the second device is mainly predicted by known inertial measurement data, so that the processing speed and instantaneity of the preview image are not affected, namely the anti-shake effect of the preview image can be improved under the condition that the anti-shake processing delay is not increased, and the stability and smoothness of the preview image are ensured. In a possible implementation manner of the first aspect, the photographing interface includes a photographing interface in a photographing mode or a video recording interface in a video recording mode. Therefore, the picture jitter in the preview image can be eliminated no matter the preview in the photographing mode or the preview in the video recording mode, so that the preview image in each photographing mode is ensured to have good stability and running smoothness. In one possible implementation manner of the first aspect, the photographing anti-shake method includes obtaining first inertial measurement data corresponding to a first data acquisition time and at least one historical inertial measurement data corresponding to at least one historical data acquisition time, wherein the first data acquisition time is identical to or before a first image acquisition time, the historical data acquisition time is before the first data acquisition time, respectively predicting second inertial measurement data corresponding to at least one second data acquisition time by using the first inertial measurement data and the at least one historical inertial measurement data, performing pose estimation on the second inertial measurement data corresponding to at least one second data acquisition time after the first data acquisition time, and obtaining a second equipment pose. In this implementation, the accuracy of the predicted data can be ensured by predicting the second inertial measurement data at the future ti