Pose optimization method and electronic equipment

Through visual tracking and binocular depth recovery of the wide-angle lens and the main camera lens, combined with the constraint relationship between camera pose and inertial pose, the pose estimation of electronic devices is optimized, and the loss of feature point tracking and inertial pose accumulation during rapid movement are solved. error problem and improve the accuracy and stability of positioning.

CN118623873APending Publication Date: 2024-09-10HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310254462.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-08
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

In the existing technology, due to the limited field of view of the camera when electronic equipment moves rapidly, feature point tracking is lost, affecting the accuracy and stability of pose estimation, and there is a cumulative error in the pose estimation of the inertial unit.

Method used

The wide-angle lens and the main camera lens are used for visual tracking, and the depth information of the feature points is calculated through binocular depth recovery, and the constraint relationship between the camera pose and the inertial pose is used for optimization to obtain the optimized inertial pose.

Benefits of technology

It improves the accuracy and stability of pose estimation, reduces the probability of feature point loss, corrects the cumulative error of inertial pose, and improves the accuracy of device positioning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118623873A
    Figure CN118623873A
Patent Text Reader

Abstract

The invention provides a pose optimization method and electronic equipment, relates to a computer vision technology, and can optimize the pose of the electronic equipment. The method is applied to the electronic equipment, and comprises the following steps: acquiring an inertial pose through an inertial measurement unit, acquiring a first image through a main camera, and acquiring a second image through a wide-angle lens; matching the first feature point of the first image with the second feature point of the second image to obtain an image feature point matching result; tracking feature points in multiple frames of second images collected at each moment to obtain feature tracking information of the second images at each moment; calculating depth information of feature points in the first image and the second image at each moment based on the first image and the second image collected at each moment, the image feature point matching result and the feature tracking information; and calculating a camera pose of the electronic equipment according to the depth information, and optimizing the inertial pose by adopting the camera pose based on a preset constraint relation to obtain an optimized inertial pose.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer vision technology, and in particular to a posture optimization method and electronic device. Background Art

[0002] At present, the pose of an electronic device can be calculated by the same feature points in the images captured by the camera at different times. In this method, the stability of feature point tracking is extremely important. Especially in fast-moving situations, due to the limitations of the camera's field of view, it is easy to lose feature point tracking due to the lack of a common view area between consecutive frames. This affects the accuracy and stability of pose estimation, resulting in abnormal positioning of the device, which greatly affects the user experience.

[0003] In the prior art, the posture of the electronic device can also be estimated by an inertial unit (IMU), but the posture estimated by the IMU has cumulative errors. Therefore, a posture optimization method is urgently needed to improve the accuracy and stability of posture estimation. Summary of the invention

[0004] The embodiments of the present application provide a posture optimization method and an electronic device, which can optimize the posture of the electronic device and improve the accuracy and stability of posture estimation.

[0005] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:

[0006] In a first aspect, a posture optimization method is provided, which can be applied to an electronic device, the electronic device includes a main camera lens, a wide-angle lens and an inertial measurement unit, and the method includes: the electronic device collects the inertial posture of the electronic device through the inertial measurement unit IMU, collects the first image through the main camera lens, and collects the second image through the wide-angle lens. The electronic device matches the first feature point of the first image with the second feature point of the second image to obtain an image feature point matching result; wherein the first feature point is obtained by feature extraction of the first image, and the second feature point is obtained by feature extraction of the second image, and the image feature point matching result is used to associate the matching feature points in the first image and the second image. The electronic device tracks the second feature points in multiple frames of the second image collected at each moment to obtain feature tracking information of the second image at each moment; wherein the feature point tracking information is used to associate the same feature points in the second image. Based on the first image and the second image collected at each moment, as well as the image feature point matching result and the feature tracking information, the electronic device calculates the depth information of the feature points in the first image and the second image at each moment. The electronic device calculates the camera pose of the electronic device according to the depth information, and optimizes the inertial pose using the camera pose based on a preset constraint relationship to obtain the optimized inertial pose of the electronic device; wherein the inertial pose in the inertial coordinate system obtained by converting the camera pose in the camera coordinate system based on the preset constraint relationship is the same as the inertial pose of the electronic device.

[0007] By adopting this technical solution, the wide-angle lens of the electronic device can be used for visual tracking, and the wide-angle lens and the main camera lens can be used to perform binocular depth recovery on the photographed object. Then, the inertial pose is optimized through the constraint relationship between the camera pose and the inertial pose, and the optimized inertial pose of the electronic device is obtained, which improves the accuracy and stability of the pose estimation, thereby making a more accurate judgment on the current position and improving the positioning effect of the electronic device.

[0008] The above constraints include: a. There are both IMU and camera CAM in the electronic device. When the electronic device moves, there is a coordinate system transformation between the postures of the two. After the posture transformation, the IMU posture and the CAM posture should be the same. b. The feature points in the common view area of ​​the CAM output images at two moments should have the same position when the image at the previous moment is transformed into the image at the current moment.

[0009] That is, the above constraint relationship may include visual constraints and IMU constraints. In the visual constraints and IMU constraints, the optimized state vector is found, and then the state vector is derived by the visual residual (i.e., reprojection error) and the IMU measurement residual, respectively, to obtain the optimized state vector.

[0010] In a possible implementation, the above-mentioned matching of feature points of the first image with feature points of the second image to obtain image feature point matching results includes: extracting first feature points of the first image and second feature points of the second image using a preset feature extraction method; performing feature matching on the first feature points and the second feature points by descriptor matching, and determining feature points that match the first feature points from the second feature points.

[0011] In a possible implementation, the above-mentioned feature matching of the first feature point and the second feature point by descriptor matching, and determining the feature point matching the first feature point from the second feature point, includes: using a quadtree method to perform sparse processing on the first feature point and the second feature point to obtain the sparse first feature point and the sparse second feature point; performing feature matching on the sparse first feature point and the sparse second feature point by descriptor matching, and determining the feature point matching the sparse first feature point from the sparse second feature point. After the extracted feature points are sparsely processed and then feature point matching is performed, uniform distribution of feature points can be achieved, thereby improving the accuracy and speed of image processing.

[0012] In a possible implementation, the above-mentioned feature matching of the first feature point and the second feature point by descriptor matching, and determining the feature point matching the first feature point from the second feature point, includes: obtaining the first descriptor of the first feature point and the second descriptor of the second feature point; respectively calculating the Hamming distance between each second descriptor and the first descriptor, and determining the second feature point corresponding to the second descriptor with the smallest Hamming distance with the first descriptor as the feature point matching the first feature point.

[0013] In a possible implementation, the above-mentioned tracking of the second feature points in the multiple frames of the second image collected at each moment to obtain the feature tracking information of the second image at each moment includes: tracking the second feature points in the multiple frames of the second image collected at each moment by an optical flow method to obtain the feature tracking information of the second image at each moment. In this solution, the feature point tracking is performed on the second image collected by a wide-angle lens. Since the field of view of the wide-angle lens is relatively wide, the probability of feature point loss can be reduced.

[0014] In a possible implementation, the collecting the inertial posture of the electronic device by using an inertial measurement unit includes: measuring inertial data of the electronic device at adjacent moments by using the inertial measurement unit, and performing pre-integration processing on the inertial data to obtain the inertial posture.

[0015] In a possible implementation, the above-mentioned method of optimizing the inertial posture using the camera posture based on the preset constraint relationship to obtain the optimized inertial posture of the electronic device includes: calculating the reprojection error between the second images at adjacent moments, and performing nonlinear optimization on the reprojection error using a preset optimization algorithm to obtain the optimized inertial posture.

[0016] In a possible implementation, the above-mentioned calculation of the reprojection error between the second images at adjacent moments includes: obtaining the projection coordinate value of the feature point of the i-th frame image projected onto the camera coordinate system corresponding to the j-th frame image, and the measurement coordinate value corresponding to the feature point of the i-th frame image in the camera coordinate system corresponding to the j-th frame image, wherein the i-th frame image and the j-th frame image are the second images at adjacent moments, the measurement coordinate value is calculated based on the feature tracking information of the second image, and the projection coordinate value is obtained based on the inertial posture; and calculating the reprojection error between the second images at adjacent moments based on the difference between the projection coordinate value and the measurement coordinate value.

[0017] In a possible implementation, the method further includes: calculating the pre-integration residual of the inertial data between adjacent moments, and performing nonlinear optimization on the pre-integration residual using a preset optimization algorithm to obtain an optimized state quantity of the inertial measurement unit. The optimized state quantity is used in subsequent calculations to reduce the error of the inertial measurement unit during the transmission process.

[0018] In a second aspect, the present application provides a mobile terminal, which includes: a charging interface, a battery, a memory and one or more processors; the charging interface, the battery, the memory are coupled to the processor; wherein the memory stores computer program code, and the computer program code includes computer instructions, and when the computer instructions are executed by the processor, the mobile terminal executes any one of the posture optimization methods described in the first aspect above.

[0019] In a third aspect, the present application provides a computer-readable storage medium, which stores instructions, and when the computer-readable storage medium is run on a computer, the computer can execute the posture optimization method described in any one of the first aspects above.

[0020] In a fourth aspect, the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the posture optimization method described in any one of the first aspects above.

[0021] It can be understood that the mobile terminal described in the second aspect provided above, the computer-readable storage medium described in the third aspect, and the computer program product described in the fourth aspect are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 A schematic diagram of feature point tracking in a common field of view provided in an embodiment of the present application;

[0023] Figure 2 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;

[0024] Figure 3 A flowchart of a posture optimization method provided in an embodiment of the present application;

[0025] Figure 4 A schematic diagram of reference feature points and candidate feature points provided in an embodiment of the present application;

[0026] Figure 5 A schematic diagram of feature point matching provided in an embodiment of the present application;

[0027] Figure 6 A schematic diagram of a feature point tracking provided in an embodiment of the present application;

[0028] Figure 7 A schematic diagram of the relationship between an image feature point matching result and feature tracking information provided in an embodiment of the present application;

[0029] Figure 8 It is a schematic diagram of combining feature tracking information at multiple moments with image feature point matching results provided by an embodiment of the present application;

[0030] Fig. 9 This is a schematic diagram of the output relationship between an IMU posture and a camera posture provided in an embodiment of the present application;

[0031] Fig.10 It is a schematic diagram of the constraint relationship between the IMU posture and the camera posture during a motion process provided by an embodiment of the present application;

[0032] Fig.11 It is a schematic diagram of the positions of a camera and an IMU in an electronic device provided in an embodiment of the present application;

[0033] Fig.12 It is a flowchart of another posture optimization method provided in an embodiment of the present application;

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

[0035] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The following terms "first", "second", etc. are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", etc. may explicitly or implicitly include one or more of the features. In the description of the present embodiment, unless otherwise specified, "multiple" means two or more.

[0036] For the visual part of the positioning algorithm of electronic devices, the stability of feature point tracking is extremely important. Especially in fast-moving situations, due to the limitations of the camera's field of view, it is easy to lose feature point tracking due to the lack of common view area between consecutive frames. This affects the accuracy of pose estimation, resulting in abnormal positioning of electronic devices, which greatly affects the user experience.

[0037] For example, when a user captures images through a mobile phone, if the phone is shaken or shaken quickly, the field of view captured by the phone camera will change. Once the phone moves too fast, the two frames of images captured may not overlap, that is, there is no common view area. Specifically, a stool appears as a feature in the previous frame of the image, but does not exist in the next frame of the image, which means that the feature has been lost, which means that the device positioning is abnormal. Therefore, the position and posture of the electronic device calculated by the feature points will not be accurate and stable enough.

[0038] See also Figure 1 , Figure 1 A schematic diagram of a feature point tracking of a common field of view provided in an embodiment of the present application. Figure 1 As shown, Figure 1 1a and Figure 1 1a and 1b are images taken by the camera at different times. The image 1a and the image 1b have a common view. Multiple feature points in 1a can be found in 1b. For example, as shown by the arrows from 1a to 1b, feature points A, B, C, D, and E in 1a correspond to feature points A1, B1, C1, D1, and E1 in 1b, respectively. At this time, the position at time 1 and the position at time 2 and the common viewpoint can form Figure 1 The triangular relationship shown in 1c can be used to calculate the position and posture relationship of the electronic device. Among them, any movement can be decomposed into translation t and rotation R, and the position and posture refers to translation and rotation.

[0039] Therefore, if there is no common field of view between the two frames of images, then the feature points that are the same as the feature points in the previous frame of image cannot be found in the latter frame of image, and the above-mentioned triangular relationship cannot be formed, and the position and posture of the electronic device cannot be accurately calculated, resulting in positioning abnormalities.

[0040] In conventional technology, the posture can also be calculated by IMU. However, long-term operation of IMU will cause internal offset of the output data, and the cumulative error produced by the solution process will distort the result, that is, the posture estimated by IMU will have cumulative errors.

[0041] In response to the above problems, in some solutions, the camera pose of the electronic device calculated by the feature points and the IMU pose calculated by the IMU can be combined. However, the information of the IMU and the information of the camera are loosely coupled. During the calculation, each of them still calculates and outputs its own pose, so it is impossible to always stably output a pose with high accuracy.

[0042] Therefore, how to improve the stability of feature point tracking and enhance the accuracy and stability of pose estimation is an urgent problem to be solved.

[0043] The embodiment of the present application provides a posture optimization method, which can use a wide-angle lens for visual tracking, use the wide-angle lens and the main camera lens to perform feature point depth recovery, and then use the constraint relationship between the camera and the inertial measurement unit to optimize the posture of the electronic device, thereby obtaining the optimal estimate of the current posture, improving the accuracy and stability of the posture estimation, and then making a more accurate judgment on the current position, thereby improving the positioning effect of the device.

[0044] Exemplarily, the electronic device in the embodiments of the present application may be a portable computer (such as a mobile phone), a tablet computer, a laptop computer, a personal computer (PC), a wearable electronic device (such as a smart watch), an augmented reality (AR) device, a virtual reality (VR) device, a car computer, etc. The following embodiments do not impose any special restrictions on the specific form of the electronic device.

[0045] The following will describe the implementation of the embodiment of the present application in detail with reference to the accompanying drawings. Taking the above-mentioned electronic device as a mobile phone as an example, the hardware structure of the electronic device 200 (such as a mobile phone) is introduced. Figure 2 , Figure 2 A schematic diagram of the structure of an electronic device is shown. Figure 2As shown, the electronic device 200 may include: a processor 210, an external memory interface 220, an internal memory 221, a USB interface 220, a charging management module 240, a power management module 241, a battery 242, an antenna 1, an antenna 2, a mobile communication module 250, a wireless communication module 260, an audio module 270, a speaker 270A, a receiver 270B, a microphone, an earphone interface, a sensor module 280, a button 290, a motor 291, an indicator 292, a camera 293, a display screen 294, and a subscriber identification module (SIM) card interface 295, etc.

[0046] Among them, the above-mentioned sensor module 280 may include sensors such as pressure sensor, gyroscope sensor, air pressure sensor, magnetic sensor, acceleration sensor, distance sensor, proximity light sensor, fingerprint sensor, temperature sensor, touch sensor, ambient light sensor and bone conduction sensor.

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

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

[0049] The controller may be the nerve center and command center of the electronic device 200. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0050] The processor 210 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 210 is a cache memory. The memory may store instructions or data that the processor 210 has just used or cyclically used. If the processor 210 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 210, and thus improves the efficiency of the system.

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

[0052] It is understandable that the interface connection relationship between the modules shown in this embodiment is only a schematic illustration and does not constitute a structural limitation on the electronic device 200. In other embodiments, the electronic device 200 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0053] The charging management module 240 is used to receive charging input from a charger. In the embodiment of the present application, the charger may be a wired charger, and the charging management module 240 may receive charging input from the wired charger through the USB interface 220 (i.e., the above-mentioned charging interface). While the charging management module 240 is charging the battery 242, it may also power the electronic device through the power management module 241.

[0054] The power management module 241 is used to connect the battery 242, the charging management module 240 and the processor 210. The power management module 241 receives input from the battery 242 and / or the charging management module 240, and supplies power to the processor 210, the internal memory 221, the external memory, the display screen 294, the camera 293, and the wireless communication module 260. The power management module 241 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 241 can also be set in the processor 210. In other embodiments, the power management module 241 and the charging management module 240 can also be set in the same device.

[0055] The wireless communication function of the electronic device 200 can be implemented through the antenna 1, the antenna 2, the mobile communication module 250, the wireless communication module 260, the modem processor and the baseband processor.

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

[0057] The mobile communication module 250 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 200. The mobile communication module 250 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 250 can receive electromagnetic waves from the antenna 1, and perform filtering, amplification, etc. on the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.

[0058] The wireless communication module 260 can provide wireless communication solutions for application in the electronic device 200, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.

[0059] The wireless communication module 260 may be one or more devices integrating at least one communication processing module. The wireless communication module 260 receives electromagnetic waves via the antenna 2, modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 210. The wireless communication module 260 may also receive signals to be sent from the processor 210, modulate the frequencies of the signals, amplify the signals, and convert the signals into electromagnetic waves for radiation via the antenna 2.

[0060] In some embodiments, the antenna 1 of the electronic device 200 is coupled to the mobile communication module 250, and the antenna 2 is coupled to the wireless communication module 260, so that the electronic device 200 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology, etc. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0061] The electronic device 200 implements the display function through a GPU, a display screen 294, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 294 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 210 may include one or more GPUs, which execute program instructions to generate or change display information.

[0062] The display screen 294 is used to display images, videos, etc. The display screen 294 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc.

[0063] The electronic device 200 can realize the shooting function through ISP, camera 293, video codec, GPU, display screen 294 and application processor. ISP is used to process the data fed back by camera 293. Camera 293 is used to capture static images or videos. In some embodiments, the electronic device 200 may include 1 or N cameras 293, where N is a positive integer greater than 1. The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 200 is in frequency selection, the digital signal processor is used to perform Fourier transform on the frequency energy. The video codec is used to compress or decompress digital video. NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of the electronic device 100 can be realized, such as image recognition, face recognition, speech recognition, text understanding, etc.

[0064] The external memory interface 220 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 200. The external memory card communicates with the processor 210 through the external memory interface 220 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0065] The internal memory 221 may be used to store computer executable program codes, which include instructions. The processor 210 executes various functional applications and data processing of the electronic device 200 by running the instructions stored in the internal memory 221. For example, in an embodiment of the present application, the processor 210 may execute the instructions stored in the internal memory 221, and the internal memory 221 may include a program storage area and a data storage area.

[0066] The program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 200 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 221 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0067] The electronic device 200 can implement audio functions such as music playing and recording through the audio module 270, the speaker 270A, the receiver 270B, the microphone, the headphone interface, and the application processor.

[0068] The fingerprint sensor 280A is used to collect fingerprint information. The electronic device 200 can use the fingerprint characteristics of the collected fingerprint information to perform user identity verification (i.e. fingerprint recognition) to achieve fingerprint unlocking, access application locks, fingerprint photography, fingerprint answering calls, etc.

[0069] The touch sensor 280B is also called a "touch panel (TP)". The touch sensor 280B can be set on the display screen 294, and the touch sensor 280B and the display screen 294 form a touch screen, also called a "touch screen". The touch sensor 280B is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 294. In other embodiments, the touch sensor 280B can also be set on the surface of the electronic device 200, which is different from the position of the display screen 294.

[0070] The audio module 270 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 270 can also be used to encode and decode audio signals. In some embodiments, the audio module 270 can be arranged in the processor 210, or some functional modules of the audio module 270 can be arranged in the processor 210. The speaker 270A, also known as the "speaker", is used to convert audio electrical signals into sound signals. The receiver 270B, also known as the "earpiece", is used to convert audio electrical signals into sound signals. The microphone, also known as the "microphone" or "microphone", is used to convert sound signals into electrical signals.

[0071] The headphone jack is used to connect a wired headphone, and can be a USB interface 220, or a 3.5 mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0072] The button 290 includes a power button, a volume button, etc. The button 290 can be a mechanical button. It can also be a touch button. The motor 291 can generate a vibration prompt. The motor 291 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. The indicator 292 can be an indicator light, which can be used to indicate the charging status, power changes, messages, missed calls, notifications, etc. The SIM card interface 295 is used to connect the SIM card. The SIM card can be connected to and separated from the electronic device 200 by inserting it into the SIM card interface 295 or pulling it out from the SIM card interface 295. The electronic device 200 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 295 can support Nano SIM cards, Micro SIM cards, SIM cards, etc.

[0073] The methods in the following embodiments can all be implemented in the electronic device 200 having the above hardware structure.

[0074] The present application embodiment provides a posture optimization method, which can be applied to electronic devices. In the following embodiments, the electronic device is a mobile phone as an example to introduce the method of the present application embodiment. Figure 3 , Figure 3 Schematic diagram of the implementation process of a posture optimization method provided in an embodiment of the present application. Figure 3 As shown, the posture optimization method may include S201-S205.

[0075] S201. Collect the inertial posture of the electronic device through an inertial measurement unit, collect a first image through a main camera lens, and collect a second image through a wide-angle lens.

[0076] In an embodiment of the present application, there may be multiple lenses on an electronic device, which may include a main camera lens and a wide-angle lens. When a user takes a photo, the main camera lens and the wide-angle lens of the mobile phone are used to shoot at the same time, and a main camera image (i.e., a first image) and a wide-angle image (i.e., a second image) are obtained respectively. The main camera image taken by the main lens with a high resolution can be used as the main image, and the wide-angle image taken by the wide-angle lens with a wider field of view can be used as the reference image.

[0077] The electronic device also includes an inertial measurement unit (IMU), which is used to measure the three-axis attitude angle (or angular rate) and acceleration of the object. Gyroscopes and accelerometers are the main components of IMU, and their accuracy directly affects the accuracy of the inertial system.

[0078] Generally, an IMU contains three single-axis accelerometers and three single-axis gyroscopes. The accelerometer detects the acceleration signals of the object in the three independent axes of the carrier coordinate system, while the gyroscope detects the angular velocity signals of the carrier relative to the navigation coordinate system, measures the angular velocity and acceleration of the object in three-dimensional space, and uses this to solve the object's posture. The IMU can output the acceleration and angular velocity of the carrier. Through these two sensor data, the IMU's own posture change can be calculated, that is, the posture change at the current moment relative to the previous moment. When solving, it is also necessary to eliminate the errors in the IMU sampling data and the errors generated in the process.

[0079] In an embodiment of the present application, the electronic device can measure the inertial data of the electronic device at adjacent moments through an inertial measurement unit, perform pre-integration processing on the inertial data, and obtain an inertial posture (IMU posture). Among them, the inertial data includes gyroscope data and accelerometer data, that is, acceleration and angular velocity. It is necessary to integrate the angular velocity once to calculate the angle, that is, the attitude (rotation), and integrate the acceleration twice to obtain the distance, that is, the position (translation). The above-mentioned inertial posture also represents the position (translation) and attitude (rotation).

[0080] Generally, IMU is combined with other sensors. In the embodiment of the present application, IMU is combined with a visual camera.

[0081] S202, matching the first feature point of the first image with the second feature point of the second image to obtain an image feature point matching result; wherein the image feature point matching result is used to associate matching feature points in the first image and the second image.

[0082] In the embodiment of the present application, feature point matching can be performed on the first image captured by the main camera lens and the second image captured by the wide-angle lens. Specifically, the first feature point is extracted from the first image, the second feature point is extracted from the second image, and the first feature point is matched with the second feature point. Among them, those pixels with obvious changes around them can be found in the image as feature points, such as corners and edges where the pixels with obvious color changes are used as feature points.

[0083] The first feature points of the first image and the second feature points of the second image may be extracted using a preset feature extraction method, for example, the preset feature extraction method may be a FAST (Features from Accelerated Segment Test) feature point extraction method.

[0084] Among them, the principle of the FAST feature point extraction method is: traverse all the pixels on the image, take the current pixel as the center, draw a circle with a preset pixel (such as 3 pixels) as the radius (there are 16 points on the circle), and calculate the difference between the pixel values ​​of these 16 points and the pixel value of the center pixel. If the number of pixels whose difference is greater than the preset threshold exceeds the preset number (such as 9), the center pixel can be considered to be a feature point p. Then the image is non-maximum suppressed to exclude unstable feature points: calculate the FAST score value (i.e. score value, also known as s value) of the feature point, and judge a neighborhood (such as 3x3 or 5x5) centered on the feature point p. If multiple feature points are calculated, then the s value of each feature point (the sum of the absolute values ​​of the differences between the 16 points and the center) is judged. If p is the largest s value among all feature points in the neighborhood, it is retained; otherwise, it is suppressed. If there is only one feature point in the neighborhood, it is retained.

[0085] Thus, through the above feature extraction method, all feature points in the first image and the second image can be extracted. After the feature point extraction is completed, the first feature point and the second feature point can be feature matched. Among them, the feature point (such as feature point 1) matches the feature point (such as feature point 2), which means that feature point 1 and feature point 2 are the same feature points in different images.

[0086] In the embodiment of the present application, the first feature point and the second feature point can be matched by descriptor matching, and the feature point matching the first feature point can be determined from the second feature point. The descriptor refers to the surrounding information of the feature point, which is generally a random sampling of several pixels around the current feature point as the surrounding information of the current feature point, or a circle is drawn for sampling. For example, the BRIEF descriptor can be used to describe the feature point, which is a binary coded descriptor.

[0087] In the embodiment of the present application, the matching feature points can be determined by calculating the Hamming distance between two descriptors. Among them, the two BRIEF descriptors corresponding to the smallest Hamming distance are the most similar, that is, the two feature points corresponding to the two BRIEF descriptors are matched. Figure 4 , a reference feature point can be selected from the first image, and all feature points in the second image can be used as candidate feature points. The Hamming distance between the descriptor of the reference feature point and the descriptors of each candidate feature point is calculated, and the candidate feature point corresponding to the descriptor with the smallest Hamming distance to the descriptor of the reference feature point is the feature point that matches the reference feature point. In this way, feature points that match all feature points in the first image can be determined from the second image.

[0088] In the embodiment of the present application, the first descriptor of the first feature point and the second descriptor of the second feature point can be obtained. Then, the Hamming distance between each second descriptor and the first descriptor is calculated respectively, and the second feature point corresponding to the second descriptor with the smallest Hamming distance to the first descriptor is determined as the feature point that matches the first feature point. In this way, multiple sets of matching feature point pairs can be determined.

[0089] See also Figure 5 , Figure 5 A schematic diagram of feature point matching provided in an embodiment of the present application. Figure 5 As shown, feature point A in the wide-angle image (reference frame) matches feature point A' in the main image (matching frame).

[0090] In the embodiment of the present application, the extracted feature points may be subjected to sparse processing before feature point matching, so that the feature points may be evenly distributed, thereby improving the accuracy and speed of image processing.

[0091] Specifically, the first feature point and the second feature point can be thinned by using a quadtree method to obtain the thinned first feature point and the thinned second feature point; the thinned first feature point and the thinned second feature point are feature matched by descriptor matching, and the feature point matching the thinned first feature point is determined from the thinned second feature point. Among them, the method of thinning feature points by using a quadtree in the prior art can be used to achieve the thinning of the first feature point and the second feature point, which will not be described in detail in this application.

[0092] S203, tracking the second feature points in the multiple frames of the second image collected at each moment to obtain feature tracking information of the second image at each moment; wherein the feature point tracking information is used to associate the same feature points in the second image.

[0093] In the embodiment of the present application, since the wide-angle lens has a large field of view, the wide-angle lens is used as a tracking lens to track feature points, so that the position change of the feature can be known, and the probability of missing the same object or feature point between two frames of images captured by the wide-angle lens will be reduced. Among them, the second feature points in multiple frames of second images captured at each moment can be tracked by the optical flow method to obtain the feature tracking information of the second image at each moment.

[0094] Among them, the above-mentioned optical flow method refers to the LK (Lucas–Kanade) optical flow algorithm, and the LK optical flow can be used to track the image. Specifically, by making the "grayscale invariant" assumption and the "pixels in a certain window have the same motion" assumption for the observed quantity, the change of pixels in the image sequence in the time domain and the correlation between adjacent frames are used to find the correspondence between the previous frame and the current frame, thereby calculating the motion information of the object between adjacent frames, so that the position movement of the same point can be tracked in the previous and next two frames. Among them, the method of tracking the image by LK optical flow in the prior art can be used to track the feature points in the second image at each moment, which will not be elaborated in this application.

[0095] See also Figure 6 , Figure 6 A schematic diagram of a feature point tracking provided in an embodiment of the present application. Figure 6 As shown, the feature point A in the second image at time 1 is the same feature point as the feature point A1 in the second image at time 2.

[0096] In the embodiment of the present application, the above-mentioned image feature point matching result and feature tracking information are combined to obtain the following: Figure 7 The relationship diagram is shown. Figure 7 It can be seen that in the second image (wide-angle image) corresponding to time 1 and time 2, feature point A and feature point A1 are the same feature point. In the second image corresponding to time 1 and the first image (main camera image), feature point A and feature point A' match and are also the same feature point.

[0097] In the embodiment of the present application, the feature tracking information of the second image at multiple moments is combined with the image feature point matching result to obtain the following: Figure 8 The relationship diagram is shown. Figure 8 It can be seen that the image feature point matching result of the second image a1 at time 1 and the first image b1 is shown, the image feature point matching result of the second image a2 at time 2 and the first image b2 is shown, the image feature point matching result of the second image a3 at time 3 and the first image b3 is shown, and the image feature point matching result of the second image a4 at time 4 and the first image b4 is shown. And the feature tracking information of the second image from time 1 to time 4.

[0098] Among them, all feature points in the second image need to be dedistorted to obtain flat two-dimensional coordinates before the feature points in the second image at two moments can be tracked.

[0099] S204 , based on the first image and the second image collected at each moment, as well as the image feature point matching results and the feature tracking information, calculate and obtain the depth information of the feature points in the first image and the second image at each moment.

[0100] In the embodiment of the present application, in order to more accurately calculate the real depth of the current lens to the photographed object, a binocular lens is formed by the main camera lens and the wide-angle lens to perform binocular depth recovery. That is, the depth information of the feature points in the first image and the second image at each moment is calculated using the first image and the second image captured at each moment, as well as the image feature point matching results and feature tracking information, that is, the real distance between the feature point and the lens.

[0101] Among them, the method of calculating depth in the prior art can be used to calculate the depth of the feature points in the first image and the second image at each moment, which will not be elaborated in this application.

[0102] S205. Calculate the camera pose of the electronic device according to the depth information, and optimize the inertial pose using the camera pose based on a preset constraint relationship to obtain the optimized inertial pose of the electronic device; wherein the inertial pose in the inertial coordinate system obtained by converting the camera pose in the camera coordinate system based on the preset constraint relationship is the same as the inertial pose of the electronic device.

[0103] In an embodiment of the present application, after a stable feature point tracking relationship and relatively accurate depth information of the feature points have been obtained, the pose of the electronic device can be optimally estimated through a preset constraint relationship between the pose calculated by the camera and the pose calculated by the IMU to obtain an optimized pose.

[0104] The camera pose calculation is to obtain the rotation matrix R and the translation vector t representing the camera motion. The camera pose of the electronic device can be obtained by using the method of calculating the camera pose in the prior art, which will not be described in detail in this application.

[0105] After calculating the camera pose and IMU pose of the electronic device, it can be applied to electronic image stabilization (EIS). However, in traditional EIS, the information of IMU and camera (CAM) is loosely coupled, and each is calculated separately. At the CAM moment, the CAM pose is output, and at the IMU moment, the smoothed IMU pose is output. The constraint relationship between the two is not used. Therefore, the pose estimation link of EIS is not accurate enough in many cases. Among them, the CAM moment refers to the moment when the next frame of image is obtained and the camera pose can be calculated. The IMU moment refers to the moment when the IMU obtains the IMU data and can calculate the IMU pose.

[0106] like Fig. 9 As shown in the figure, the data output frequency of the IMU is higher than the image acquisition frequency of the CAM, that is, the output frequency of the IMU posture is higher than the output frequency of the camera posture. Since the IMU is affected by its own temperature, zero bias, vibration and other factors, the translation and rotation obtained by integration are prone to drift, while the camera posture can effectively correct the accumulated error of the IMU.

[0107] Therefore, the present application can optimize the posture of the electronic device by using the constraint relationship between the camera posture and the IMU posture, and obtain a more accurate optimized posture. Using the optimized posture, a more accurate judgment can be made on the current position, and an accurate knowledge of how to perform anti-shake can be obtained.

[0108] like Fig.10 As shown, during the movement of the camera, for the same feature points in the image frames at different times, the camera pose is calculated by the camera, and the IMU pose is calculated by the IMU. Then, based on the constraint relationship between the IMU pose and the camera pose, the camera pose is used to optimize the IMU pose to obtain the optimized pose of the electronic device.

[0109] like Fig.11 As shown in the figure, taking a mobile phone as an example, the mobile phone contains two cameras, corresponding to the camera coordinate system, and the IMU contained in it also corresponds to the IMU coordinate system. The camera pose calculated by the camera, converted to the pose obtained in the IMU coordinate system, should be the same as the IMU pose.

[0110] In the embodiment of the present application, the preset constraint relationship between the camera pose and the IMU pose can be obtained. Among them, the preset constraint relationship includes: a. There are both IMU and CAM in the electronic device. When the electronic device moves, there is a coordinate system conversion between the poses of the two. After the pose conversion, the IMU pose and the CAM pose should be the same. b. The feature points in the common view area of ​​the CAM output images at two moments should have the same position when the image at the previous moment is converted to the image at this moment.

[0111] The above constraint relationship can also be considered to include visual constraints and IMU constraints. In the visual constraints and IMU constraints, the optimized state vector is found, and then the state vector is derived by the visual residual (i.e., reprojection error) and the IMU measurement residual to obtain the optimized state vector.

[0112] The position and posture of the electronic device can be adjusted by constructing the reprojection error of the feature points in the common view area of ​​the image frames at adjacent moments and then minimizing the reprojection error (using a preset optimization algorithm).

[0113] The reprojection error between the second images at adjacent moments is calculated, specifically: let the i-th frame image and the j-th frame image be the second images at adjacent moments. Obtain the projection coordinate value of the feature point of the i-th frame image projected to the camera coordinate system corresponding to the j-th frame image, and the projection coordinate value can be obtained according to the calculated inertial posture conversion. Obtain the measurement coordinate value corresponding to the feature point of the i-th frame image in the camera coordinate system corresponding to the j-th frame image, and the measurement coordinate value is calculated according to the feature tracking information of the above second image. Then, the reprojection error between the second images at adjacent moments is calculated according to the difference between the projection coordinate value and the measurement coordinate value.

[0114] For example, if a feature point in a common view area is moved from the cth i Frame projection to c j On the frame, the feature point is projected to the cth j A projection value is generated on the frame. In addition, through the above optical flow tracking algorithm, the feature point also has a measurement value. The reprojection error is equal to the projection value minus the measurement value. The formula is as follows:

[0115]

[0116] Among them, the feature point is in the cth j The projection value on the frame is obtained according to the transformation of the IMU pose, and the feature point is in the cth j The measurement value on the frame is obtained based on the transformation of the camera pose. According to the above constraint relationship, the position of the feature points in the common view area of ​​the images at two moments should be the same when the image at the previous moment is transformed into the image at this moment, so the projection value minus the measurement value should be close to 0. However, the projection value minus the measurement value is not close to 0, which means that there is a reprojection error, so the reprojection error needs to be minimized.

[0117] The above reprojection error is constructed, and the optimized pose is the IMU pose, so multiple coordinate system transformations are required to solve the reprojection error, that is, from the camera coordinate system of the i-th frame to the IMU coordinate system of the i-th frame, then to the IMU pose in the world coordinate system of the i-th frame, then to the IMU coordinate system of the j-th frame, and finally to the camera coordinate system of the j-th frame.

[0118] Specifically, first, the feature points are passed through the external parameters T bc From c i The camera frame is transformed to the IMU frame, denoted as b i system; then through From b i system to the world system; then through Transform from the world system to the c j The IMU system of the frame, i.e. b j System; Finally, through the external parameters Transform to c j Frame camera system, the formula is as follows:

[0119]

[0120] The conversion projection formula is as follows:

[0121]

[0122] Find the partial derivative of the variables to be optimized in the formula, and the partial derivative should be close to 0. The variables to be optimized may include:

[0123]

[0124] It should be noted that the above variables to be optimized are obtained by constructing reprojection errors for feature points between image frames at adjacent moments. In some other embodiments, the above formula can also be constructed based on feature points between image frames multiple moments ago and image frames at this moment (for example, between the i-th frame and the i+10-th frame) to obtain the variables to be optimized. That is to say, under the content described in this application, the above constructed formula can be transformed accordingly according to the changes in the variables, wherein the transformation of the variables is not limited to the image frames multiple moments ago and the image frames at this moment in the above examples. And, the variables to be optimized obtained in this way can also be changed, and are not limited to the above-listed variables to be optimized.

[0125] Since the above problem is a nonlinear problem, it is not possible to directly obtain 0, and it is necessary to use an iterative solver. In the embodiment of the present application, the Levenberg-Marquadt method can be used to iteratively solve. Among them, other optimization algorithms can also be used for solving, and the present application does not limit it here.

[0126] Therefore, through the above-mentioned nonlinear optimization of the reprojection error, the optimized inertial pose is obtained.

[0127] Among them, it can be seen that the IMU pre-integration formula is as follows:

[0128]

[0129]

[0130]

[0131] In the above formula, due to the visual constraint, the IMU two frames b will be adjusted k 、b (k+1) The pose between the two frames makes the residual minimum, which will cause the equal sign in the pre-integration formula to be incomplete. Therefore, the two frames cannot be constrained only by vision, but also by IMU pre-integration. That is, the pre-integration residual of the inertial data between adjacent moments is calculated, and the pre-integration residual is nonlinearly optimized using a preset optimization algorithm to obtain the state quantity of the optimized inertial measurement unit.

[0132] Therefore, the formula for constructing the pre-integrated component residual is as follows:

[0133]

[0134] Find the partial derivative of the variables to be optimized in the formula, and the partial derivative should be close to 0. The variables to be optimized may include:

[0135]

[0136] It should be noted that the above variables to be optimized are also obtained by constructing IMU residuals between image frames at adjacent moments. In some other embodiments, the above formula can also be constructed based on the image frames before multiple moments and the image frames at this moment (for example, between the i-th frame and the i+10-th frame) to obtain the variables to be optimized. In other words, under the content described in this application, the above constructed formula can be transformed accordingly according to the changes in the variables, wherein the transformation of the variables is not limited to the image frames before multiple moments and the image frames at this moment in the above examples. And, the variables to be optimized obtained in this way may also change, and are not limited to the variables to be optimized listed above.

[0137] Similarly, since the above problem is a nonlinear problem, it is not possible to directly obtain 0, and it is necessary to solve it through an iterative solver. In the embodiment of the present application, the Levenberg-Marquadt method can be used to iteratively solve. Among them, other optimization algorithms can also be used for solving, and the present application does not limit it here.

[0138] Among them, the state quantities of the IMU can be corrected through the above-mentioned nonlinear optimization of the IMU residual. The state quantities of the IMU include the position P, velocity V, rotation Q and acceleration bias (bias) and gyroscope bias (bias) of the IMU.

[0139] Therefore, by optimizing the above reprojection error and IMU residual, the optimized posture of the electronic device is obtained, and the optimized camera posture and optimized IMU posture can also be expressed, and the optimized IMU state quantity is obtained. The optimized posture of the electronic device and the optimized IMU state quantity can participate in the posture calculation at the next moment, so that the posture deduced by the IMU between the next CAM moments is relatively accurate.

[0140] The embodiment of the present application can calculate the high-precision posture of the electronic device through the constraint relationship between the camera posture and the IMU posture, and through the correction of the IMU posture by the camera posture. In addition, the high-precision posture can be output at a stable high frequency, which can be applied to electronic image stabilization to better estimate the position of the feature points at the next moment and produce a more effective stabilization effect.

[0141] See also Fig.12 , Fig.12 FIG. 1 is a flow chart of another posture optimization method provided in an embodiment of the present application. Fig.12 As shown, a wide-angle lens is used as a tracking lens to track feature points at each moment, a wide-angle image captured by the wide-angle lens is used as a reference frame, and a main camera image captured by the main camera lens is used as a matching frame, and feature points are matched between the main camera image and the wide-angle image. The depth information of the feature points in the image at each moment is calculated using the wide-angle image and the main camera image captured at each moment, as well as the image feature point matching results and feature tracking information, that is, the real distance between the feature points and the lens. Then, the electronic device calculates the camera pose of the electronic device based on the depth information of the feature points. The IMU in the electronic device measures the inertial data of the electronic device at adjacent moments, performs pre-integration processing on the inertial data, and obtains the IMU pose.

[0142] Then, the electronic device uses the camera pose to correct the IMU pose through the constraint relationship between the camera pose and the IMU pose. The constraint relationship includes visual constraints and IMU constraints. In the visual constraints and IMU constraints, the optimized state vector is found, and then the state vector is differentiated by the visual residual (i.e., reprojection error) and the IMU measurement residual to obtain the optimized state vector.

[0143] Among them, the reprojection error and IMU residual are optimized by nonlinear optimization method, and finally the optimized posture of the electronic device and the optimized state of the IMU are obtained.

[0144] In the embodiment of the present application, a wide-angle lens can be used for visual tracking, and a wide-angle lens and a main camera lens can be used for binocular depth recovery. Then, the constraint relationship between the camera and the inertial measurement unit is used to optimize the posture, and the optimal estimate of the current posture is obtained, which improves the accuracy and stability of the posture estimation, and then a more accurate judgment can be made on the current position, improving the positioning effect of the electronic device.

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

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

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

[0148] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

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

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

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

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

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

Claims

1. A posture optimization method, applied to an electronic device, the electronic device comprising a main camera lens, a wide-angle lens and an inertial measurement unit, characterized in that: The method comprises: The inertial position and posture of the electronic device are collected by the inertial measurement unit, the first image is collected by the main camera lens, and the second image is collected by the wide-angle lens; Matching a first feature point of the first image with a second feature point of the second image to obtain an image feature point matching result; wherein the first feature point is obtained by feature extraction of the first image, and the second feature point is obtained by feature extraction of the second image, and the image feature point matching result is used to associate matching feature points in the first image and the second image; Tracking the second feature points in multiple frames of the second image collected at each moment to obtain feature tracking information of the second image at each moment; wherein the feature point tracking information is used to associate the same feature points in the second image; Based on the first image and the second image collected at each moment, as well as the image feature point matching results and the feature tracking information, calculate the depth information of the feature points in the first image and the second image at each moment; The camera pose of the electronic device is calculated according to the depth information, and the inertial pose is optimized using the camera pose based on a preset constraint relationship to obtain the optimized inertial pose of the electronic device; wherein the inertial pose in the inertial coordinate system obtained by converting the camera pose in the camera coordinate system based on the preset constraint relationship is the same as the inertial pose of the electronic device.

2. The posture optimization method according to claim 1, characterized in that: The matching of the feature points of the first image with the feature points of the second image to obtain an image feature point matching result includes: Extracting first feature points of the first image and second feature points of the second image using a preset feature extraction method; Feature matching is performed on the first feature point and the second feature point by means of descriptor matching, and a feature point matching the first feature point is determined from the second feature points.

3. The posture optimization method according to claim 2, characterized in that: The performing feature matching on the first feature point and the second feature point by means of descriptor matching, and determining a feature point matching the first feature point from the second feature point, comprises: Using a quadtree method to perform sparse processing on the first feature point and the second feature point to obtain sparse first feature points and sparse second feature points; Feature matching is performed on the thinned first feature points and the thinned second feature points by means of descriptor matching, and feature points matching the thinned first feature points are determined from the thinned second feature points.

4. The posture optimization method according to claim 2 or 3, characterized in that: The performing feature matching on the first feature point and the second feature point by means of descriptor matching, and determining a feature point matching the first feature point from the second feature point, comprises: Obtaining a first descriptor of the first feature point and a second descriptor of the second feature point; The Hamming distance between each of the second descriptors and the first descriptor is calculated respectively, and a second feature point corresponding to the second descriptor having the smallest Hamming distance with the first descriptor is determined as a feature point that matches the first feature point.

5. The posture optimization method according to any one of claims 1 to 4, characterized in that: Tracking the second feature points in the multiple frames of the second image collected at each moment to obtain feature tracking information of the second image at each moment includes: The second feature points in multiple frames of the second image collected at each moment are tracked by an optical flow method to obtain feature tracking information of the second image at each moment.

6. The posture optimization method according to any one of claims 1 to 5, characterized in that: The collecting the inertial posture of the electronic device by the inertial measurement unit includes: The inertial measurement unit measures the inertial data of the electronic device at adjacent moments, and performs pre-integration processing on the inertial data to obtain an inertial posture.

7. The posture optimization method according to any one of claims 1 to 6, characterized in that: The step of optimizing the inertial posture using the camera posture based on the preset constraint relationship to obtain the optimized inertial posture of the electronic device includes: The reprojection error between the second images at adjacent moments is calculated, and the reprojection error is nonlinearly optimized using a preset optimization algorithm to obtain the optimized inertial posture of the electronic device.

8. The posture optimization method according to claim 7, characterized in that: The calculating the reprojection error between the second images at adjacent moments comprises: Obtaining projection coordinate values ​​of feature points of the i-th frame image projected onto a camera coordinate system corresponding to the j-th frame image, and measurement coordinate values ​​corresponding to the feature points of the i-th frame image in the camera coordinate system corresponding to the j-th frame image, wherein the i-th frame image and the j-th frame image are second images at adjacent moments, the projection coordinate values ​​are obtained according to the inertial posture, and the measurement coordinate values ​​are calculated according to feature tracking information of the second image; A reprojection error between second images at adjacent moments is calculated according to a difference between the projection coordinate value and the measurement coordinate value.

9. The posture optimization method according to any one of claims 1 to 8, characterized in that: The method further comprises: The pre-integration residual of the inertial data between adjacent moments is calculated, and the pre-integration residual is nonlinearly optimized using a preset optimization algorithm to obtain the state quantity of the optimized inertial measurement unit.

10. An electronic device, characterized in that: The electronic device comprises: a communication module, a display screen, a memory and one or more processors; the communication module, the display screen, the memory and the processor are coupled; the memory is used to store computer program code, and the computer program code comprises computer instructions, and when the computer instructions are executed by the electronic device, the electronic device executes the method as described in any one of claims 1-9.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed in the mobile terminal, the mobile terminal executes the method according to any one of claims 1 to 9.