Image stabilization method and electronic device

By acquiring and processing the translation amount and time difference information in the image stream collected by the camera in the electronic device, and calculating the translation pose and compensation amount, efficient image anti-shake processing under the flexible movement of the camera is achieved, and the field of view of the telephoto camera is solved. It solves the problems of angle limitation and insufficient detection by the gyroscope sensor, and improves the image anti-shake effect and applicable scenarios.

CN117714867BActive Publication Date: 2024-10-18HONOR DEVICE CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310552171.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-16
Publication Date
2024-10-18
Estimated Expiration
2043-05-16

AI Technical Summary

Technical Problem

In electronic devices, existing image anti-shake methods cannot effectively improve the anti-shake effect of images under the flexible movement of cameras, especially the limited field of view of telephoto cameras and the inability of gyroscope sensors to accurately detect anti-shake caused by translational movements. Insufficient effect.

Method used

By obtaining the global translation amount of two adjacent frames of images in the image stream collected by the camera, combined with the time difference information, multiple translation poses and translation compensation amounts are calculated, and image processing is performed to generate a stable image stream and achieve anti-shake of the image. processing and does not rely on gyroscope sensor data.

Benefits of technology

When the camera achieves flexible movement, the anti-shake effect of the image is improved, meeting the shooting needs of different scenes, expanding the applicable scenarios of the image anti-shake method, reducing the amount of calculation and reducing the dependence on electronic equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117714867B_ABST
    Figure CN117714867B_ABST
Patent Text Reader

Abstract

The present application relates to the field of images, and provides an image stabilization method and an electronic device. The image stabilization method is applied to an electronic device, and the electronic device includes a first camera, which is a movable camera. The method includes: starting a camera application; obtaining a first image stream captured by the first camera; obtaining a global translation amount based on any two adjacent frames of images in the first image stream; obtaining multiple translation compensation amounts based on multiple translation postures, and the multiple translation compensation amounts are used to characterize the posture differences between the multiple translation postures and the translation postures after smoothing, and the multiple translation compensation amounts correspond one-to-one to the multiple frames of images; obtaining a second image stream based on the multiple translation compensation amounts and the first image stream; and displaying the second image stream. Based on the present technical solution, when the camera in the electronic device can achieve flexible movement, the image stabilization effect can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing, and in particular to an image anti-shake method and electronic device. Background Art

[0002] With the development of shooting functions in electronic devices, camera applications are increasingly used in electronic devices. At present, due to the hardware limitations of the camera, the field of view of the camera is limited to a certain extent; when users shoot distant objects, they generally need to use a telephoto camera, but the field of view of the telephoto camera is limited to a certain extent and cannot meet the shooting needs of users in different scenes. In order to overcome this limitation, it is necessary to realize the flexible movement of the camera; at the same time, after the camera moves, if the existing anti-shake method is used for image anti-shake processing, the image anti-shake effect is poor.

[0003] Therefore, when the camera in an electronic device achieves flexible movement, how to perform image stabilization processing and improve the image stabilization effect becomes an urgent problem to be solved. Summary of the invention

[0004] The present application provides an image stabilization method and an electronic device, which can improve the image stabilization effect when a camera in the electronic device can achieve flexible movement.

[0005] In a first aspect, an image stabilization method is provided, which is applied to an electronic device, wherein the electronic device includes a first camera, and the first camera is a movable camera. The method includes:

[0006] Open the Camera app;

[0007] Acquire a first image stream captured by a first camera, where the first image stream includes multiple frames of images;

[0008] Based on any two adjacent frames of images in the first image stream, a global translation amount is obtained, wherein the global translation amount is used to characterize the translation amount of the center points of the two adjacent frames of images;

[0009] Based on the global translation amount and the time difference information, a plurality of translation postures are obtained, wherein the plurality of translation postures correspond to the plurality of frames of images one by one, one of the plurality of translation postures is used to characterize the posture of one frame of the plurality of frames of images collected by the electronic device, and the time difference information is used to represent the time difference of collecting the plurality of frames of images in the first image stream;

[0010] Based on the multiple translation postures, multiple translation compensation amounts are obtained, the multiple translation compensation amounts are used to characterize the posture differences between the multiple translation postures and the translation posture after smoothing, and the multiple translation compensation amounts correspond to the multiple frame images one by one;

[0011] Obtaining a second image stream based on the plurality of translation compensation amounts and the first image stream;

[0012] The second image stream is displayed.

[0013] In the scheme of the present application, the electronic device includes a movable camera. Through the movement of the movable camera, the problem of certain limitations of the field of view of the telephoto camera can be overcome to meet the needs of different shooting scenes; when the camera in the electronic device realizes flexible movement, through the scheme of the present application, image anti-shake processing of the image stream can be realized according to the image content of the image stream collected by the movable camera; in the scheme of the present application, there is no need to obtain data in the gyroscope sensor in the electronic device, and obtain the movement amount of the electronic device based on the data of the gyroscope sensor; in the scheme of the present application, the translation posture of the electronic device when collecting the image stream can be obtained according to the difference in image content in the image stream, thereby obtaining the movement amount of the electronic device; therefore, in the scheme of the present application, when the camera in the electronic device realizes flexible movement, image anti-shake processing can be performed through the image content of the image stream collected by the movable camera, thereby improving the anti-shake effect of the image; in addition, in the scheme of the present application, there is no need to obtain data in the gyroscope sensor in the electronic device; therefore, the scheme of the present application does not rely on the gyroscope sensor in the electronic device, and can improve the applicable scenarios of the image anti-shake method to a certain extent.

[0014] It should be noted that the data from the gyroscope sensor can only represent the rotational movement of the electronic device, but cannot represent the translational movement of the electronic device; therefore, the movement of the electronic device cannot be accurately detected through the data in the gyroscope sensor; however, whether it is the rotational movement or translational movement of the electronic device, it can be reflected in the difference in image content; therefore, the image stabilization scheme of the present application can improve the image stabilization effect to a certain extent.

[0015] It should be understood that the translation posture of the image in the first image stream can be obtained based on the pixel translation amount of the image; in the scheme of the present application, the translation posture can refer to the translation amount in the camera coordinate system or the world coordinate system obtained by the translation amount in the pixel coordinate system.

[0016] In combination with the first aspect, in some implementations of the first aspect, obtaining the second image stream based on multiple translation compensation amounts and the first image stream includes:

[0017] Based on the first motor position information, a first correction vector is obtained, where the first motor position information is the motor position information when the first camera captures the first image stream, and the first correction vector is used to perform image rotation correction on the first image stream;

[0018] Performing first image processing on the first image stream based on the first correction vector to obtain an image stream after image rotation correction;

[0019] The second image processing is performed on the image stream after the image rotation correction based on multiple translation compensation amounts to obtain a second image stream.

[0020] In the scheme of the present application, a first correction vector for image rotation correction can be obtained according to the motor position of the first camera; the first image stream can be subjected to image rotation correction processing according to the first correction vector to obtain an image stream after image rotation correction; and the image stream after image rotation correction can be subjected to EIS processing according to multiple compensation translation amounts to obtain a processed image stream.

[0021] In combination with the first aspect, in some implementations of the first aspect, performing second image processing on the image stream after image rotation correction based on multiple translation compensation amounts to obtain the second image stream includes:

[0022] An interpolation algorithm is performed on the pixel points of each image in the image stream after image rotation correction based on multiple translation compensation amounts to obtain a second image stream.

[0023] In the solution of the present application, the pixel points in each image are processed by an interpolation algorithm, which can reduce the amount of calculation of the electronic device to a certain extent.

[0024] In combination with the first aspect, in some implementations of the first aspect, obtaining the second image stream based on multiple translation compensation amounts and the first image stream includes:

[0025] Based on the first motor position information, a first correction vector is obtained, where the first motor position information is the motor position information when the first camera captures the first image stream, and the first correction vector is used to perform image rotation correction on the first image stream;

[0026] Based on the first correction vector and the plurality of translation compensation amounts, a plurality of second correction vectors are obtained;

[0027] The first image stream is subjected to third image processing based on the plurality of second correction vectors to obtain a second image stream.

[0028] In the scheme of the present application, image rotation correction and motion compensation are implemented on the first image stream through multiple second correction vectors to obtain a processed image stream; it can be understood that a warp process is performed on the pixel points of each frame of the first image stream; to a certain extent, the amount of computational complexity of EIS processing on the image stream can be reduced.

[0029] In combination with the first aspect, in some implementations of the first aspect, performing third image processing on the first image stream based on multiple second correction vectors to obtain the second image stream includes:

[0030] An interpolation algorithm is performed on pixel points in a plurality of image frames in the first image stream based on a plurality of second correction vectors to obtain a second image stream.

[0031] In the solution of the present application, the pixel points in each image are processed by an interpolation algorithm, which can reduce the amount of calculation of the electronic device to a certain extent.

[0032] In combination with the first aspect, in some implementations of the first aspect, obtaining a global translation amount based on any two adjacent frames of images in the first image stream includes:

[0033] Performing image feature point detection and feature point matching on any two adjacent frames of images in the first image stream to obtain a feature point pair;

[0034] Based on the translation between feature point pairs, the global translation is obtained.

[0035] In one implementation, the translation amounts of the feature point pairs in the two frames of images may be averaged to obtain a global translation amount between the two frames of images.

[0036] In combination with the first aspect, in some implementations of the first aspect, obtaining multiple translation compensation amounts based on multiple translation postures includes:

[0037] Smoothing the multiple translation poses to obtain multiple smoothed translation poses;

[0038] Based on the posture differences between the multiple translation postures and the multiple smoothed translation postures, multiple translation compensation amounts are obtained.

[0039] In the scheme of the present application, by smoothing multiple translation postures, it is possible to ensure that when EIS processing is performed on the images in the first image stream, the amount of motion between two adjacent image frames in the first image stream is relatively smooth, that is, the stability of the images in the image stream is ensured.

[0040] In combination with the first aspect, in certain implementations of the first aspect, after the first camera rotates, there is a first offset between a center point of a lens of the first camera and an imaging center point.

[0041] In combination with the first aspect, in some implementations of the first aspect, the first camera includes a movable telephoto camera.

[0042] In a second aspect, an electronic device is provided, the electronic device comprising: one or more processors, a memory and a first camera, the first camera being a movable camera; the memory is coupled to the one or more processors, the memory is used to store a computer program code, the computer program code comprises a computer instruction, and the one or more processors call the computer instruction to enable the electronic device to execute:

[0043] Open the Camera app;

[0044] Acquire a first image stream captured by a first camera, where the first image stream includes multiple frames of images;

[0045] Based on any two adjacent frames of images in the first image stream, a global translation amount is obtained, wherein the global translation amount is used to characterize the translation amount of the center points of the two adjacent frames of images;

[0046] Based on the global translation amount and the time difference information, a plurality of translation postures are obtained, wherein the plurality of translation postures correspond to the plurality of frames of images one by one, one of the plurality of translation postures is used to characterize the posture of one frame of the plurality of frames of images collected by the electronic device, and the time difference information is used to represent the time difference of collecting the plurality of frames of images in the first image stream;

[0047] Based on the multiple translation postures, multiple translation compensation amounts are obtained, the multiple translation compensation amounts are used to characterize the posture differences between the multiple translation postures and the translation posture after smoothing, and the multiple translation compensation amounts correspond to the multiple frame images one by one;

[0048] Obtaining a second image stream based on the plurality of translation compensation amounts and the first image stream;

[0049] The second image stream is displayed.

[0050] In conjunction with the second aspect, in some implementations of the second aspect, the one or more processors call the computer instructions to cause the electronic device to execute:

[0051] Based on the first motor position information, a first correction vector is obtained, where the first motor position information is the motor position information when the first camera captures the first image stream, and the first correction vector is used to perform image rotation correction on the first image stream;

[0052] Performing first image processing on the first image stream based on the first correction vector to obtain an image stream after image rotation correction;

[0053] The second image processing is performed on the image stream after the image rotation correction based on multiple translation compensation amounts to obtain a second image stream.

[0054] In conjunction with the second aspect, in some implementations of the second aspect, the one or more processors call the computer instructions to cause the electronic device to execute:

[0055] An interpolation algorithm is performed on the pixel points of each image in the image stream after image rotation correction based on multiple translation compensation amounts to obtain a second image stream.

[0056] In conjunction with the second aspect, in some implementations of the second aspect, the one or more processors call the computer instructions to cause the electronic device to execute:

[0057] Based on the first motor position information, a first correction vector is obtained, where the first motor position information is the motor position information when the first camera captures the first image stream, and the first correction vector is used to perform image rotation correction on the first image stream;

[0058] Based on the first correction vector and the plurality of translation compensation amounts, a plurality of second correction vectors are obtained;

[0059] The first image stream is subjected to third image processing based on the plurality of second correction vectors to obtain a second image stream.

[0060] In conjunction with the second aspect, in some implementations of the second aspect, the one or more processors call the computer instructions to cause the electronic device to execute:

[0061] An interpolation algorithm is performed on pixel points in a plurality of image frames in the first image stream based on a plurality of second correction vectors to obtain a second image stream.

[0062] In conjunction with the second aspect, in some implementations of the second aspect, the one or more processors call the computer instructions to cause the electronic device to execute:

[0063] Performing image feature point detection and feature point matching on any two adjacent frames of images in the first image stream to obtain a feature point pair;

[0064] Based on the translation between feature points, the global translation is obtained.

[0065] In conjunction with the second aspect, in some implementations of the second aspect, the one or more processors call the computer instructions to cause the electronic device to execute:

[0066] Smoothing the multiple translation poses to obtain multiple smoothed translation poses;

[0067] Based on the posture differences between the multiple translation postures and the multiple smoothed translation postures, multiple translation compensation amounts are obtained.

[0068] In combination with the second aspect, in certain implementations of the second aspect, after the first camera rotates, there is a first offset between the center point of the lens of the first camera and the imaging center point.

[0069] In combination with the second aspect, in some implementations of the second aspect, the first camera includes a movable telephoto camera.

[0070] It should be understood that the expansion, limitation, explanation and description of the relevant contents in the above-mentioned first aspect also apply to the same contents in the second aspect.

[0071] In a third aspect, an electronic device is provided, comprising: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code comprises computer instructions, and the one or more processors call the computer instructions to enable the electronic device to execute any one of the image stabilization methods in the first aspect.

[0072] In a fourth aspect, a chip system is provided. The chip system is applied to an electronic device. The chip system includes one or more processors. The processor is used to call computer instructions so that the electronic device executes any one of the image stabilization methods in the first aspect.

[0073] In a fifth aspect, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program code. When the computer program code is executed by an electronic device, the electronic device executes any one of the image stabilization methods in the first aspect.

[0074] In a sixth aspect, a computer program product is provided, the computer program product comprising: a computer program code, when the computer program code is executed by an electronic device, the electronic device executes any one of the image stabilization methods in the first aspect.

[0075] In the scheme of the present application, the electronic device includes a movable camera. Through the movement of the movable camera, the problem of certain limitations of the field of view of the telephoto camera can be overcome to meet the needs of different shooting scenes; when the camera in the electronic device realizes flexible movement, through the scheme of the present application, image anti-shake processing of the image stream can be realized according to the image content of the image stream collected by the movable camera; in the scheme of the present application, there is no need to obtain data in the gyroscope sensor in the electronic device, and obtain the movement amount of the electronic device based on the data of the gyroscope sensor; in the scheme of the present application, the translation posture of the electronic device when collecting the image stream can be obtained according to the difference in image content in the image stream, thereby obtaining the movement amount of the electronic device; therefore, in the scheme of the present application, when the camera in the electronic device realizes flexible movement, image anti-shake processing can be performed through the image content of the image stream collected by the movable camera, thereby improving the anti-shake effect of the image; in addition, in the scheme of the present application, there is no need to obtain data in the gyroscope sensor in the electronic device; therefore, the scheme of the present application does not rely on the gyroscope sensor in the electronic device, and can improve the applicable scenarios of the image anti-shake method to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS

[0076] Figure 1 is a schematic diagram of a hardware system of an electronic device applicable to the present application;

[0077] Figure 2 is a schematic diagram of an application scenario of an embodiment of the present application;

[0078] Figure 3 It is a schematic diagram of the arrangement of cameras on an electronic device;

[0079] Figure 4 It is a side view structural schematic diagram of a movable telephoto camera provided by the present application;

[0080] Figure 5 It is a schematic diagram of a side view structure of a movable telephoto camera moving around the X-axis provided by the present application;

[0081] Figure 6 It is a schematic diagram of a side view structure of another movable telephoto camera moving around the X-axis provided in an embodiment of the present application;

[0082] Figure 7 is a light path diagram of a movable telephoto camera provided in an embodiment of the present application;

[0083] Figure 8 It is a schematic diagram of a side view structure of a movable telephoto camera moving around the Y axis provided by the present application;

[0084] Fig. 9 is a schematic diagram of a side view structure of another movable telephoto camera moving around the Y axis provided in an embodiment of the present application;

[0085] Fig.10 Another optical path diagram of a movable telephoto camera provided in an embodiment of the present application;

[0086] Fig.11 is a schematic diagram of a field of view angle of a movable telephoto camera provided in an embodiment of the present application;

[0087] Fig.12 is a schematic diagram of two frames of images provided in an embodiment of the present application;

[0088] Fig.13 is a schematic diagram of the change in the field of view angle of a movable telephoto camera before and after movement provided by an embodiment of the present application;

[0089] Fig.14 is a schematic flow chart of an image stabilization method provided in an embodiment of the present application;

[0090] Fig.15 is a schematic flow chart of another image stabilization method provided in an embodiment of the present application;

[0091] Fig.16 is a schematic diagram of image feature point detection provided by an embodiment of the present application;

[0092] Fig.17 is a schematic diagram of path smoothing processing of translation compensation amount provided by an embodiment of the present application;

[0093] Fig.18 is a schematic diagram of performing electronic image stabilization processing on a pixel point provided by an embodiment of the present application;

[0094] Fig.19 is a schematic flow chart of another image stabilization method provided in an embodiment of the present application;

[0095] Fig. 20 is a schematic diagram of another change in the field of view angle of a movable telephoto camera after movement provided by an embodiment of the present application;

[0096] Fig.21 It is a schematic diagram of a coordinate system mapping relationship provided in an embodiment of the present application;

[0097] Fig. 22 is a schematic diagram of a feature point mapping provided in an embodiment of the present application;

[0098] Fig.23 is a schematic flow chart of another image stabilization method provided in an embodiment of the present application;

[0099] Fig.24 is a schematic diagram of an electronic device suitable for use in the present application;

[0100] Fig.25 is a schematic diagram of another electronic device suitable for the present application. DETAILED DESCRIPTION

[0101] In the embodiments of the present application, the following terms "first", "second", etc. are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present embodiment, unless otherwise specified, "plurality" means two or more.

[0102] First, the professional terms involved in this application are briefly described.

[0103] 1. Electronic Image Stabilization (EIS)

[0104] Electronic image stabilization can also be called electronic image stabilization. EIS technology refers to anti-shake processing based on motion sensor data. The motion between image frames in the image sequence is calculated through the data collected by the motion sensor during the exposure of each frame of the image; and the motion between image frames is corrected to generate a relatively stable image sequence.

[0105] 2. Rolling Shutter

[0106] Rolling Shutter means that at the beginning of exposure, the Sensor scans and exposes line by line until all pixels are exposed.

[0107] It should be understood that for the same image frame, if the Rolling Shutter exposure method is used, the exposure time of each line in the image is different, so the image needs to be compensated line by line; this compensation can be called Rolling Shutter correction.

[0108] Figure 1 A hardware system of an electronic device suitable for the present application is shown.

[0109] The electronic device 100 can be a mobile phone, a smart screen, a tablet computer, a wearable electronic device, an in-vehicle electronic device, an augmented reality (AR) device, a virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), a projector, etc. The embodiment of the present application does not impose any restrictions on the specific type of the electronic device 100.

[0110] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0111] It should be noted that Figure 1The structure shown does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include Figure 1 More or fewer components than those shown, or the electronic device 100 may include Figure 1 Combinations of some of the components shown, or the electronic device 100 may include Figure 1 Subassemblies of some of the components shown. Figure 1 The components shown may be implemented in hardware, software, or a combination of software and hardware.

[0112] The processor 110 may include one or more processing units. For example, the processor 110 may include at least one of the following processing units: an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and a neural-network processing unit (NPU). Different processing units may be independent devices or integrated devices.

[0113] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

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

[0115] For example, in an embodiment of the present application, the processor 110 may execute: opening a camera application; obtaining a first image stream captured by a first camera, the first image stream including multiple frames of images; obtaining a global translation based on any two adjacent frames of images in the first image stream, wherein the global translation is used to characterize the translation of the center points of the two adjacent frames of images; obtaining multiple translation postures based on the global translation and time difference information, wherein the multiple translation postures correspond one-to-one to the multiple frames of images, one of the multiple translation postures is used to characterize the posture of one frame of the multiple frames of images captured by the electronic device, and the time difference information is used to represent the time difference in capturing the multiple frames of images in the first image stream; obtaining multiple translation compensation amounts based on the multiple translation postures, the multiple translation compensation amounts are used to characterize the posture differences between the multiple translation postures and the smoothed translation postures, and the multiple translation compensation amounts correspond one-to-one to the multiple frames of images; obtaining a second image stream based on the multiple translation compensation amounts and the first image stream; and displaying the second image stream.

[0116] Figure 1 The connection relationship between the modules shown is only a schematic illustration and does not constitute a limitation on the connection relationship between the modules of the electronic device 100. Optionally, the modules of the electronic device 100 may also adopt a combination of multiple connection modes in the above embodiments.

[0117] The wireless communication function of the electronic device 100 can be implemented through components such as the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor.

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

[0119] The electronic device 100 can realize the display function through the GPU, the display screen 194 and the application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.

[0120] Exemplarily, the motor 191 can generate vibrations. The motor 191 can be used for incoming call reminders or for touch feedback. The motor 191 can generate different vibration feedback effects for touch operations acting on different applications. The motor 191 can also generate different vibration feedback effects for touch operations acting on different areas of the display screen 194. Different application scenarios (for example, time reminders, receiving messages, alarm clocks, and games) can correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0121] For example, the display screen 194 may be used to display images or videos.

[0122] Exemplarily, the electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.

[0123] Exemplarily, the ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens, and the light signal is converted into an electrical signal. The camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can perform algorithmic optimization on the noise, brightness and color of the image. The ISP can also optimize the exposure and color temperature of the shooting scene and other parameters. In some embodiments, the ISP can be set in the camera 193.

[0124] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard red green blue (RGB), YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0125] Exemplarily, the gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., the x-axis, the y-axis, and the z-axis) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used in scenes such as navigation and somatosensory games.

[0126] Exemplarily, in an embodiment of the present application, the gyro sensor 180B may be used to collect jitter information, and the jitter information may be used to indicate changes in the posture of the electronic device during shooting.

[0127] For example, the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally the x-axis, y-axis, and z-axis). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. The acceleration sensor 180E can also be used to identify the posture of the electronic device 100 as an input parameter for applications such as horizontal and vertical screen switching and pedometers.

[0128] Exemplarily, the distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, for example, in a shooting scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.

[0129] Exemplarily, the ambient light sensor 180L is used to sense the brightness of the ambient light. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.

[0130] Figure 2 This is a schematic diagram of the image stream obtained with image stabilization turned on and turned off for the same shooting scene provided by an embodiment of the present application.

[0131] like Figure 2 As shown, Figure 2 The image stream shown in (a) may represent an image stream obtained by the electronic device with image stabilization turned off; Figure 2 The image stream shown in (b) in FIG. 1 may represent an image stream obtained after the electronic device turns on image stabilization; Figure 2 (a) and Figure 2As can be seen from (b) in the figure, after image stabilization is turned on in the electronic device, the stability of the image stream can be improved, large jitters between image frames in the image stream can be avoided, and a relatively stable image stream can be generated.

[0132] Figure 3 A schematic diagram showing the arrangement of a camera 193 on an electronic device is shown.

[0133] Exemplarily, the electronic device provided in the present application may include one or more cameras 193, which may be located on the front of the electronic device 100 or on the back of the electronic device 100. The camera 193 located on the front of the electronic device 100 may be referred to as a front camera, and the camera located on the back of the electronic device 100 may be referred to as a rear camera. In the present application, a camera may also be referred to as a camera module.

[0134] For example, in the embodiment of the present application, the electronic device 100 may include five cameras 193, including two front cameras and three rear cameras. Figure 3 (a) and Figure 3 As shown in (b), the three rear cameras are arranged in a row from top to bottom on the back cover of the electronic device 100, and in the order of arrangement, the three rear cameras are respectively a main camera 1931, a telephoto camera 1932 and a wide-angle camera 1933.

[0135] Among them, the focal length of the wide-angle camera 1933 is shorter than that of the main camera 1931, and the focal length of the telephoto camera 1932 is longer than that of the main camera 1931. Because the longer the focal length, the smaller the field of view angle, the field of view angle range corresponding to the wide-angle camera 1933 is larger than that of the main camera 1931, and the field of view angle range corresponding to the telephoto camera 1932 is smaller than that of the main camera 1931.

[0136] It should be understood that the above is only an example, and the electronic device 100 may also include other types of cameras, such as an ultra-wide-angle camera, a black and white camera, a multi-spectral camera, etc., which is not limited in this application.

[0137] For example, Figure 4 A side view structural schematic diagram corresponding to a movable telephoto camera 1932 provided in the present application is shown.

[0138] like Figure 4As shown, the movable telephoto camera includes an optical lens, an OIS controller, a motor assembly including a prism, and a photosensitive element, wherein the plane where the photosensitive element is located is perpendicular to the plane where the lens included in the optical lens is located; in addition, the prism in the motor assembly is arranged in an inclined state, so that the light emitted by the optical lens can be refracted onto the photosensitive element; on this basis, the motor in the motor assembly can also control the rotation of the prism to offset the light path emitted by the optical lens, thereby expanding the field of view angle range of the shooting. The motor assembly can also include a motor, which is used to drive the motor. Here, it should be noted that the motor in the motor assembly is not the same motor as the OIS motor in the OIS controller.

[0139] In some embodiments, reference Figure 5 (a) and Figure 5 As shown in (b) of Figure 5 Taking the coordinate system shown in (a) in FIG. 1 as an example, the motor in the motor assembly can control the cube structure where the prism is located to rotate up and down around the x-axis, that is, nod, to expand the field of view in the z-axis direction. Figure 6 As shown in (a), the dotted line position indicates the initial position of the prism, and the motor can rotate the prism around the x-axis and in the positive direction of the z-axis to expand the field of view in the positive direction of the z-axis; or Figure 6 As shown in (b), the motor can also rotate the prism around the x-axis and toward the negative direction of the z-axis to expand the field of view in the negative direction of the z-axis.

[0140] Figure 7 Shows Figure 6 The schematic diagram of the optical path when the prism shown in (a) moves in the nodding direction. Figure 7 As shown in the figure, when the prism does not move, the two incident light rays are reflected by the prism and the image points on the photosensitive element are P and Q respectively. Figure 7 The nodding direction shown in Figure 7 When the prism is in the middle position, the same two incident light rays are reflected by the prism, and the imaging points on the photosensitive element are P' and Q' respectively. Before and after the movement, P' corresponds to P, and Q' corresponds to Q.

[0141] Here, it should be noted that since the nodding motion is in the plane of the optical path, when the prism is nodding, both P and Q will be displaced, and the displacements are almost equal. Therefore, the length of the line segment PQ before the nodding motion is basically equal to the length of the line segment P'Q' after the nodding motion. Therefore, when nodding, the image will not shake in the y-axis direction, that is, there will be no image rotation problem and no other distortion.

[0142] In other embodiments, reference Figure 8 (a) and Figure 8In (b), Figure 8 Taking the coordinate system shown in (a) in the figure as an example, the motor in the motor assembly can control the cube structure where the prism is located to rotate left and right around the y-axis, that is, to shake the head, so as to expand the field of view in the x-axis direction. Fig. 9 As shown in (a), the dotted line position indicates the initial position of the prism, and the motor can rotate the prism around the y-axis and in the positive direction of the x-axis to expand the field of view in the positive direction of the x-axis; or Fig. 9 As shown in (b), the motor can also rotate the prism around the y-axis and toward the negative direction of the x-axis to expand the field of view in the negative direction of the y-axis.

[0143] See for example Fig.10 , Fig.10 Shows Fig. 9 The schematic diagram of the optical path when the prism shown in (a) moves in the shaking direction. Fig.10 As shown in the figure, the incident light and the reflected light are symmetrical about the optical axis. When the prism rotates, the optical axis will also rotate. When the prism shakes, such as shaking the θ angle, the horizontal coordinate of the incident point on the prism surface will also change slightly, resulting in a change in the optical path, causing the reflection angle to change. The change in the reflection angle will cause the image to rotate about θ angle in the x-axis direction and Δ angle in the y-axis direction (crosstalk).

[0144] like Fig.10 As shown in the figure, when the prism is not moving, an incident light ray is reflected by the prism and the imaging point on the photosensitive element is P2. Fig.10 The shaking direction shown moves to Fig.10 When the prism' is in the position shown, the same incident light is reflected by the prism' and the image point on the photosensitive element is P2'. Here, before and after the prism moves, P2 and P2' are coplanar, but the P2P2' line segment is not parallel to the x-axis or the y-axis. In other words, the image point moves obliquely in the xy plane before and after the movement.

[0145] Furthermore, before the prism rotates, if the incident point of one of the two incident light rays is O1 (assuming it is the center of the prism), the corresponding imaging point on the photosensitive element is P1; the incident point of the other light ray is O2 (assuming it is not the center of the prism), and the corresponding imaging point on the photosensitive element is P2. After the prism rotates by an angle θ, the imaging point of the incident point O1 on the photosensitive element is P1', and the imaging point of the incident point O2 on the photosensitive element is P2'. Due to the change in the optical path, the image rotates less at O1 and more at O2, which will cause the translation amount corresponding to the change from P1 to P1' to be different from the translation amount corresponding to the change from P2 to P2'.

[0146] For example, using Figure 4The change of the field of view angle when the movable telephoto camera is used for shooting is shown in FIG. Fig.11 As shown; the initial field of view angle range corresponding to the telephoto camera is FOV0, and the initial field of view range is a rectangle; when the motor assembly is turned on and the prism is controlled to nod and the movement amplitude is the largest, the field of view angle range corresponding to the telephoto camera can change upward to FOV1 or downward to FOV2; when the motor assembly is turned on and the prism is controlled to shake its head and the movement amplitude is the largest, the field of view angle range corresponding to the telephoto camera can change to the left to FOV3 or to the right to FOV4. When the motor assembly is turned on and the prism is controlled to perform both nodding and shaking movements (the order is not limited), the field of view angle range corresponding to the telephoto camera can change to FOV5 in the upper right corner, to FOV6 in the lower right corner, to FOV7 in the lower left corner, or to FOV8 in the upper left corner, etc.

[0147] If the angle of rotation when the motor assembly controls the prism to nod and shake is small, the FOV that the telephoto camera can achieve is within the field of view range of FOV3 to FOV8. In addition, by superimposing all FOVs, the maximum FOV that the telephoto camera can achieve can be obtained. The maximum FOV is much larger than the initial field of view angle range FOV0, that is, the telephoto camera can achieve an expanded field of view angle range when the motor controls the prism to rotate.

[0148] Here, for Fig.11 It should also be noted that when the motor is turned to control the prism to nod, there will be no image rotation in the y-axis direction, and there will be no other distortion; therefore, the shapes of FOV1 and FOV2 remain basically unchanged relative to FOV0, and they are still horizontally and vertically straight rectangles. When the motor is turned to control the prism to shake its head, image rotation will occur. Therefore, FOV3 to FOV8 have changed relative to FOV0, which can be regarded as translation + rotation. For this reason, when imaging, the images corresponding to FOV3 to FOV8 captured by the telephoto camera are all images with image rotation problems.

[0149] For example, Fig.12 Figure 2 shows two frames of images taken using a telephoto camera. Fig.12 As shown in (a), it is a playing card image taken before the rotating motor in the telephoto camera moves. The characters and graphics in the image can be displayed normally. Fig.12 As shown in (b), it is a playing card image taken after the rotating motor in the telephoto camera shakes its head, and the characters and graphics in the image have image rotation problems.

[0150] In addition, the field of view angle range can be expanded by using a movable telephoto camera, but when the movable camera moves, the field of view angle of the electronic device will change; for example, the initial position of the movable telephoto camera is as follows: Fig.13 As shown in (a) in FIG. 1 , the field of view of the electronic device is FOV1. Fig.13 As shown in (b) in FIG. 1 ; if the movable telephoto camera is moved to Fig.13 At the position shown in (c) in FIG. 1 , the field of view of the electronic device is FOV2, as shown in FIG. Fig.13 As shown in (d) in FIG. 1 , it can be seen that if the movable telephoto camera in the electronic device moves, the field of view of the camera in the electronic device will change, and there may be an image rotation problem; at this time, if the electronic device is shooting a video, it will cause image jumps between image frames in the video, and a relatively stable video cannot be generated.

[0151] At present, when users shoot distant objects, they generally need to use a telephoto camera. However, the field of view of a telephoto camera has certain limitations and cannot meet the shooting needs of users in different scenes. In order to overcome this limitation, it is necessary to realize flexible movement of the camera. At the same time, after the camera moves, if the existing anti-shake method is used for image anti-shake processing, the image anti-shake effect is poor.

[0152] In view of this, an embodiment of the present application provides a method for image stabilization and an electronic device, wherein the electronic device includes a first camera, wherein the first camera is a movable camera, and the method includes: starting a camera application; obtaining a first image stream captured by the first camera, wherein the first image stream includes multiple frames of images; based on any two adjacent frames of images in the first image stream, obtaining a global translation amount, wherein the global translation amount is used to characterize the translation amount of the center points of the two adjacent frames of images; based on the global translation amount and time difference information, obtaining multiple translation postures, wherein the multiple translation postures correspond one-to-one to the multiple frames of images, and one of the multiple translation postures is used to characterize the posture of one frame of the multiple frames of images captured by the electronic device, and the time difference information is used to represent the time difference of capturing the multiple frames of images in the first image stream; based on the multiple translation postures, obtaining multiple translation compensation amounts, wherein the multiple translation compensation amounts are used to characterize the posture differences between the multiple translation postures and the smoothed translation postures, and the multiple translation compensation amounts correspond one-to-one to the multiple frames of images; based on the multiple translation compensation amounts and the first image stream, obtaining a second image stream; and displaying the second image stream. In the scheme of the present application, the translation posture of the electronic device when collecting the image stream can be obtained according to the difference in the image content in the image stream, thereby obtaining the movement amount of the electronic device; therefore, in the scheme of the present application, when the camera in the electronic device realizes flexible movement, the image content of the image stream collected by the movable camera can be used for image stabilization processing to improve the image stabilization effect; in addition, the scheme of the present application does not need to obtain data from the gyroscope sensor in the electronic device; therefore, the scheme of the present application does not rely on the gyroscope sensor in the electronic device, and can improve the applicable scenarios of the image stabilization method to a certain extent.

[0153] Combine the following Figures 14 to 23 A schematic flowchart of the image stabilization method provided in an embodiment of the present application is described in detail.

[0154] Fig.14 is a schematic flow chart of an image anti-shake method provided by an embodiment of the present application. The method 200 may be Figure 1 The electronic device shown is executed; the method 200 includes S210 to S260, and S210 to S260 are described in detail below.

[0155] S210, turning on the movable camera.

[0156] Exemplarily, the movable camera may include a movable telephoto camera; the structure and working principle of the movable telephoto camera are as follows: Figures 4 to 11 As shown, no further description is given here.

[0157] S220: Collect Raw image stream.

[0158] Exemplarily, the Raw image stream may refer to an original image stream captured by a movable camera; the Raw image stream may refer to an image stream in a Raw domain; or, an image stream in a Raw color space.

[0159] S230 , performing image processing on the Raw image stream to obtain a YUV image stream.

[0160] Exemplarily, the image processing may include a related algorithm for converting a Raw image captured by the movable camera into a YUV image; the present application does not impose any limitation on the algorithm.

[0161] For example, image processing may refer to an image processing algorithm executed in the ISP to convert a Raw image into a YUV image.

[0162] In the solution of the present application, the movement of the movable camera may cause image rotation problems in the captured image stream; in one implementation, the YUV image stream may be first subjected to image rotation correction processing, and then the image rotation corrected image stream may be subjected to EIS processing, such as Fig.15 As shown; in another implementation, the YUV image stream can be subjected to image rotation correction processing and EIS processing at the same time; for example, the image correction matrix can be obtained according to the difference between the image rotation correction matrix and the content of two adjacent frames of images in the YUV image stream; the image rotation correction processing and EIS processing are performed on the images in the YUV image stream through the image correction matrix, as shown in FIG. Fig.19 shown.

[0163] S240 , obtaining a plurality of image correction matrices based on the image contents of two adjacent frames of YUV images in the YUV image stream.

[0164] In an embodiment of the present application, an image correction matrix can be obtained by using the difference in image content between two adjacent frames of images in an image stream; the image correction matrix is ​​used to perform anti-shake processing on the image frames in the image stream; through the method of the present application, it is possible to implement image anti-shake processing based on the difference in image content between two adjacent frames of images in the collected image stream without having to obtain data from a gyroscope sensor in an electronic device.

[0165] Optionally, assume that the YUV image stream includes N frames of images; image correction matrix 1 can be obtained based on the image content of the first frame image and the image content of the second frame image; image correction matrix 2 can be obtained based on the image content of the second frame image and the image content of the third frame image; similarly, image correction matrix N-1 can be obtained based on the N-2 frame image and the N-1 frame image; image correction matrix N can be obtained based on the image content of the N-1 frame image and the image content of the N frame image.

[0166] S250 , performing EIS processing on the YUV image stream based on multiple image correction matrices to obtain a processed image stream.

[0167] Exemplarily, assume that the YUV image stream includes N frames of images; according to S240, N image correction matrices can be obtained; image correction matrix 1 can be applied to the second frame of image to obtain the processed second frame of image; image correction matrix 2 is applied to the third frame of image to obtain the processed third frame of image; similarly, image correction matrix N is applied to the Nth frame of image to obtain the processed Nth frame of image; according to the first frame of image, the processed second frame of image, the processed third frame of image, to the processed Nth frame of image, the processed image stream is obtained.

[0168] S260: Display the processed image stream.

[0169] Exemplarily, the processed image stream may be displayed in an electronic device.

[0170] Optionally, in one implementation, the processed image stream may be saved, and after detecting an operation of viewing the image stream, the electronic device may display the processed image stream.

[0171] In an embodiment of the present application, the electronic device includes a movable camera. Through the movement of the movable camera, the problem that the field of view of the telephoto camera has certain limitations can be overcome to meet the needs of different shooting scenes; when the camera in the electronic device realizes flexible movement, through the scheme of the present application, image anti-shake processing of the image stream can be realized according to the image content of the image stream collected by the movable camera; in the scheme of the present application, it is not necessary to obtain data in the gyroscope sensor in the electronic device, and obtain the movement amount of the electronic device based on the data of the gyroscope sensor; in the scheme of the present application, the translation posture of the electronic device when collecting the image stream can be obtained according to the difference in image content in the image stream, thereby obtaining the movement amount of the electronic device; therefore, in the scheme of the present application, when the camera in the electronic device realizes flexible movement, image anti-shake processing can be performed through the image content of the image stream collected by the movable camera to improve the anti-shake effect of the image; in addition, in the scheme of the present application, it is not necessary to obtain data in the gyroscope sensor in the electronic device; therefore, the scheme of the present application does not rely on the gyroscope sensor in the electronic device, and can improve the applicable scenarios of the image anti-shake method to a certain extent.

[0172] Implementation method 1

[0173] In one implementation, the YUV image stream may be subjected to image rotation correction processing to obtain an image rotation corrected image stream; then, according to the image content difference between adjacent image frames in the image rotation corrected image stream, EIS processing may be performed to obtain a processed image stream; Fig.15 shown.

[0174] Fig.15is a schematic flow chart of an image anti-shake method provided by an embodiment of the present application. The method 300 may be Figure 1 The electronic device shown is executed; the method 300 includes S301 to S309, and S301 to S309 are described in detail below.

[0175] S301, the movable camera collects a Raw image stream.

[0176] The movable camera includes a movable telephoto camera; the Raw image stream may refer to raw image data collected by the movable camera.

[0177] It should be understood that the Raw image stream is the original data collected by the movable camera; the original data includes more image information.

[0178] It should also be understood that before and after the movable camera moves, there is a certain offset between the center of the lens of the movable camera and the imaging center.

[0179] Exemplarily, the movable camera may be a movable telephoto camera, such as Figure 4 As shown; the working principle of the movable telephoto camera is as follows Figures 5 to 11 shown; no further description is given here.

[0180] S302: Perform front-end processing on the Raw image stream to obtain a YUV image stream.

[0181] Optionally, the front-end processing may include a related algorithm for converting the acquired Raw image into a YUV image; this application does not impose any limitation on the algorithm.

[0182] Exemplarily, the front-end processing may refer to an image processing algorithm for converting a Raw image into a YUV image executed in the ISP.

[0183] S303 , performing image rotation correction processing on the YUV image stream based on the image rotation correction matrix to obtain an image rotation corrected image stream.

[0184] For example, the image frames in the image stream before the image rotation correction process are as follows: Fig.12 As shown in (b) in FIG. 1 ; the image frame in the image stream after image rotation correction is as follows Fig.12 As shown in (a) in .

[0185] Optionally, an image rotation correction matrix may be obtained according to the rotation amount of the movable camera and a pre-constructed position vector.

[0186] It can be understood that the movement of the prism is driven by the rotary motor, and there is a corresponding relationship between the position of the rotary motor and the angle of the prism movement. The rotary motor is driven by a motor, and when the motor drives the rotary motor to drive the prism to move, it will output a digital signal, that is, each digital signal can identify a position of the rotary motor. For the sake of convenience, this embodiment refers to the digital signal output by the motor as a scan code (using a New scan code to identify the current position of the rotary motor). Since there is a corresponding relationship between the position of the rotary motor and the angle of the prism movement, and the scan code has a corresponding relationship with the position of the rotary motor, there is a corresponding relationship between the scan code and the angle of the prism movement.

[0187] Accordingly, after determining the rotation vector and translation vector of each shooting point relative to the initial position, the scan code corresponding to each shooting point and the determined rotation vector and translation vector of the shooting point relative to the initial position can be saved, thereby obtaining the position vector table mentioned in each embodiment of the present application, and its form can be, for example, as shown in Table 1.

[0188] Table 1

[0189] Shooting point scan code Rotation Vector Translation Vector Point 1 Code1 R1 T1 Point2 Code2 R2 T2 Point3 Code3 R3 T3 Point 4 Code4 R4 T4 Point5 Code5 R5 T5 ... ... ... ... Point24 Code24 R24 T24

[0190] It should be understood that Table 1 is only an example listed for better understanding of the technical solution of this embodiment, and is not the only limitation to this embodiment.

[0191] It should be noted that after the movable camera rotates, the field of view of the image captured by the movable camera will change, and the correction matrix used in processing the image captured by the movable camera will also change due to the rotation of the movable camera.

[0192] Optionally, the above is an example of image rotation correction processing; any existing image rotation correction processing method can be adopted, and the present application does not impose any limitation on this.

[0193] S304 , performing feature point detection and matching on two adjacent frames of images in the image rotation-corrected image stream to obtain a feature point pair.

[0194] For example, for the first frame image and the second frame image in two adjacent frames of images, image feature point detection can be performed respectively; the feature points in the two frames of images are paired to obtain feature point pairs; wherein the feature points can refer to key points in the image, such as Fig.16 (a) and Fig.16 As shown in (b), it represents a pair of feature points.

[0195] Optionally, the image feature point detection may adopt any existing image feature point detection algorithm, and this application does not impose any limitation on this.

[0196] S305 : Obtain a global translation amount of a frame of image based on the translation amounts between feature point pairs.

[0197] Exemplarily, the first frame of two adjacent frames in the image stream includes feature points P11 to P1N, and the second frame includes feature points P12 to P2N, and the feature points P11 to P1N correspond to the feature points P12 to P2N one by one; for example, based on the translation between feature point P11 and feature point P12, translation 1 can be obtained; based on the translation between feature point P12 and feature point P22, translation 2 can be obtained; similarly, based on the translation between feature point P1N and feature point P2N, translation N can be obtained; the N translations are averaged, and the obtained translation is the global translation; the global translation can refer to the global translation vector of the second frame relative to the first frame with the first frame as the reference.

[0198] Optionally, the image stream includes N frames of images, and S304 and S305 can be indicated for any two adjacent frames of the N frames of images to obtain N-1 global translation amounts; for example, assuming that the image stream includes 5 frames of images; based on the 1st frame of image and the 2nd frame of image, a global translation vector 1 can be obtained; global translation vector 1 is used to represent the global translation amount of the 2nd frame of image relative to the 1st frame of image; based on the 2nd frame of image and the 3rd frame of image, a global translation vector 2 can be obtained; global translation vector 2 is used to represent the global translation amount of the 3rd frame of image relative to the 2nd frame of image; based on the 3rd frame of image and the 4th frame of image, a global translation vector 3 can be obtained; global translation vector 3 is used to represent the global translation amount of the 4th frame of image relative to the 3rd frame of image; based on the 4th frame of image and the 5th frame of image, a global translation vector 4 can be obtained; global translation vector 4 is used to represent the global translation amount of the 5th frame of image relative to the 4th frame of image.

[0199] It should be understood that the above description uses the example that the image stream includes 5 frames of images, and the present application does not impose any limitation on the number of images in the image stream.

[0200] S306: Based on the initial posture, the global translation amount and the time difference information, a plurality of translation postures are obtained.

[0201] Among them, the initial position can refer to the posture of the first frame image in the YUV image stream collected by the electronic device; the global translation can be used to represent the translation of the center points of two adjacent frames of images; according to the posture of the collected first frame image, the global translation and time difference information of multiple frames of images, the translation posture corresponding to each frame image in the YUV image stream collected by the electronic device can be obtained, and the translation posture can be regarded as the translation posture before optimization.

[0202] Optionally, a plurality of translation postures may be smoothed to obtain a virtual translation posture; the virtual translation posture may refer to the translation posture after smoothing; the translation posture after smoothing may be regarded as an optimized translation posture.

[0203] Exemplarily, the smoothed virtual translation poses corresponding to the plurality of translation poses may be determined by using a translation pose estimation algorithm and a path planning algorithm.

[0204] It should be understood that in the embodiments of the present application, smoothing of multiple translation postures can ensure that when the images in the image stream are subjected to EIS processing, the amount of motion between two adjacent image frames in the image stream is relatively smooth, that is, the stability of the images in the image stream is ensured.

[0205] For example, Fig.17 The image stream 1 in the figure represents the image stream obtained according to the global translation before smoothing; the image stream 2 represents the image stream obtained according to the virtual global translation of multiple frames of images; wherein, the image stream 1 can be regarded as the image stream before smoothing the global translation, and the image stream 2 can be regarded as the image stream after smoothing the global translation.

[0206] S307 , obtaining translation compensation amounts of multiple frames of images in the image stream based on differences between the multiple translation postures and the processed virtual translation posture.

[0207] For example, Fig.17As shown, image stream 1 and image stream 2 include i frames of images; wherein image stream 1 represents the image stream collected by the electronic device in the translation posture before optimization; image stream 2 represents the image stream collected by the electronic device in the virtual translation posture after optimization; for example, according to the global translation amount between the first frame image and the second frame image, and the time difference between the two frames of images (for example, 33.33ms), the translation posture of the second frame image is obtained; similarly, the translation posture of each frame image collected by the electronic device can be obtained, and the translation posture before optimization can be obtained; the translation posture before optimization can be smoothed by the path constraint algorithm to obtain the optimized virtual translation posture; wherein the optimized virtual translation posture corresponds one-to-one to the translation posture before optimization; through a translation before optimization The translation compensation amount of a frame of image can be obtained by comparing the pose and an optimized virtual translation pose; for example, according to the difference between the feature points in the first frame of image in image stream 1 and the feature points in the first frame of image in image stream 2, the translation compensation amount 1 (ΔL1) can be obtained; according to the difference between the feature points in the second frame of image in image stream 1 and the feature points in the second frame of image in image stream 2, the translation compensation amount 2 (ΔL2) can be obtained; according to the difference between the feature points in the third frame of image in image stream 1 and the feature points in the third frame of image in image stream 2, the translation compensation amount 3 (ΔL3) can be obtained; similarly, according to the difference between the feature points in the i-th frame of image in image stream 1 and the feature points in the i-th frame of image in image stream 2, the translation compensation amount i is obtained.

[0208] S308 , performing EIS processing on the image rotation correction image stream based on the translation compensation amounts of the multiple frames of images in the image stream to obtain a processed image stream.

[0209] In one implementation, the image rotation correction image may be compensated according to the translation compensation amount of any one frame of the multiple frames of images to obtain a processed image.

[0210] In another implementation, the image rotation correction image may be subjected to EIS processing according to the translation compensation amount through the grid points to obtain a processed image.

[0211] In the embodiments of the present application, grid points can be used to process pixel points in an image using an interpolation algorithm with different weights based on preset positions, which can effectively reduce the amount of calculation to a certain extent; in addition, if the images in the image stream are collected using a line-by-line exposure method, there may be a Rolling shutter problem in the image due to the difference in exposure time of different rows; performing EIS processing on the image rotation corrected image according to the translation compensation amount through grid points can also achieve Rolling shutter correction in the image.

[0212] For example, Fig.18As shown, the image rotation correction matrix can be used to transform the grid points before deformation into the grid points after deformation; the grid point displacement between the grid points before deformation and the grid points after deformation can be compensated by the translation compensation amount; thereby, the mapping from the input image to the output image is realized according to the grid points after deformation, and the processed output image is obtained. Fig.18 (a) in the figure represents the grid points corresponding to the first frame image. Fig.18 (b) in the figure represents the grid point corresponding to the second frame image; wherein O1 represents the center point of the grid point of the first frame image, and O2 represents the center point of the grid point of the second frame image; the global translation amount can represent the offset between the center point O1 of the first frame image and the center point O2 of the second frame image. By adopting the grid points, the translation amount between the corresponding rows in the two adjacent frames of images can be obtained according to the translation amount and the time difference from the center point of the previous frame image to the center point of the next frame image through the interpolation algorithm; for example, if a certain area in the image is located in a grid point area, the translation compensation amount of the pixel point position can be obtained based on the weighted coefficient of the four vertices of the grid point; because the grid points are used, only the translation compensation amount of the vertex position needs to be calculated, and the translation compensation amount of the pixel in the image is obtained by the interpolation method, which can reduce the amount of calculation to a certain extent.

[0213] S309: Display the processed image stream.

[0214] It should be understood that the processed image stream may be a relatively stable image stream generated after EIS processing.

[0215] Exemplarily, the processed image stream may be displayed in an electronic device.

[0216] Optionally, in one implementation, the processed image stream may be saved, and after detecting an operation of viewing the image stream, the electronic device may display the processed image stream.

[0217] In an embodiment of the present application, the electronic device includes a movable camera. Through the movement of the movable camera, the problem that the field of view of the telephoto camera has certain limitations can be overcome to meet the needs of different shooting scenes; when the camera in the electronic device realizes flexible movement, through the scheme of the present application, image anti-shake processing of the image stream can be realized according to the image content of the image stream collected by the movable camera; in the scheme of the present application, it is not necessary to obtain data in the gyroscope sensor in the electronic device, and obtain the movement amount of the electronic device based on the data of the gyroscope sensor; in the scheme of the present application, the translation posture of the electronic device when collecting the image stream can be obtained according to the difference in image content in the image stream, thereby obtaining the movement amount of the electronic device; therefore, in the scheme of the present application, when the camera in the electronic device realizes flexible movement, image anti-shake processing can be performed through the image content of the image stream collected by the movable camera to improve the anti-shake effect of the image; in addition, in the scheme of the present application, it is not necessary to obtain data in the gyroscope sensor in the electronic device; therefore, the scheme of the present application does not rely on the gyroscope sensor in the electronic device, and can improve the applicable scenarios of the image anti-shake method to a certain extent.

[0218] Implementation method 2

[0219] In one implementation, the YUV image stream may be first subjected to image rotation correction processing to obtain an image rotation corrected image stream; then, EIS processing may be performed based on the image content difference between adjacent image frames in the image rotation corrected image stream to obtain a processed image stream; Fig.19 shown.

[0220] Fig.19 is a schematic flow chart of an image anti-shake method provided by an embodiment of the present application. The method 400 may be Figure 1 The electronic device shown is executed; the method 400 includes S401 to S409, and S401 to S409 are described in detail below.

[0221] S401, the movable camera collects a Raw image stream.

[0222] Optionally, the implementation can be found in Fig.14 S220, or Fig.15 The relevant description of S301 will not be repeated here.

[0223] For example, Fig. 20As shown in (a), when the electronic device is in posture 1, the N-1th frame image is collected; the electronic device moves and collects the Nth frame image in posture 2; due to the movement of the electronic device, the position of the same feature point in the two frames of image is offset; for example, due to the movement of the electronic device, point A1 of the N-1th frame image is offset to point A2 of the Nth frame image, and the offset is L; optionally, the movement of the electronic device from posture 1 to posture 2 may include rotational movement and translational movement; wherein, it can be achieved by Fig. 20 (b) in the figure represents the translational motion of the electronic device; Fig. 20 (c) in the figure represents the rotational motion of the electronic device; Fig. 20 As shown in (b) of FIG. 1 , the offset caused by the translational motion of the electronic device is L1; Fig. 20 As shown in (c) in FIG. 1 , the offset caused by the rotational motion of the electronic device is L2.

[0224] S402: Perform front-end processing on the Raw image stream to obtain a YUV image stream.

[0225] Optionally, see Fig.15 The relevant description of S302 will not be repeated here.

[0226] S403: Perform image feature point detection and matching processing on two adjacent frames of images in the image stream to obtain feature point pairs.

[0227] Optionally, see Fig.15 The relevant description of S304 will not be repeated here.

[0228] S404: Calculate the image rotation correction matrix.

[0229] Optionally, an image rotation correction matrix may be obtained according to the rotation amount of the movable camera and a pre-constructed position vector.

[0230] Optionally, the implementation can be found in Fig.15 The relevant description of S303 will not be repeated here.

[0231] S405 . Based on the image rotation correction matrix, coordinate mapping is performed on the positions of the feature point pairs to obtain a global translation amount.

[0232] For example, Fig.21 (a) shows the image coordinate system before the movable camera moves; Fig.21 (b) in FIG. 1 shows the image coordinate system after the movable camera moves; Fig.21 As shown in (b) in FIG. 1 , after the movable camera moves, the image content may have an image rotation problem in the image. The reason for the image rotation problem is that the coordinate system changes after the movable camera moves. For example, Fig.21 As shown in (c) in FIG. 1 , the movable camera has an image rotation angle before and after the movement (for example, the image rotation angle is (0, 0, θz)); through the image rotation angle, the image rotation angle can be used to Fig.21 The image captured by the pose (b) is mapped to coordinates. Fig. 22 As shown, the feature point P represents the electronic device in Fig.21 The feature points in the image captured in the posture shown in (b) are mapped according to the image rotation correction matrix (for example, the rotation angle) to obtain the mapped feature points P'.

[0233] In an embodiment of the present application, image feature point detection can be performed on the image in the image stream first, and then the feature point pairs in the image stream can be coordinate mapped based on the image rotation correction matrix; it can be understood that the key points in the image stream are coordinate mapped; compared with the coordinate mapping of the pixel points of each frame of the image in the image stream, the solution of the present application can reduce the computational complexity of the electronic device to a certain extent.

[0234] Optionally, see Fig.15 The relevant description of S305 will not be repeated here.

[0235] Optionally, in an embodiment of the present application, S403 may be executed first, and then S404; or, S404 may be executed first, and then S403.

[0236] S406: Based on the initial posture, the global translation amount and the time difference information, a plurality of translation postures are obtained.

[0237] Optionally, see Fig.15 The relevant description of S306 will not be repeated here.

[0238] S407: Obtain translation compensation amounts for multiple frames of images in the image stream based on differences between the multiple translation postures and the processed virtual translation posture.

[0239] Optionally, see Fig.15 The relevant description of S305 will not be repeated here.

[0240] S408 , performing EIS processing on the YUV image stream based on the translation compensation amounts of multiple frames of images in the image stream to obtain a processed image stream.

[0241] It should be understood that in implementation method two, the correction matrix corresponding to the translation compensation amount includes image rotation correction and motion compensation; the difference between implementation method two and implementation method one is that in implementation method two, image rotation correction and motion compensation of the YUV image stream are implemented through a correction matrix to obtain a processed image stream; it can be understood that in implementation method two, the YUV image stream is warped once according to the compensation translation amount; in implementation method one, image rotation correction and motion compensation are respectively implemented through two correction matrices to obtain a processed image stream; it can be understood that in implementation method one, the YUV image stream needs to be warped twice; wherein, the first warp processing is used to perform image rotation correction processing on the YUV image stream; the second warp processing is used to perform motion compensation on the image stream after the image rotation correction; since the warp processing needs to traverse each pixel in the image, implementation method two can reduce the amount of computational complexity of EIS processing on the image stream to a certain extent compared with implementation method one.

[0242] S409: Display the processed image stream.

[0243] Optionally, see Fig.15 The relevant description of S309 will not be repeated here.

[0244] In an embodiment of the present application, the electronic device includes a movable camera. Through the movement of the movable camera, the problem that the field of view of the telephoto camera has certain limitations can be overcome to meet the needs of different shooting scenes; when the camera in the electronic device realizes flexible movement, through the scheme of the present application, image anti-shake processing of the image stream can be realized according to the image content of the image stream collected by the movable camera; in the scheme of the present application, it is not necessary to obtain data in the gyroscope sensor in the electronic device, and obtain the movement amount of the electronic device based on the data of the gyroscope sensor; in the scheme of the present application, the translation posture of the electronic device when collecting the image stream can be obtained according to the difference in image content in the image stream, thereby obtaining the movement amount of the electronic device; therefore, in the scheme of the present application, when the camera in the electronic device realizes flexible movement, image anti-shake processing can be performed through the image content of the image stream collected by the movable camera to improve the anti-shake effect of the image; in addition, in the scheme of the present application, it is not necessary to obtain data in the gyroscope sensor in the electronic device; therefore, the scheme of the present application does not rely on the gyroscope sensor in the electronic device, and can improve the applicable scenarios of the image anti-shake method to a certain extent.

[0245] Fig.23 is a schematic flow chart of an image anti-shake method provided by an embodiment of the present application. The method 500 may be Figure 1 The electronic device shown is executed; the method 500 includes S510 to S570, and S510 to S570 are described in detail below.

[0246] It should be understood that the electronic device includes a first camera, and the first camera is a movable camera; for example, the first camera is a movable telephoto camera.

[0247] It should also be understood that the structural diagram and working principle of the first camera can be found in Figures 4 to 11 The relevant description will not be repeated here.

[0248] S510. Open the camera application.

[0249] Exemplarily, a user can instruct an electronic device to open a camera application by clicking on the icon of the "Camera" application; or, when the electronic device is in a lock screen state, the user can instruct the electronic device to open the camera application by sliding to the right on the display screen of the electronic device. Alternatively, the electronic device is in a lock screen state, and the lock screen interface includes an icon of a camera application, and the user instructs the electronic device to open the camera application by clicking on the icon of the camera application. Alternatively, when the electronic device is running other applications, the application has the permission to call the camera application; the user can instruct the electronic device to open the camera application by clicking on the corresponding control. For example, when the electronic device is running an instant messaging application, the user can instruct the electronic device to open the camera application by selecting the control of the camera function.

[0250] It should be understood that the above is an example of the operation of opening the camera application; the camera application can also be opened by instructing the electronic device through voice instructions or other operations; this application does not impose any limitation on this.

[0251] S520: Obtain a first image stream captured by a first camera.

[0252] The first image stream includes multiple frames of images.

[0253] S530: Obtain a global translation amount based on any two adjacent image frames in the first image stream.

[0254] The global translation is used to represent the translation of the center points of two adjacent image frames.

[0255] Optionally, in one implementation, obtaining a global translation amount based on any two adjacent frames of images in the first image stream includes:

[0256] Image feature point detection and feature point matching are performed on any two adjacent frames of images in the first image stream to obtain feature point pairs; and a global translation amount is obtained based on the translation amount between the feature point pairs.

[0257] S540, obtaining multiple translation postures based on the global translation amount and the time difference information.

[0258] Among them, multiple translation postures correspond one-to-one to multiple frames of images, one translation posture among the multiple translation postures is used to characterize the posture of the electronic device capturing one frame of the multiple frames of images, and the time difference information is used to represent the time difference in capturing multiple frames of images in the first image stream.

[0259] It should be understood that the translation posture of the image in the first image stream can be obtained based on the pixel translation amount of the image; in the scheme of the present application, the translation posture can refer to the translation amount in the camera coordinate system or the world coordinate system obtained by the translation amount in the pixel coordinate system.

[0260] In one implementation, the first image stream includes multiple frames of images, and the translation pose of the first frame of the multiple frames can be regarded as the initial translation pose (for example, 0); based on the global translation amount and time difference information between the second frame of the image and the first frame of the image, the translation pose of the second frame of the image is obtained on the basis of the initial translation pose; similarly, based on the global translation amount and time difference information between the second frame of the image and the third frame of the image, the translation pose of the third frame of the image is obtained on the basis of the translation pose of the second frame of the image; through the above method, the translation pose of each frame of the image in the first image stream can be obtained according to the difference in image content in the first image stream.

[0261] S550. Obtain multiple translation compensation amounts based on the multiple translation postures.

[0262] Among them, multiple translation compensation amounts are used to characterize the posture differences between multiple translation postures and the translation postures after smoothing, and the multiple translation compensation amounts correspond to multiple frame images one by one.

[0263] Optionally, in one implementation, multiple translation compensation amounts are obtained based on multiple translation postures, including:

[0264] The plurality of translation postures are smoothed to obtain a plurality of smoothed translation postures; and a plurality of translation compensation amounts are obtained based on posture differences between the plurality of translation postures and the plurality of smoothed translation postures.

[0265] S560: Obtain a second image stream based on the multiple translation compensation amounts and the first image stream.

[0266] Optionally, in one implementation, obtaining the second image stream based on multiple translation compensation amounts and the first image stream includes:

[0267] Based on the first motor position information, a first correction vector is obtained, where the first motor position information is the motor position information when the first camera captures the first image stream, and the first correction vector is used to perform image rotation correction on the first image stream;

[0268] Performing first image processing on the first image stream based on the first correction vector to obtain an image stream after image rotation correction;

[0269] The second image processing is performed on the image stream after the image rotation correction based on multiple translation compensation amounts to obtain a second image stream.

[0270] Optionally, in one implementation, performing second image processing on the image stream after image rotation correction based on multiple translation compensation amounts to obtain the second image stream includes:

[0271] An interpolation algorithm is performed on the pixel points of each image in the image stream after image rotation correction based on multiple translation compensation amounts to obtain a second image stream.

[0272] For example, the above implementation method can refer to the relevant description of the above implementation method one, which will not be repeated here.

[0273] Optionally, in one implementation, obtaining the second image stream based on multiple translation compensation amounts and the first image stream includes:

[0274] Based on the first motor position information, a first correction vector is obtained, where the first motor position information is the motor position information when the first camera captures the first image stream, and the first correction vector is used to perform image rotation correction on the first image stream; based on the first correction vector and multiple translation compensation amounts, multiple second correction vectors are obtained; based on the multiple second correction vectors, a third image processing is performed on the first image stream to obtain a second image stream.

[0275] Optionally, in an implementation manner, performing third image processing on the first image stream based on the multiple second correction vectors to obtain the second image stream includes:

[0276] An interpolation algorithm is performed on pixel points in a plurality of image frames in the first image stream based on a plurality of second correction vectors to obtain a second image stream.

[0277] For example, the above implementation method can refer to the relevant description of the aforementioned implementation method 2, which will not be repeated here.

[0278] S570: Display the second image stream.

[0279] Exemplarily, the second image stream may be directly displayed in the electronic device.

[0280] Exemplarily, the second image stream may be saved, and after detecting an operation of viewing the image stream, the electronic device may display the second image stream.

[0281] Optionally, in one implementation, after the first camera rotates, there is a first offset between a center point of a lens of the first camera and an imaging center point.

[0282] Optionally, in one implementation, the first camera includes a movable telephoto camera.

[0283] In the scheme of the present application, the electronic device includes a movable camera. Through the movement of the movable camera, the problem of certain limitations of the field of view of the telephoto camera can be overcome to meet the needs of different shooting scenes; when the camera in the electronic device realizes flexible movement, through the scheme of the present application, image anti-shake processing of the image stream can be realized according to the image content of the image stream collected by the movable camera; in the scheme of the present application, there is no need to obtain data in the gyroscope sensor in the electronic device, and obtain the movement amount of the electronic device based on the data of the gyroscope sensor; in the scheme of the present application, the translation posture of the electronic device when collecting the image stream can be obtained according to the difference in image content in the image stream, thereby obtaining the movement amount of the electronic device; therefore, in the scheme of the present application, when the camera in the electronic device realizes flexible movement, image anti-shake processing can be performed through the image content of the image stream collected by the movable camera, thereby improving the anti-shake effect of the image; in addition, in the scheme of the present application, there is no need to obtain data in the gyroscope sensor in the electronic device; therefore, the scheme of the present application does not rely on the gyroscope sensor in the electronic device, and can improve the applicable scenarios of the image anti-shake method to a certain extent.

[0284] It should be noted that the data from the gyroscope sensor can only represent the rotational movement of the electronic device, but cannot represent the translational movement of the electronic device; therefore, the movement of the electronic device cannot be accurately detected through the data in the gyroscope sensor; however, whether it is the rotational movement or translational movement of the electronic device, it can be reflected in the difference in image content; therefore, the image stabilization scheme of the present application can improve the image stabilization effect to a certain extent.

[0285] It should be understood that the above examples are intended to help those skilled in the art understand the embodiments of the present application, rather than to limit the embodiments of the present application to the specific numerical values ​​or specific scenarios illustrated. Those skilled in the art can obviously make various equivalent modifications or changes based on the above examples, and such modifications or changes also fall within the scope of the embodiments of the present application.

[0286] Combination of the above Figures 1 to 23 The image stabilization method provided by the embodiment of the present application is described in detail; Fig.24 and Fig.25 The device embodiments of the present application are described in detail. It should be understood that the device in the embodiments of the present application can execute the various methods of the aforementioned embodiments of the present application, that is, the specific working processes of the following various products can refer to the corresponding processes in the aforementioned method embodiments.

[0287] Fig.246 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. The electronic device 600 includes a processing module 610 and a display module 620; wherein the electronic device 600 includes a first camera, and the first camera is a movable camera.

[0288] Among them, the processing module 610 is used to: start the camera application; obtain the first image stream captured by the first camera, the first image stream including multiple frames of images; based on any two adjacent frames of images in the first image stream, obtain a global translation amount, wherein the global translation amount is used to characterize the translation amount of the center point of the two adjacent frames of images; based on the global translation amount and time difference information, obtain multiple translation postures, wherein the multiple translation postures correspond one-to-one to the multiple frames of images, one translation posture among the multiple translation postures is used to characterize the posture of the electronic device capturing one frame of the multiple frames of images, and the time difference information is used to represent the time difference of capturing the multiple frames of images in the first image stream; based on the multiple translation postures, obtain multiple translation compensation amounts, the multiple translation compensation amounts are used to characterize the posture differences between the multiple translation postures and the translation postures after smoothing, and the multiple translation compensation amounts correspond one-to-one to the multiple frames of images; based on the multiple translation compensation amounts and the first image stream, obtain a second image stream; the display module 620 is used to: display the second image stream.

[0289] Optionally, as an embodiment, the processing module 610 is further configured to:

[0290] Based on first motor position information, a first correction vector is obtained, where the first motor position information is motor position information when the first camera acquires the first image stream, and the first correction vector is used to perform image rotation correction on the first image stream;

[0291] Performing first image processing on the first image stream based on the first correction vector to obtain an image stream after image rotation correction;

[0292] The second image stream is subjected to second image processing based on the multiple translation compensation amounts to obtain the second image stream.

[0293] Optionally, as an embodiment, the processing module 610 is further configured to:

[0294] An interpolation algorithm is performed on the pixel points of each image in the image stream after the image rotation correction based on the multiple translation compensation amounts to obtain a second image stream.

[0295] Optionally, as an embodiment, the processing module 610 is further configured to:

[0296] Based on first motor position information, a first correction vector is obtained, where the first motor position information is motor position information when the first camera acquires the first image stream, and the first correction vector is used to perform image rotation correction on the first image stream;

[0297] Based on the first correction vector and the plurality of translation compensation amounts, a plurality of second correction vectors are obtained;

[0298] The first image stream is subjected to third image processing based on the plurality of second correction vectors to obtain the second image stream.

[0299] Optionally, as an embodiment, the processing module 610 is further configured to:

[0300] An interpolation algorithm is performed on pixel points in the multiple image frames in the first image stream based on the multiple second correction vectors to obtain the second image stream.

[0301] Optionally, as an embodiment, the processing module 610 is further configured to:

[0302] Performing image feature point detection and feature point matching on any two adjacent frames of images in the first image stream to obtain a feature point pair;

[0303] The global translation is obtained based on the translation between the feature point pairs.

[0304] Optionally, as an embodiment, the processing module 610 is further configured to:

[0305] Smoothing the multiple translation postures to obtain multiple smoothed translation postures;

[0306] The multiple translation compensation amounts are obtained based on the posture differences between the multiple translation postures and the multiple smoothed translation postures.

[0307] Optionally, as an embodiment, after the first camera rotates, there is a first offset between the center point of the lens of the first camera and the imaging center point.

[0308] Optionally, as an embodiment, the first camera includes a movable telephoto camera.

[0309] It should be noted that the electronic device 600 is implemented in the form of a functional unit. The term "module" here can be implemented in the form of software and / or hardware, and is not specifically limited to this.

[0310] For example, a "module" may be a software program, a hardware circuit, or a combination of the two that implements the above functions. The hardware circuit may include an application specific integrated circuit (ASIC), an electronic circuit, a processor (such as a shared processor, a dedicated processor, or a group processor, etc.) and a memory for executing one or more software or firmware programs, a combined logic circuit, and / or other suitable components that support the described functions.

[0311] Therefore, the units of each example described in the embodiments of the present application can be implemented by 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 the present application.

[0312] Fig.25 A structural schematic diagram of an electronic device provided by the present application is shown. Fig.25 The dotted line in the figure indicates that the unit or the module is optional. The electronic device 800 can be used to implement the image anti-shake method described in the above method embodiment.

[0313] The electronic device 800 includes one or more processors 801, which can support the electronic device 800 to implement the image stabilization method in the method embodiment. The processor 801 can be a general-purpose processor or a special-purpose processor. For example, the processor 801 can be a central processing unit (CPU), a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, such as discrete gates, transistor logic devices or discrete hardware components.

[0314] The processor 801 can be used to control the electronic device 800, execute the software program, and process the data of the software program. The electronic device 800 can also include a communication unit 805 to implement the input (reception) and output (transmission) of signals.

[0315] For example, the electronic device 800 may be a chip, the communication unit 805 may be an input and / or output circuit of the chip, or the communication unit 805 may be a communication interface of the chip, and the chip may be a component of a terminal device or other electronic devices.

[0316] For another example, the electronic device 800 may be a terminal device, and the communication unit 805 may be a transceiver of the terminal device, or the communication unit 805 may be a transceiver circuit of the terminal device.

[0317] The electronic device 800 may include one or more memories 802 on which a program 804 is stored. The program 804 can be executed by the processor 801 to generate instructions 803, so that the processor 801 executes the method described in the above method embodiment according to the instructions 803.

[0318] Optionally, data may be stored in the memory 802. Optionally, the processor 801 may read data stored in the memory 802. The data may be stored at the same storage address as the program 804, or may be stored at a different storage address than the program 804.

[0319] Exemplarily, the processor 801 and the memory 802 may be provided separately or integrated together, for example, integrated on a system on chip (SOC) of the terminal device.

[0320] Exemplarily, the memory 802 can be used to store the related program 804 of the image stabilization method provided in the embodiment of the present application, and the processor 801 can be used to call the related program 804 of the image stabilization method stored in the memory 802 during video processing to execute the image stabilization method of the embodiment of the present application; for example, start the camera application; obtain the first image stream captured by the first camera, the first image stream including multiple frames of images; based on any two adjacent frames of images in the first image stream, obtain the global translation amount, wherein the global translation amount is used to characterize the translation amount of the center point of the two adjacent frames of images; based on the global translation amount and The method comprises the steps of: obtaining a plurality of translation postures based on the plurality of translation postures, wherein the plurality of translation postures correspond one-to-one to the plurality of image frames, and one of the plurality of translation postures is used to characterize the posture of one frame of the plurality of image frames collected by the electronic device, and the time difference information is used to represent the time difference of collecting the plurality of image frames in the first image stream; obtaining a plurality of translation compensation amounts based on the plurality of translation postures, and the plurality of translation compensation amounts are used to characterize the posture differences between the plurality of translation postures and the translation postures after smoothing, and the plurality of translation compensation amounts correspond one-to-one to the plurality of image frames; obtaining a second image stream based on the plurality of translation compensation amounts and the first image stream; and displaying the second image stream.

[0321] The present application also provides a computer program product, which, when executed by the processor 801, implements the method of any method embodiment in the present application.

[0322] The computer program product may be stored in the memory 802 , for example, a program 804 , which is finally converted into an executable target file that can be executed by the processor 801 after preprocessing, compiling, assembling, and linking.

[0323] The present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a computer, the method of any method embodiment of the present application is implemented. The computer program can be a high-level language program or an executable target program.

[0324] The computer-readable storage medium is, for example, a memory 802. The memory 802 may be a volatile memory or a nonvolatile memory, or the memory 802 may include both a volatile memory and a nonvolatile memory. Among them, the nonvolatile 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), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).

[0325] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described devices and equipment and the technical effects produced can refer to the corresponding processes and technical effects in the aforementioned method embodiments, and will not be repeated here.

[0326] In several embodiments provided in the present application, the disclosed systems, devices and methods can be implemented in other ways. For example, some features of the method embodiments described above can be ignored or not performed. The device embodiments described above are merely schematic, and the division of units is only a logical function division. There may be other division methods in actual implementation, and multiple units or components may be combined or integrated into another system. In addition, the coupling between the units or the coupling between the components may be direct coupling or indirect coupling, and the above coupling includes electrical, mechanical or other forms of connection.

[0327] It should be understood that in the various embodiments of the present application, the size of the serial number of each process 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.

[0328] In addition, the terms "system" and "network" are often used interchangeably in this article. The term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0329] In short, the above are only preferred embodiments of the technical solution of this application, and are not intended to limit the protection scope of this application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of this application should be included in the protection scope of this application.

Claims

1. An image stabilization method, characterized in that: Applied to an electronic device, the electronic device includes a first camera, the first camera is a movable camera, and the method does not need to obtain data in a gyroscope sensor in the electronic device, and includes: Open the Camera app; Acquire a first image stream captured by the first camera, where the first image stream includes multiple frames of images; Based on any two adjacent frames of images in the first image stream, a global translation amount is obtained, wherein the global translation amount is used to represent the translation amount of the center points of the two adjacent frames of images; Based on the global translation amount and the time difference information, a plurality of translation postures are obtained, wherein the plurality of translation postures correspond to the plurality of frames of images one by one, a translation posture of the plurality of translation postures is used to represent the posture of the electronic device capturing one of the plurality of frames of images, and the time difference information is used to represent the time difference of capturing the plurality of frames of images in the first image stream; Based on the multiple translation postures, a plurality of translation compensation amounts are obtained, wherein the plurality of translation compensation amounts are used to characterize the posture differences between the multiple translation postures and the translation postures after smoothing, and the plurality of translation compensation amounts correspond to the multiple frames of images one by one; Obtaining a second image stream based on the multiple translation compensation amounts and the first image stream; displaying the second image stream; The method of obtaining a second image stream based on the multiple translation compensation amounts and the first image stream includes: obtaining a first correction vector based on first motor position information, wherein the first motor position information is motor position information when the first camera collects the first image stream, and the first correction vector is used to perform image rotation correction on the first image stream; performing a first image processing on the first image stream based on the first correction vector to obtain an image stream after image rotation correction; performing a second image processing on the image stream after image rotation correction based on the multiple translation compensation amounts to obtain the second image stream; Alternatively, the second image stream is obtained based on the multiple translation compensation amounts and the first image stream, including: obtaining a first correction vector based on first motor position information, the first motor position information being the motor position information when the first camera acquires the first image stream, and the first correction vector being used to perform image rotation correction on the first image stream; obtaining multiple second correction vectors based on the first correction vector and the multiple translation compensation amounts; and performing a third image processing on the first image stream based on the multiple second correction vectors to obtain the second image stream.

2. The image stabilization method according to claim 1, wherein: The step of performing a second image processing on the image stream after the image rotation correction based on the multiple translation compensation amounts to obtain the second image stream comprises: An interpolation algorithm is performed on the pixel points of each image in the image stream after the image rotation correction based on the multiple translation compensation amounts to obtain the second image stream.

3. The image stabilization method according to claim 1, wherein: The performing third image processing on the first image stream based on the plurality of second correction vectors to obtain the second image stream comprises: An interpolation algorithm is performed on pixel points in the multiple image frames in the first image stream based on the multiple second correction vectors to obtain the second image stream.

4. The image stabilization method according to any one of claims 1 to 3, characterized in that: The obtaining of a global translation amount based on any two adjacent frames of images in the first image stream includes: Performing image feature point detection and feature point matching on any two adjacent frames of images in the first image stream to obtain a feature point pair; The global translation is obtained based on the translation between the feature point pairs.

5. The image stabilization method according to any one of claims 1 to 3, characterized in that: The obtaining of multiple translation compensation amounts based on the multiple translation postures includes: Smoothing the multiple translation postures to obtain multiple smoothed translation postures; The multiple translation compensation amounts are obtained based on the posture differences between the multiple translation postures and the multiple smoothed translation postures.

6. The image stabilization method according to any one of claims 1 to 3, characterized in that: After the first camera rotates, there is a first offset between the center point of the lens of the first camera and the imaging center point.

7. The image stabilization method according to any one of claims 1 to 3, characterized in that: The first camera includes a movable telephoto camera.

8. An electronic device, characterized in that: Electronic equipment includes: one or more processors, a memory, and a first camera; The memory is coupled to the one or more processors, and the memory is used to store computer program codes, wherein the computer program codes include computer instructions, and the one or more processors call the computer instructions to enable the electronic device to perform the image stabilization method as described in any one of claims 1 to 7.

9. A chip system, characterized in that: The chip system is applied to an electronic device, and the chip system includes one or more processors, and the one or more processors are used to call computer instructions so that the electronic device executes the image stabilization method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the image stabilization method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Video recording method and equipment

    CN114339102A

  • Video processing method and related equipment thereof

    CN115546043A

  • Data processing method and apparatus, movable platform and computer-readable storage medium

    WO2021081707A1