Magnetometer external parameter calibration method, system and device of electronic device and storage medium

By obtaining magnetometer data by rotating the electronic device around the first axis while it is stationary, calculating the rotation matrix and eliminating soft and hard magnetic interference, the external parameters of the magnetometer are directly calibrated, which solves the low efficiency problem of the existing technology and realizes efficient external parameter calibration.

CN120703660APending Publication Date: 2025-09-26湖北星纪魅族集团有限公司
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202510695572.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-27
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

In the prior art, complex soft and hard magnetic calibration is required before calibrating the external parameters of the magnetometer, resulting in low calibration efficiency and affecting the accuracy and availability of the magnetometer data.

Method used

By rotating the electronic device around the first axis while it is stationary, multiple magnetometer data are acquired, the rotation matrix is ​​calculated, and soft and hard magnetic interferences are eliminated. The external parameters of the magnetometer are directly calibrated, thus simplifying the calibration process.

Benefits of technology

The efficiency of magnetometer external parameter calibration is improved, the calibration process is simplified, and the accuracy and availability of magnetometer data are ensured.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120703660A_ABST
    Figure CN120703660A_ABST
Patent Text Reader

Abstract

The invention discloses a magnetometer external parameter calibration method, system and device of an electronic device and a storage medium, and belongs to the technical field of magnetometer calibration, the method comprises the following steps: determining a first axis and a second axis of the electronic device placed on a horizontal plane and in a static state, the first axis being perpendicular to the horizontal plane, and the second axis pointing to a first direction; in the process that the electronic equipment rotates around the first shaft for at least one circle, multiple pieces of first magnetometer data collected by the magnetometer are obtained; calculating a first rotation matrix of the first axis of the magnetometer transformed to the first axis of the electronic device; selecting second magnetometer data measured when a second shaft of the electronic equipment points to the first direction, and performing soft magnetism and hard magnetism elimination on the second magnetometer data to obtain third magnetometer data; calculating a second rotation matrix, determined by the third magnetometer data, of the second axis of the magnetometer converted into the second axis of the electronic equipment in the static state; and calibrating external parameters of the magnetometer based on the first rotation matrix and the second rotation matrix.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of magnetometer calibration, and in particular to a method, system, device and storage medium for calibrating external parameters of a magnetometer of an electronic device. Background Art

[0002] To ensure that electronic devices with magnetometers provide true geographic orientation information, they must undergo both soft and hard magnetic calibration, as well as extrinsic parameter calibration. Soft and hard magnetic calibration compensates for errors in the three-axis magnetometer's own coordinate system, enabling the magnetometer to measure more accurate magnetometer data. Extrinsic parameter calibration, on the other hand, calculates the rotation matrix between the magnetometer's coordinate system and the electronic device's coordinate system, thereby aligning the magnetometer's coordinate system with the electronic device's coordinate system.

[0003] Since external parameter calibration requires the use of magnetometer data, the accuracy and availability of magnetometer data directly affect the precision of external parameter calibration. Therefore, in related technologies, soft and hard magnetic calibration must be performed before magnetometer external parameter calibration to ensure the accuracy and availability of magnetometer data. That is, soft and hard magnetic calibration must be performed before magnetometer external parameter calibration, which makes the entire external parameter calibration process complicated and the calibration efficiency low. Summary of the Invention

[0004] In a first aspect, an embodiment of the present application provides a method for calibrating external parameters of a magnetometer of an electronic device, comprising: Determine a first axis and a second axis of the electronic device placed on a horizontal plane and in a stationary state, wherein the first axis of the electronic device is perpendicular to the horizontal plane and the second axis of the electronic device points in a first direction; Acquire a plurality of first magnetometer data collected by the magnetometer during at least one rotation of the electronic device around the first axis of the electronic device in a stationary state; calculate a first rotation matrix that transforms the first axis of the magnetometer to the first axis of the electronic device in the stationary state, determined by fitting the plurality of first magnetometer data; Selecting second magnetometer data measured when the second axis of the electronic device points to the first direction from the plurality of first magnetometer data, and performing soft magnetism and hard magnetism elimination on the second magnetometer data to obtain third magnetometer data; Calculating a second rotation matrix for transforming the second axis of the magnetometer determined by the third magnetometer data to the second axis of the electronic device in a stationary state; The extrinsic parameters of the magnetometer are calibrated based on the first rotation matrix and the second rotation matrix.

[0005] In some embodiments, calculating a first rotation matrix that transforms the first axis of the magnetometer determined by fitting the plurality of first magnetometer data to the first axis of the electronic device in a stationary state includes: Fitting a first plane based on the plurality of first magnetometer data, and determining a normal to the first plane; The first rotation matrix is ​​calculated based on the normal and the first axis of the electronic device in a stationary state.

[0006] In some embodiments, performing soft magnetic and hard magnetic elimination on the second magnetometer data to obtain third magnetometer data includes: Fitting a first ellipse based on the plurality of first magnetometer data, and obtaining a first center of the first ellipse; determining second transformed magnetometer data corresponding to the second magnetometer data when the first ellipse is transformed into a circle, so as to perform soft magnetism elimination; Hard magnetism elimination is performed on the second transformed magnetometer data based on the first circle center to obtain the third magnetometer data.

[0007] In some embodiments, fitting a first ellipse based on the plurality of first magnetometer data comprises: fitting a second plane based on the plurality of first magnetometer data; Determining projection points of the plurality of first magnetometer data in the second plane; fitting the first ellipse based on the projection points; The transformation of the first ellipse into a circle includes: taking the first center of the first ellipse as the center of the circle, and the square root of the product of the major semi-axis and the minor semi-axis of the first ellipse as the radius of the circle, to restore the first ellipse into a circle.

[0008] In some embodiments, before the electronic device rotates around the first axis of the electronic device in a stationary state, the method further includes: collecting fourth magnetometer data of the electronic device in a stationary state, and determining a first component of the first direction in the fourth magnetometer data; Calculating a second rotation matrix for transforming the second axis of the magnetometer determined by the third magnetometer data to the second axis of the electronic device in a stationary state, comprising: performing a first axis transformation on the third magnetometer data to obtain fifth magnetometer data; Acquire a horizontal component of the fifth magnetometer data, wherein the horizontal component indicates a second axis of the magnetometer after the first axis transformation, and the first component indicates the second axis of the electronic device in a stationary state; The second rotation matrix is ​​calculated according to the first component and the horizontal component.

[0009] In some embodiments, the horizontal plane is a plane of a hexahedron, and the first axis, the second axis, and the third axis of the electronic device in a stationary state are all perpendicular to two opposite planes of the hexahedron.

[0010] In a second aspect, an embodiment of the present application further provides a magnetometer extrinsic parameter calibration system for an electronic device, comprising: electronic devices; a hexahedron, wherein the electronic device is placed on a horizontal plane of the hexahedron; A calibration device, the calibration device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for calibrating the external parameters of a magnetometer of an electronic device as described in any one of the above is implemented.

[0011] In a third aspect, an embodiment of the present application also provides a calibration device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements a magnetometer external parameter calibration method for an electronic device as described in any one of the above.

[0012] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising a magnetometer calibrated with external parameters according to any of the above-described methods for calibrating external parameters of a magnetometer of an electronic device.

[0013] In a fifth aspect, an embodiment of the present application further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a magnetometer external parameter calibration method for an electronic device as described in any one of the above. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] In order to more clearly illustrate the technical solutions in this application or related technologies, the following is a brief introduction to the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0015] Figure 1 This is a schematic diagram of the principle of soft and hard magnetic calibration of the magnetometer.

[0016] Figure 2 It is a schematic diagram of the structure of the terminal provided in an embodiment of the present application.

[0017] Figure 3 This is a flow chart of a method for calibrating external parameters of a magnetometer of an electronic device provided in an embodiment of the present application.

[0018] Figure 4 It is a structural diagram of the AR glasses provided in an embodiment of the present application.

[0019] Figure 5 This is a schematic diagram of defining the coordinate system of an electronic device in the method for calibrating the external parameters of a magnetometer of an electronic device provided in an embodiment of the present application.

[0020] Figure 6 This is a schematic diagram of fitting a plane and an ellipse in the extrinsic parameter calibration method of a magnetometer of an electronic device provided in an embodiment of the present application.

[0021] Figure 7 This is a schematic diagram of the distribution of the first magnetometer data after eliminating soft magnetism in the magnetometer extrinsic parameter calibration method for an electronic device provided in an embodiment of the present application.

[0022] Figure 8 This is a schematic diagram of the distribution of the first magnetometer data after eliminating soft and hard magnetism in the magnetometer extrinsic parameter calibration method of the electronic device provided in an embodiment of the present application.

[0023] Figure 9 This is a schematic diagram of the structure of the magnetometer extrinsic parameter calibration system of the electronic device provided in the embodiment of the present application.

[0024] Figure 10 It is a structural diagram of the calibration device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0025] To make the objectives, technical solutions, and advantages of this application more clear, the technical solutions of this application will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments of this application, all other embodiments obtained by ordinary technicians in this field without making any creative efforts are within the scope of protection of this application.

[0026] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this application can be implemented in an order other than that illustrated or described herein, and that the objects distinguished by "first" and "second" are generally of the same type, and do not limit the number of objects. For example, the first object can be one or more. In addition, the term "and / or" in the specification and claims refers to at least one of the connected objects, and the character " / " generally indicates that the objects connected are in an "or" relationship.

[0027] An inertial measurement unit (IMU) is a device that measures an object's three-axis attitude angle and acceleration. Some IMUs include a three-axis gyroscope, a three-axis accelerometer, and a three-axis magnetometer. The gyroscope is used to measure the three-axis angular velocity, the accelerometer is used to measure the three-axis acceleration, and the magnetometer provides orientation information. The magnetometer data makes up for the problem that the accelerometer cannot measure the horizontal yaw angle (Heading (Yaw)). Through the mutual correction of these three sensors, the IMU can obtain more accurate attitude parameters of electronic devices equipped with IMU.

[0028] It can be understood that the accuracy of the internal and external parameters between the above three sensors and the electronic device has a great impact on the overall positioning accuracy of the electronic device. Therefore, a good calibration result is a prerequisite for the positioning system to work.

[0029] In the field of extrinsic calibration, particularly for magnetometers, to ensure that the magnetometer provides true geographic location information to electronic devices such as smart watches, smart bracelets, smart rings, augmented reality (AR) / virtual reality (VR) / mixed reality (Mixed Reality) devices, mobile phones, laptops, ultra-mobile personal computers (UMPCs), netbooks, and personal digital assistants (PDAs), the magnetometers in these electronic devices require both soft and hard magnetic calibration (i.e., intrinsic calibration) and extrinsic calibration. Soft and hard magnetic calibration refers to error compensation within the three-axis magnetometer's own coordinate system, while extrinsic calibration involves determining the rotation matrix between the magnetometer and the electronic device to align the magnetometer coordinates with the electronic device's coordinates.

[0030] For a magnetometer, if the magnetometer is rotated in space around the origin of the magnetometer coordinate system, along the three orthogonal axes of the magnetometer (such as Figure 1 Ideally, the magnetometer data measured by Bx, By, and Bz are distributed on a spherical surface, and the center of the sphere is the origin of the magnetometer coordinate system, as shown in Figure 1 The blue data points in the middle are the spherical surface formed by the three-axis magnetometer data collected under ideal conditions. If the magnetometer is subject to soft magnetic interference, the three-axis magnetometer data will no longer be fitted into a sphere but will be distorted into an ellipsoid. If the magnetometer is subject to hard magnetic interference, the center of the sphere / ellipsoid will be offset and will no longer be the origin of the magnetometer coordinate system. Figure 1The ellipsoid and ellipsoid center formed by the red data points in the middle. It can be seen that after being affected by soft and hard magnetic interference, the magnetometer data measured by the magnetometer is inaccurate and unreliable. Using inaccurate and unreliable magnetometer data for external parameter calibration will also result in inaccurate external parameters, and the magnetometer coordinate system and the electronic device coordinate system cannot be truly aligned. Therefore, in the related art, the magnetometer needs to be calibrated with soft and hard magnetics before external parameter calibration, so that after soft and hard magnetic calibration, the magnetometer can measure magnetometer data with high accuracy and reliability, thereby improving the accuracy of external parameter calibration.

[0031] It should be noted that the soft magnetic calibration of a magnetometer uses a 3×3 matrix as the soft magnetic parameters to restore the ellipsoid to a sphere, while the hard magnetic calibration uses a 3×1 vector as the hard magnetic parameters to restore the center of the sphere to the origin of the magnetometer coordinate system. In other words, soft and hard magnetic calibration requires collecting magnetometer data from three orthogonal axes in the magnetometer coordinate system, and ensuring that this magnetometer data is distributed evenly. Therefore, in related technologies, soft and hard magnetic calibration involves the collection and processing of a large amount of data, which in turn makes the entire extrinsic parameter calibration process complex and inefficient.

[0032] To this end, an embodiment of the present application provides a method for calibrating the external parameters of a magnetometer of an electronic device, which determines the first axis and the second axis of the electronic device placed on a horizontal plane and in a stationary state, wherein the first axis of the electronic device is perpendicular to the horizontal plane, and the second axis of the electronic device points in a first direction; in the process of the electronic device rotating at least one circle around the first axis of the electronic device in the stationary state, obtains multiple first magnetometer data collected by the magnetometer; calculates a first rotation matrix that transforms the first axis of the magnetometer determined by fitting the multiple first magnetometer data to the first axis of the electronic device in the stationary state; selects second magnetometer data measured when the second axis of the electronic device points to the first direction from the multiple first magnetometer data, and performs soft magnetic and hard magnetic elimination on the second magnetometer data to obtain third magnetometer data; calculates a second rotation matrix that transforms the second axis of the magnetometer determined by the third magnetometer data to the second axis of the electronic device in the stationary state; and calibrates the external parameters of the magnetometer based on the first rotation matrix and the second rotation matrix. That is, the method of the present application does not require soft and hard magnetic calibration of the magnetometer before calibrating the external parameters of the magnetometer. That is, the method provided in the embodiment of the present application can calibrate the external parameters of the magnetometer to the electronic device without calibrating the complete soft and hard magnetic properties of the magnetometer in advance, thereby simplifying the entire external parameter calibration process and improving the external parameter calibration efficiency of the magnetometer.

[0033] The method for calibrating the external parameters of a magnetometer of an electronic device provided in an embodiment of the present application can be applied to a calibration device, and the calibration device can be the electronic device itself described in the embodiment of the present application, that is, the steps described in the method are performed by the electronic device having a magnetometer itself, or the calibration device can be other devices, for example, other devices (which may or may not have a magnetometer) that establish a communication connection (including a direct connection or an indirect connection) with the electronic device. In other words, the present application does not limit the electronic device having a magnetometer and the calibration device to be the same device or different devices. In some examples, the calibration device can be a mobile phone, a tablet computer, a wearable device, an in-vehicle device, an augmented reality (AR) / virtual reality (VR) device (such as AR glasses), a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc. It can also be a database, a server, and a service response system based on terminal artificial intelligence. The embodiment of the present application does not impose any restrictions on the specific type of the calibration device.

[0034] For example, the calibration device can be a station (STAION, ST) in a WLAN, a cellular phone, a cordless phone, a Session Initiation Protocol (SIP) phone, a Wireless Local Loop (WLL) station, a Personal Digital Assistant (PDA) device, a handheld device with wireless communication capabilities, a computing device or other processing device connected to a wireless modem, a computer, a laptop computer, a handheld communication device, a handheld computing device, and / or other devices for communicating on a wireless system and next-generation communication systems, such as mobile terminals in a 5G network, mobile terminals in a future-evolved Public Land Mobile Network (PLMN), or mobile terminals in a future-evolved Non-terrestrial Network (NTN).

[0035] As an example and not a limitation, when the calibration device is a wearable device, the wearable device can also be a general term for wearable devices that are intelligently designed and developed by applying wearable technology to daily wear, such as gloves, watches, AR (Augmented Reality) head-mounted display devices, VR (Virtual Reality) head-mounted display devices or MR (Mixed Reality) head-mounted display devices equipped with far-field communication modules and / or near-field communication modules.

[0036] In some embodiments, the calibration device may be a device having Figure 2 The hardware structure of the mobile phone 100 is shown as follows: Figure 2 As shown, the mobile phone 100 may specifically include components such as a radio frequency (RF) circuit 110, a memory 120, an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, a short-range wireless communication module 170, a processor 180, and a power supply 190. Those skilled in the art will understand that Figure 2 The structure of the mobile phone 100 shown in the figure does not constitute a limitation on the calibration device. The calibration device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0037] The following combination Figure 2 A detailed introduction to the various components of a mobile phone: The RF circuit 110 can be used to receive and send signals during information transmission or calls. In particular, after receiving the downlink information from the base station, it is sent to the processor 180 for processing; in addition, the designed uplink data is sent to the base station. Generally, the RF circuit includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier (LNA), a duplexer, etc. In addition, the RF circuit 110 can also communicate with the network and other devices through wireless communication. The above-mentioned wireless communication can use any communication standard or protocol, and the wireless communication can 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), new radio (NR), GNSS, FM, low-orbit satellite connection 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), etc.

[0038] The memory 120 can be used to store software programs and modules. The processor 180 executes various functional applications and data processing of the mobile phone by running the software programs and modules stored in the memory 120. The memory 120 may mainly include a program storage area and a data storage area, wherein 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 according to the use of the mobile phone (such as pictures, audio data, phone books, etc.), etc. In addition, the memory 120 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, or other volatile solid-state storage device. Specifically, the memory 120 may store pictures taken by an electronic device or downloaded via a wireless network.

[0039] The input unit 130 can be used to receive input digital or character information, and to generate key signal input related to the user settings and function control of the mobile phone 100. Specifically, the input unit 130 may include a touch panel 131 and other input devices 132. The touch panel 131, also known as a touch screen, can collect user touch operations on or near it (such as operations performed by the user using a finger, stylus, or any other suitable object or accessory on or near the touch panel 131) and drive the corresponding connection device according to a pre-set program. Optionally, the touch panel 131 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch direction and detects the signal caused by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device and converts it into touch point coordinates, which are then sent to the processor 180. It can also receive commands sent by the processor 180 and execute them. In addition, the touch panel 131 can be implemented using various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch panel 131, the input unit 130 may further include other input devices 132. Specifically, the other input devices 132 may include but are not limited to one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick.

[0040] The display unit 140 can be used to display information input by the user or information provided to the user and various menus of the mobile phone. The display unit 140 may include a display panel 141. Optionally, the display panel 141 may be configured in the form of a liquid crystal display (LCD), a light emitting diode (LED), an organic light emitting diode (OLED), an active-matrix organic light emitting diode (AMOLED), etc. Further, the touch panel 131 may cover the display panel 141. When the touch panel 131 detects a touch operation on or near it, it is transmitted to the processor 180 to determine the type of touch event. The processor 180 then provides corresponding visual output on the display panel 141 according to the type of touch event. Although in Figure 2 In the embodiment, the touch panel 131 and the display panel 141 are used as two independent components to realize the input and output functions of the mobile phone, but in some embodiments, the touch panel 131 and the display panel 141 can be integrated to realize the input and output functions of the mobile phone.

[0041] The mobile phone 100 may also include at least one sensor 150, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor may include an ambient light sensor and a proximity sensor, wherein the ambient light sensor may adjust the brightness of the display panel 141 according to the brightness of the ambient light, and the proximity sensor may turn off the display panel 141 and / or the backlight when the mobile phone is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in all directions (generally three axes), and can detect the magnitude and direction of gravity when stationary. It can be used for applications that identify the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; as for other sensors that the mobile phone can also be configured with, such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc., they will not be described here.

[0042] Audio circuit 160, speaker 161, and microphone 162 provide an audio interface between the user and the phone. Audio circuit 160 converts received audio data into electrical signals and transmits them to speaker 161, which then converts them into sound signals for output. Microphone 162, on the other hand, converts collected sound signals into electrical signals, which are then received by audio circuit 160 and converted into audio data. The audio data is then processed by processor 180 and transmitted via RF circuit 110 to, for example, another electronic device, or to memory 120 for further processing.

[0043] Communication technologies such as Wi-Fi, Bluetooth, and Near Field Communication (NFC) are short-range wireless transmission technologies. The mobile phone can help users send and receive emails, browse web pages, and access streaming media through the short-range wireless communication module 170, which provides users with wireless broadband Internet access. The above-mentioned short-range wireless communication module 170 may include a Wi-Fi chip, a Bluetooth chip, and an NFC chip. The Wi-Fi chip can realize the function of Wi-Fi Direct connection between the mobile phone 100 and other electronic devices, and can also enable the mobile phone 100 to operate in AP mode (Access Point mode) that can provide wireless access services and allow other wireless devices to access, or in STA mode (Station mode) that can connect to an AP but does not accept access from wireless devices, thereby establishing point-to-point communication between the mobile phone 100 and other Wi-Fi devices.

[0044] The processor 180 is the control center of the mobile phone. It uses various interfaces and lines to connect all parts of the mobile phone. By running or executing software programs and / or modules stored in the memory 120 and calling data stored in the memory 120, it performs various functions of the mobile phone and processes data, thereby monitoring the entire mobile phone. Optionally, the processor 180 may include one or more processing units. Optionally, the processor 180 may include, for example, 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 / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.

[0045] The mobile phone 100 also includes a power supply 190 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 180 through a power management system, thereby managing functions such as charging, discharging, and power consumption through the power management system.

[0046] The mobile phone 100 may further include a camera. Optionally, the camera may be located at the front or rear of the mobile phone, which is not limited in the present embodiment.

[0047] Figure 3This is one of the flow diagrams of the method for calibrating the external parameters of a magnetometer of an electronic device provided in an embodiment of the present application, which includes steps S310, S320, S330, S340, and S350. The steps of this method are only a possible implementation of the present application.

[0048] Step S310: determining a first axis and a second axis of the electronic device placed on a horizontal plane and in a stationary state, wherein the first axis of the electronic device is perpendicular to the horizontal plane and the second axis of the electronic device points to a first direction.

[0049] Specifically, this document uses the electronic device as an AR device, such as AR glasses, for example. It should be understood that this is not a limitation of this application.

[0050] like Figure 4 As shown in FIG, it is a schematic diagram of AR glasses provided in an example of at least one embodiment of the present disclosure. Figure 4 As shown, Figure 4 An example of the structure of AR glasses is shown. AR glasses can have a structure similar to conventional glasses, including lenses 1010, a frame 1020, and one or more temples 1030. For example, AR glasses can also provide various "intelligent" functions that conventional glasses cannot, such as audio and video playback, application display, voice interaction, and real-time translation. Therefore, AR glasses integrate the relevant components required for computing devices to implement intelligent functions. For example, the processing unit of AR glasses can be located within the temple 1030, such as in the location of the processing unit 1031 shown in the figure. The processing unit can perform various operations based on received instructions, such as using a first display unit (also referred to as the "left-eye display unit") and a second display unit (also referred to as the "right-eye display unit") to project image frames to be displayed for the left and right eyes onto the left and right lenses 1010, respectively. For example, the first and second display units can be used to display the wearer's own voice text and the translated text of non-wearers, or the first and second display units can only display the translated text of non-wearers.

[0051] In some examples, each display unit may include its own optical engine and optical waveguide. The first optical engine (also referred to as the "left optical engine") and the first optical waveguide (also referred to as the "left optical waveguide") are used to display images to the left eye; the second optical engine (also referred to as the "right optical engine") and the second optical waveguide (also referred to as the "right optical waveguide") are used to display images to the right eye. After the optical engine completes the imaging process, the waveguide's grating coupling couples light into its own glass substrate. Through the principle of "total internal reflection," the light is transmitted to the grating coupling, such as in front of the wearer's eye, where it is reflected out of the optical waveguide. During this process, the optical waveguide is solely responsible for transmitting the image and typically does not perform any additional processing (such as scaling) on ​​the image itself. This can be understood as "parallel light in, parallel light out." For example, the optical engine can be configured to image the display position of a cylindrical surface within the viewing window and then transmit the imaged image light through the corresponding optical waveguide to the wearer's eye.

[0052] In order to transmit the image light generated by the optical machine to the human eye, a light coupling-in and light coupling-out process is required on the optical waveguide. Figure 4 An example of left eye image coupling in and out is shown in FIG. Figure 4 As shown, the first optical engine can be located near the left-side light coupling zone 1041, for example, on the left side of the frame. After generating an image, the light coupling zone 1041 can be fed into the first optical waveguide implemented in the left lens. After the light is totally reflected and propagated within the optical waveguide, it is emitted from the specific light coupling zone 1042, thereby being seen by the left eye. Although not shown in the figure, the coupling and decoupling of the right eye image can correspond to the situation of the left eye.

[0053] like Figure 4 As shown, processing unit 1031 can be a single processor or include multiple processors. In some embodiments, processing unit 1031 can include a general-purpose main processor and one or more specialized coprocessors, such as a graphics processing unit (GPU), a digital signal processor (DSP), and the like. In some embodiments, at least a portion of processing unit 1031 can be implemented using customized circuitry, such as an application-specific integrated circuit (ASIC) or a field-programmable gate array (FPGA, also known as a "programmable logic device"). For example, the processing unit can be configured to process the magnetometer extrinsic parameter calibration method described in any embodiment of this application.

[0054] like Figure 4As shown, in order to achieve voice interaction, AR glasses can also be equipped with microphones, such as the first microphone 1032 and the second microphone 1021 shown in the figure. The first microphone 1032 can be set on the temple 1030 so that it can receive the wearer's verbal instructions from a position where the wearer's clear voice can be easily obtained. The second microphone 1021 can be set on the frame, mainly used to obtain voice input from the wearer's conversation partner. The first microphone 1032 and the second microphone 1021 can be regarded as microphone arrays, which are used to directionally enhance the collected voice signals. In other examples, the first microphone 1032 and the second microphone 1021 can both be set at the position of the frame or the temple, for example. AR glasses can also include a speaker 1033 for playing voice feedback or sound content specified by the wearer to the wearer, for example, playing music. In order to provide better sound effects to the wearer, speakers 1033 can be set at positions near the ears of the left and right temples as shown in the figure.

[0055] like Figure 4 As shown, in some examples, a pair of speakers 1033 are provided on the temple 1030, which are configured to form an acoustic dipole effect, for example, one speaker is provided at the top of the temple 1030, and the other speaker is provided at the bottom of the temple 1030. It can be understood that the speaker provided at the bottom of the temple is closer to the wearer's ear, while the speaker provided at the top of the temple is farther away from the wearer's ear. Therefore, the sound fields of the two speakers in the far field of the wearer's ear are canceled out, and there is no effect on the near field sound field, thereby improving the privacy of the AR glasses voice.

[0056] In addition, although Figure 4 Although not shown in the figure, the AR glasses may also include a memory, which can be used to store computer executable program code, the executable program code including instructions, for example, the memory may store a computer program corresponding to the magnetometer extrinsic parameter calibration method described in the embodiment of the present application. The memory may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function, etc. The data storage area may store data created during the use of the AR glasses (such as the first and second audio data collected by the first and second microphones respectively).

[0057] Those skilled in the art will understand that Figure 4This is merely illustrative and does not limit the structure of the AR glasses of the present disclosure. The AR glasses may include more or fewer components than shown, or combine certain components, or arrange the components differently. Alternatively, the components in the AR glasses may be deployed in different locations. For example, the AR glasses may include more microphones. In addition, it will be understood that in the present disclosure, the expressions "first," "second," etc. are used to distinguish similar objects, rather than to describe a specific order or precedence, and do not have any additional limiting effect.

[0058] It should be noted that AR glasses have a glasses body coordinate system, which includes a first axis, a second axis, and a third axis that are mutually orthogonal. The first axis is the coordinate axis in the anti-gravity direction when the AR glasses are placed horizontally, the second axis is the coordinate axis in the direction directly in front of the display unit when the AR glasses are placed horizontally, and the third axis is the coordinate axis in the direction from the left-eye display unit to the right-eye display unit when the AR glasses are placed horizontally. Alternatively, the first axis is the coordinate axis in the anti-gravity direction when the AR glasses are placed horizontally, the third axis is the coordinate axis in the direction directly in front of the display unit when the AR glasses are placed horizontally, and the second axis is the coordinate axis in the direction from the left-eye display unit to the right-eye display unit when the AR glasses are placed horizontally. It will be understood that when the AR glasses are stationary on a horizontal surface, the first axis of the AR glasses is perpendicular to the horizontal plane, and the second axis of the AR glasses is an axis within the horizontal plane pointing in the first direction. In one example, the AR glasses can be placed on a horizontal platform so that the first axis is perpendicular to the horizontal platform surface, and the plane defined by the second and third axes is parallel to the horizontal platform surface.

[0059] It can be understood that the first axis of the AR glasses always remains perpendicular to the horizontal plane, and the second axis of the AR glasses points to the first direction of the horizontal plane. The first direction can be any direction and changes with the orientation of the AR glasses on the horizontal plane. In some examples, in order to facilitate the calculation and orientation of the geographical direction, the first direction can be set to one of the four directions of east, south, west and north. For example: the first direction is as follows: Figure 5 As shown, the direction is north (ie, the Y-axis direction). It can be understood that the second axis component of the magnetometer data is (0, 1, 0). For example, the first direction is as follows: Figure 5 As shown facing east (i.e., the X-axis direction), it can be understood that the second axis component of the magnetometer data at this time is (1, 0, 0).

[0060] like Figure 5As shown, place the AR glasses on a horizontal platform and establish a glasses body coordinate system. The origin of the glasses body coordinate system can be set at the midpoint of the line connecting the centers of the two lenses of the AR glasses. The first axis is the z-axis of the glasses body coordinate system and is perpendicular to the horizontal plane. To facilitate direct geographical orientation based on the line of sight of the human eye, when the AR glasses are stationary on the horizontal platform, their line of sight is aligned with the first direction, and the axis passing through the origin along the line of sight of the AR glasses is set as the second axis. For example, the second axis is the y-axis of the glasses body coordinate system. The third axis of the glasses body coordinate system, the x-axis, passes through the origin and is perpendicular to the yz plane.

[0061] It should be noted that for different electronic devices, the origin position of the electronic device coordinate system and the relationship between the first direction and the orientation of the electronic device can be defined according to the appearance of the electronic device or the form when in use (for example, a mobile phone is usually handheld and the top camera is facing forward). As long as the electronic device is in a horizontal and stationary state, the first axis of the electronic device coordinate system is perpendicular to the horizontal plane and the second axis points to the first direction.

[0062] It should be noted that the magnetometer has a magnetometer coordinate system, which also includes three mutually orthogonal first, second, and third axes. It can be understood that, assuming that the magnetometer is perfectly installed in the AR glasses, the first axis of the magnetometer coordinate system will correspond to the first axis of the glasses body coordinate system, the second axis of the magnetometer coordinate system will correspond to the second axis of the glasses body coordinate system, and the third axis of the magnetometer coordinate system will correspond to the third axis of the glasses body coordinate system. At this time, the extrinsic parameters of the magnetometer are all 1. However, there will always be deviations during actual installation, so it is usually necessary to calculate the extrinsic parameters from the magnetometer coordinate system to the glasses body coordinate system to map the magnetometer data collected in the magnetometer coordinate system to the glasses body coordinate system, providing converted magnetometer data for calculating the posture of the AR glasses.

[0063] Step S320: Acquire multiple first magnetometer data collected by the magnetometer during the process of the electronic device rotating at least one circle around the first axis of the electronic device in a stationary state; calculate a first rotation matrix that transforms the first axis of the magnetometer determined by fitting the multiple first magnetometer data to the first axis of the electronic device in a stationary state.

[0064] In this embodiment, the AR glasses are rotated around the first axis of the AR glasses in a stationary state, that is, the AR glasses are rotated around the first axis in the horizontal plane. The horizontal platform carrying the AR glasses can be rotated along the first axis, thereby making the AR glasses rotate around the first axis in the horizontal plane.

[0065] During the rotation of the AR glasses, the magnetometer inside the glasses also rotates along the first axis of the AR glasses in the horizontal plane, obtaining multiple first magnetometer data for at least one rotation. Since the magnetometer also rotates in the horizontal plane, without considering the error, the first magnetometer data The corresponding data points will be distributed in the same plane. If the magnetometer is not interfered by soft and hard magnets, the data points will form a circle with the center coordinate at the origin of the magnetometer coordinate system; if the magnetometer is interfered by soft and hard magnets, the data points will form an ellipse, and the center of the ellipse will have a certain offset relative to the origin of the magnetometer coordinate system. Figure 6 As shown, a plurality of first magnetometer data are shown The distribution of the corresponding data points in the coordinate system of the glasses body, where the red points represent the first magnetometer data It should be noted that the magnetometer data are all expressed in the magnetometer coordinate system. The restoration of the circular plane and the movement of the origin are all for calibrating the intrinsic parameters of the magnetometer, so the intrinsic and extrinsic parameters are needed to convert them into data in the coordinate system of the glasses body.

[0066] In this step, the first axis, second axis, and third axis of the magnetometer coordinate system can be determined by fitting these data points. For example, the first axis of the magnetometer coordinate system can be determined first, and then the first axis of the magnetometer coordinate system can be transformed to the first axis of the glasses body coordinate system in a stationary state. That is, the first axis of the magnetometer coordinate system and the first axis of the glasses body coordinate system are aligned through a rotation transformation, thereby obtaining a first rotation matrix that transforms the first axis (Z axis) of the magnetometer coordinate system to the first axis (Z axis) of the glasses body coordinate system.

[0067] Step S330: selecting second magnetometer data measured when the second axis of the electronic device points to the first direction from the multiple first magnetometer data, and performing soft magnetic and hard magnetic elimination on the second magnetometer data to obtain third magnetometer data.

[0068] Referring to the above description of this article, the second axis of the AR glasses can be a coordinate axis in the front direction of the display unit when placed horizontally or one of the coordinate axes in the direction from the left eye display unit to the right eye display unit, that is, Figure 5 The first direction can be one of the Y axis or X axis shown. Figure 5 The embodiment of the present application does not impose any limitation on the direction or the opposite direction in which the Y-axis points, or the direction or the opposite direction in which the X-axis points.

[0069] In one example, the process of soft magnetic elimination is the process of restoring the above-mentioned ellipse into a circle. After restoration to a circle, the second magnetometer data with the soft magnetic eliminated is obtained. The hard magnetic elimination is to calculate the center coordinates of the ellipse in the magnetometer coordinate system, and then subtract the center coordinates of the ellipse from the second magnetometer data after the soft magnetic elimination to obtain the third magnetometer data with the soft magnetic and hard magnetic eliminated.

[0070] For example: The first direction is north (i.e. Figure 5 In the case of the positive direction of the Y axis shown in FIG, the first magnetometer data from the plurality of The second magnetometer data measured when the second axis of the AR glasses points to the north direction is , calculate the coordinates of the center of the ellipse in the magnetometer coordinate system as v c , the second magnetometer data after eliminating the soft magnetic field is , then the third magnetometer data after eliminating soft and hard magnetism is , the third magnetometer data The horizontal component of indicates the second axis of the magnetometer before being transformed by the first axis.

[0071] In this embodiment, the elimination of soft and hard magnetism is performed within the plane in which the data points corresponding to the data of the multiple first magnetometers are distributed. That is, in the process of eliminating soft and hard magnetism, the two-dimensional soft and hard magnetic parameters are solved. The two-dimensional data (elliptical) can be collected very densely and evenly. Compared with the traditional method of collecting uniform and dense data points on the ellipsoidal surface, the operation is easier and the amount of calculated data is less (the amount of calculation in one dimension is reduced).

[0072] Step S340: Calculate a second rotation matrix for transforming the second axis of the magnetometer determined by the third magnetometer data to the second axis of the electronic device in a stationary state.

[0073] Specifically, two processes are required. The first process is to calculate the third magnetometer data. Perform the first axis transformation to obtain the fifth magnetometer data. The purpose of process one is to align the third magnetometer data with the z axis. ; The second process is to determine the horizontal component from the fifth magnetometer data, which indicates the second axis of the magnetometer after the first axis transformation.

[0074] For the third magnetometer data Performing the first axis conversion means transforming the third magnetometer data according to the first rotation matrix to obtain the fifth magnetometer data. That is, the fifth magnetometer data is: in, is the first rotation matrix. It can be seen that the second magnetometer data measured when the second axis of the AR glasses points to due north is After the internal reference conversion, the influence of soft and hard magnetism in the environment is eliminated and the third magnetometer data is obtained. , and the third magnetometer data A transformation is performed from the first axis of the magnetometer coordinate system to the first axis of the glasses body coordinate system, so that the first axis of the magnetometer represented by the fifth magnetometer data is consistent with the first axis of the AR glasses.

[0075] For example, the fifth magnetometer data The horizontal component of represents the second axis of the magnetometer after the first axis transformation, that is, the second axis of the magnetometer coordinate system after the first axis transformation, for example, the y-axis of the magnetometer coordinate system after the first axis transformation. The second axis of the magnetometer is transformed to the second axis of the AR glasses in the static state, that is, the second axis of the magnetometer coordinate system is aligned with the second axis of the glasses body coordinate system through a rotation transformation, thereby obtaining the second rotation matrix. It should be noted that: after the two axes of the two coordinate systems are aligned, the third axis is also aligned, and thus the magnetometer coordinate system and the glasses body coordinate system are aligned.

[0076] Step S350: Calibrate the external parameters of the magnetometer based on the first rotation matrix and the second rotation matrix. Specifically, the external parameters of the magnetometer can be obtained according to the following formula: : .in, is the second rotation matrix. This external parameter represents the rotation relationship from the magnetometer coordinate system to the glasses body coordinate system, that is, the coordinate point corresponding to the magnetometer data is multiplied by the external parameter , it will be aligned to the coordinate system of the glasses themselves, thereby providing real geographic orientation information for the AR glasses.

[0077] In the embodiment of the present application, it is not necessary to perform a complete soft and hard magnetic calibration on the magnetometer before the external parameter calibration of the magnetometer. Instead, during the external parameter calibration process, the soft and hard magnetic elimination is performed in the plane where the data points corresponding to the multiple first magnetometer data are distributed, thereby avoiding the influence of the soft and hard magnetic on the external parameter calibration. Not only can the external parameters of the magnetometer to the electronic device be accurately calibrated, but the entire external parameter calibration process is also simplified, thereby improving the external parameter calibration efficiency of the magnetometer.

[0078] It should be noted that each implementation method of the present application can be freely combined, the order can be changed, or it can be executed separately, and does not need to rely on or depend on a fixed execution order.

[0079] In some embodiments, calculating a first rotation matrix in step S320 that transforms the first axis of the magnetometer determined by fitting the plurality of first magnetometer data to the first axis of the electronic device in a stationary state specifically includes: A first plane is fitted based on the plurality of first magnetometer data, and a normal of the first plane is determined.

[0080] The first rotation matrix is ​​calculated based on the normal and the first axis of the electronic device in a stationary state.

[0081] In one example, still taking AR glasses as an example, Figure 6 As shown, since the AR glasses rotate in the horizontal plane, the magnetometer also rotates in the horizontal plane. Therefore, without considering the error, the first magnetometer data The corresponding data points will be distributed in the same plane. Due to the interference of soft magnetism, multiple first magnetometer data The corresponding data points are distributed on the circumference of the ellipse. In this embodiment, the first magnetometer data points distributed on the circumference of the ellipse The corresponding data points are fitted to obtain the first fitted plane. The normal line of the first plane is the straight line perpendicular to the first plane, which is denoted as n Since the first magnetometer data They are all expressed in the magnetometer coordinate system, and the magnetometer rotates with the AR glasses. Therefore, the first magnetometer data obtained by the rotation The first plane fitted by the corresponding points corresponds to the horizontal plane, and a coordinate axis parallel to the normal line of the first plane is determined as the first axis of the magnetometer coordinate system.

[0082] It should be noted that: an existing mature plane fitting method can be used to perform plane fitting. In this embodiment, the plane fitting method is not specifically limited.

[0083] The first axis of the AR glasses in a stationary state, for example, the z-axis, is expressed as: , then the normal n The rotation relationship expression when rotating to align with the first axis of the AR glasses in the static state is as follows: , through this rotation relationship, the first rotation matrix of the magnetometer coordinate system aligned with the first axis of the AR glasses can be obtained .

[0084] In some embodiments, performing soft magnetic and hard magnetic elimination on the second magnetometer data to obtain the third magnetometer data in step S330 specifically includes: A first ellipse is fitted based on the plurality of first magnetometer data to obtain a first center of the first ellipse.

[0085] Second transformed magnetometer data corresponding to the second magnetometer data when the first ellipse is transformed into a circle is determined to perform soft magnetism elimination.

[0086] Hard magnetism elimination is performed on the second transformed magnetometer data based on the first circle center to obtain the third magnetometer data.

[0087] In one example, still taking AR glasses as an example, a first ellipse is fitted by fitting the data points corresponding to the multiple first magnetometer data. The existing mature curve fitting method can be used for ellipse fitting. In this embodiment, the method of ellipse fitting is not specifically limited. After the first ellipse fitting is completed, the first center of the ellipse is determined, and the coordinates of the center of the ellipse in the magnetometer coordinate system can be obtained as v c .

[0088] The second magnetometer data is the data measured when the second axis of the AR glasses points to the first direction, which is selected from the plurality of first magnetometer data. For example, when the first direction is toward the north, the second magnetometer data is , transform the first ellipse into a circle to eliminate the soft magnetism, and obtain the second transformed magnetometer data, that is, the second magnetometer data after eliminating the soft magnetism is .

[0089] Since hard magnetic elimination is to restore the first circle center to the origin of the magnetometer coordinate system, hard magnetic elimination of the second transformed magnetometer data based on the first circle center means that the second transformed magnetometer data Subtract the coordinates of the first circle center v c , that is, the third magnetometer data after eliminating soft and hard magnetism is obtained as .

[0090] like Figure 7 and 8 As shown, Figure 7 This is a schematic diagram of the distribution of data points on the circumference after eliminating the soft magnetic properties. Figure 8 Schematic diagram of the circle center coordinates restored to the origin of the magnetometer coordinate system after hard magnetism is eliminated.

[0091] In this embodiment, the effects of soft and hard magnetism on external parameter calibration are eliminated within the plane by fitting ellipses to the data of multiple first magnetometers, restoring the ellipses to circles, and subtracting the coordinates of the circle's center from the data of the second magnetometer. Furthermore, eliminating soft and hard magnetism within the plane reduces the computational effort by one dimension compared to the traditional method of restoring the ellipsoid to a sphere and then calculating the coordinates of the sphere's center. This improves the efficiency of external parameter calibration while maintaining the accuracy of the magnetometer external parameter calibration.

[0092] In some embodiments, fitting a first ellipse based on the plurality of first magnetometer data specifically includes: A second plane is fitted based on the plurality of first magnetometer data.

[0093] Projection points of the plurality of first magnetometer data in the second plane are determined.

[0094] The first ellipse is fitted based on the projected points.

[0095] In this embodiment, the method for fitting the second plane is essentially the same as the method for fitting the first plane described above. Of course, the first plane can also be directly used as the second plane, eliminating one fitting step. Determining the projection points of the plurality of first magnetometer data within the second plane and fitting the first ellipse based on the projection points within the second plane can more accurately fit the first ellipse and ensure that the fitted first ellipse lies within a single plane.

[0096] In this embodiment, the transformation of the first ellipse into a circle specifically includes but is not limited to: using the first center of the first ellipse as the center of the circle, and the square root of the product of the major semi-axis and the minor semi-axis of the first ellipse as the radius of the circle, to restore the first ellipse to a circle.

[0097] In some embodiments, before step S320, the method further includes: collecting fourth magnetometer data when the electronic device is in a stationary state, and determining a first component of the first direction in the fourth magnetometer data.

[0098] Based on this, in step S340, calculating a second rotation matrix for transforming the second axis of the magnetometer determined by the third magnetometer data to the second axis of the electronic device in a stationary state includes: Performing a first axis transformation on the third magnetometer data to obtain fifth magnetometer data.

[0099] A horizontal component of the fifth magnetometer data is obtained, wherein the horizontal component indicates a second axis of the magnetometer after the first axis transformation, and the first component indicates the second axis of the electronic device in a stationary state.

[0100] The second rotation matrix is ​​calculated according to the first component and the horizontal component.

[0101] In one example, still taking AR glasses as an example, the fourth magnetometer data of the AR glasses in a stationary state is collected, and the first component of the first direction in the fourth magnetometer data is determined, for example: the first direction is toward north (ie Figure 5 In the case of the positive direction of the Y axis shown in the figure, the first component is .

[0102] Third magnetometer data The first axis conversion is to convert the third magnetometer data Transform according to the first rotation matrix to obtain the fifth magnetometer data .

[0103] Get the fifth magnetometer data The horizontal component of , the horizontal component indicates the second axis of the magnetometer after the first axis transformation, for example: the y-axis, and the above-mentioned first component indicates the second axis of the AR glasses in a stationary state, for example: the y-axis.

[0104] According to the first component , horizontal component Calculate the second rotation matrix. Specifically, calculate according to the following formula: , where the first component and horizontal component are all known quantities, so the second rotation matrix is ​​calculated .

[0105] In some embodiments, the horizontal plane is a plane of a hexahedron, and the first axis, the second axis, and the third axis of the electronic device in a stationary state are all perpendicular to two opposite planes of the hexahedron.

[0106] In one example, a hexahedron is selected as a horizontal platform for supporting AR glasses, and the AR glasses are placed on the horizontal plane of the hexahedron. The first axis, second axis, and third axis of the AR glasses in a static state are all perpendicular to two opposite faces of the hexahedron, which facilitates the definition of the coordinate axes of the glasses body coordinate system.

[0107] In a second aspect, the present application also provides a magnetometer extrinsic parameter calibration system for an electronic device, such as Figure 9 Shown, including: Electronic device 910, such as AR glasses.

[0108] The electronic device 910 is placed on a horizontal plane of the hexahedron 920 .

[0109] A calibration device 930, the calibration device 930 includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for calibrating the external parameters of the magnetometer of the electronic device as described in any one of the above is implemented.

[0110] Specifically, the calibration device 930 can be connected to the electronic device 910 by wire or wirelessly to obtain the magnetometer data of the magnetometer in the electronic device 910, and perform external parameter calibration on the magnetometer in the electronic device 910 based on the above-mentioned external parameter calibration method of the magnetometer of the electronic device.

[0111] It should be noted that if the electronic device 910 itself has certain computing and processing capabilities, for example, the electronic device 910 is a smart phone, then the electronic device 910 itself can also be used as a calibration device to achieve external parameter calibration of its own magnetometer.

[0112] In a third aspect, an embodiment of the present application further provides an electronic device, including a magnetometer calibrated with external parameters according to any of the above-described methods for calibrating an external parameter of a magnetometer for an electronic device. Through the external parameter calibration method described above, the coordinate systems of the electronic device and the magnetometer therein are aligned, ensuring that the magnetometer can provide correct geographic orientation information for the electronic device.

[0113] Figure 10 The following is an example of a physical structure diagram of a calibration device, such as Figure 10As shown, the calibration device may include: a processor 101, a communication interface 102, a memory 103, and a communication bus 104, wherein the processor 101, the communication interface 102, and the memory 103 communicate with each other via the communication bus 104. The processor 101 may call the logic instructions in the memory 103 to execute the external parameter calibration method of the magnetometer of the electronic device, which includes: A first axis and a second axis of the electronic device placed on a horizontal plane and in a stationary state are determined, wherein the first axis of the electronic device is perpendicular to the horizontal plane, and the second axis of the electronic device points to a first direction.

[0114] During the process of the electronic device rotating at least one circle around the first axis of the electronic device in a stationary state, multiple first magnetometer data collected by the magnetometer are obtained; and a first rotation matrix is ​​calculated and transformed from the first axis of the magnetometer determined by fitting the multiple first magnetometer data to the first axis of the electronic device in the stationary state.

[0115] Second magnetometer data measured when the second axis of the electronic device points to the first direction is selected from the multiple first magnetometer data, and soft magnetism and hard magnetism elimination are performed on the second magnetometer data to obtain third magnetometer data.

[0116] A second rotation matrix is ​​calculated, which transforms the second axis of the magnetometer determined by the third magnetometer data to the second axis of the electronic device in a stationary state.

[0117] The extrinsic parameters of the magnetometer are calibrated based on the first rotation matrix and the second rotation matrix.

[0118] In addition, the logical instructions in the above-mentioned memory 103 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application, or the part that contributes to the relevant technology, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute 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, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program code.

[0119] On the other hand, the present application also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can perform the magnetometer extrinsic parameter calibration method of the electronic device provided by the above methods, and the method includes: A first axis and a second axis of the electronic device placed on a horizontal plane and in a stationary state are determined, wherein the first axis of the electronic device is perpendicular to the horizontal plane, and the second axis of the electronic device points to a first direction.

[0120] During the process of the electronic device rotating at least one circle around the first axis of the electronic device in a stationary state, multiple first magnetometer data collected by the magnetometer are obtained; and a first rotation matrix is ​​calculated and transformed from the first axis of the magnetometer determined by fitting the multiple first magnetometer data to the first axis of the electronic device in the stationary state.

[0121] Second magnetometer data measured when the second axis of the electronic device points to the first direction is selected from the multiple first magnetometer data, and soft magnetism and hard magnetism elimination are performed on the second magnetometer data to obtain third magnetometer data.

[0122] A second rotation matrix is ​​calculated, which transforms the second axis of the magnetometer determined by the third magnetometer data to the second axis of the electronic device in a stationary state.

[0123] The extrinsic parameters of the magnetometer are calibrated based on the first rotation matrix and the second rotation matrix.

[0124] In another aspect, the present application further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for calibrating the external parameters of a magnetometer of an electronic device provided by the above methods, the method comprising: A first axis and a second axis of the electronic device placed on a horizontal plane and in a stationary state are determined, wherein the first axis of the electronic device is perpendicular to the horizontal plane, and the second axis of the electronic device points to a first direction.

[0125] During the process of the electronic device rotating at least one circle around the first axis of the electronic device in a stationary state, multiple first magnetometer data collected by the magnetometer are obtained; and a first rotation matrix is ​​calculated and transformed from the first axis of the magnetometer determined by fitting the multiple first magnetometer data to the first axis of the electronic device in the stationary state.

[0126] Second magnetometer data measured when the second axis of the electronic device points to the first direction is selected from the multiple first magnetometer data, and soft magnetism and hard magnetism elimination are performed on the second magnetometer data to obtain third magnetometer data.

[0127] A second rotation matrix is ​​calculated, which transforms the second axis of the magnetometer determined by the third magnetometer data to the second axis of the electronic device in a stationary state.

[0128] The extrinsic parameters of the magnetometer are calibrated based on the first rotation matrix and the second rotation matrix.

[0129] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.

[0130] Through the description of the above embodiments, those skilled in the art will clearly understand that each embodiment can be implemented using software plus a necessary general-purpose hardware platform, or of course, hardware. Based on this understanding, the essence of the above technical solution, or the portion that contributes to the relevant technology, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, or an optical disk, and includes a number of instructions for causing a computer device (such as a personal computer, server, or network device) to execute the methods described in each embodiment or certain portions of the embodiments.

[0131] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for calibrating the external parameters of a magnetometer of an electronic device, comprising: Determine a first axis and a second axis of the electronic device placed on a horizontal plane and in a stationary state, wherein the first axis of the electronic device is perpendicular to the horizontal plane and the second axis of the electronic device points in a first direction; Acquire a plurality of first magnetometer data collected by the magnetometer during a process in which the electronic device rotates at least one circle around a first axis of the electronic device in a stationary state; Calculate a first rotation matrix that transforms the first axis of the magnetometer determined by fitting the plurality of first magnetometer data to the first axis of the electronic device in a stationary state; Selecting second magnetometer data measured when the second axis of the electronic device points to the first direction from the plurality of first magnetometer data, and performing soft magnetism and hard magnetism elimination on the second magnetometer data to obtain third magnetometer data; Calculating a second rotation matrix for transforming the second axis of the magnetometer determined by the third magnetometer data to the second axis of the electronic device in a stationary state; The extrinsic parameters of the magnetometer are calibrated based on the first rotation matrix and the second rotation matrix.

2. The method according to claim 1, wherein Calculating a first rotation matrix that transforms the first axis of the magnetometer determined by fitting the plurality of first magnetometer data to the first axis of the electronic device in a stationary state includes: Fitting a first plane based on the plurality of first magnetometer data, and determining a normal to the first plane; The first rotation matrix is ​​calculated based on the normal and the first axis of the electronic device in a stationary state.

3. The method according to claim 1, wherein Eliminating soft magnetism and hard magnetism from the second magnetometer data to obtain third magnetometer data includes: Fitting a first ellipse based on the plurality of first magnetometer data, and obtaining a first center of the first ellipse; determining second transformed magnetometer data corresponding to the second magnetometer data when the first ellipse is transformed into a circle, so as to perform soft magnetism elimination; Hard magnetism elimination is performed on the second transformed magnetometer data based on the first circle center to obtain the third magnetometer data.

4. The method according to claim 3, wherein: Fitting a first ellipse based on the plurality of first magnetometer data comprises: fitting a second plane based on the plurality of first magnetometer data; Determining projection points of the plurality of first magnetometer data in the second plane; fitting the first ellipse based on the projection points; The transformation of the first ellipse into a circle includes: taking the first center of the first ellipse as the center of the circle, and the square root of the product of the major semi-axis and the minor semi-axis of the first ellipse as the radius of the circle, to restore the first ellipse into a circle.

5. The method according to claim 1, wherein Before the electronic device rotates around the first axis of the electronic device in a stationary state, the method further includes: collecting fourth magnetometer data of the electronic device in a stationary state, and determining a first component of the first direction in the fourth magnetometer data; Calculating a second rotation matrix for transforming the second axis of the magnetometer determined by the third magnetometer data to the second axis of the electronic device in a stationary state, comprising: performing a first axis transformation on the third magnetometer data to obtain fifth magnetometer data; Acquire a horizontal component of the fifth magnetometer data, wherein the horizontal component indicates a second axis of the magnetometer after the first axis transformation, and the first component indicates the second axis of the electronic device in a stationary state; The second rotation matrix is ​​calculated according to the first component and the horizontal component.

6. The method according to claim 1, wherein The horizontal plane is a plane of a hexahedron, and the first axis, the second axis and the third axis of the electronic device in a static state are all perpendicular to two opposite planes of the hexahedron.

7. A magnetometer extrinsic parameter calibration system for an electronic device, comprising: electronic devices; a hexahedron, wherein the electronic device is placed on a horizontal plane of the hexahedron; A calibration device, the calibration device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method for calibrating the external parameters of a magnetometer of an electronic device according to any one of claims 1 to 6 is implemented.

8. A calibration device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the magnetometer extrinsic parameter calibration method for an electronic device according to any one of claims 1 to 6 when executing the computer program.

9. An electronic device, comprising a magnetometer whose external parameters are calibrated by the method for calibrating external parameters of a magnetometer of an electronic device according to any one of claims 1 to 6.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method for calibrating the external parameters of a magnetometer of an electronic device according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Calibration and compensation method of electron compass in cylindrical camera

    CN106556384A

  • Magnetic interference compensation algorithm of micro magnetometer based on conditional constraint least squares ellipsoid fitting

    CN108761548A

  • Method for calibrating a gyrometer fitted in an object

    CN112313475A

  • Magnetometer calibration method of unmanned aerial vehicle, unmanned aerial vehicle and storage medium

    CN115014390A

  • Magnetometer error correction method based on ellipsoid fitting

    CN118535846A