Magnetometer extrinsic calibration method, system, device and storage medium of electronic device

CN120703660BActive Publication Date: 2026-09-22湖北星纪魅族集团有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510695572.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-05-27
Publication Date
2026-09-22
Estimated Expiration
2045-05-27

AI Technical Summary

Technical Problem

[0003]由于外参标定需要用到磁力计数据,磁力计数据的准确性和可用性直接影响外参标定的精度,因此,相关技术中,在磁力计外参标定前都要先进行软硬磁标定,以保证磁力计数据的准确性和可用性,即磁力计外参标定前必须先经过软硬磁标定,从而导致整个外参标定的过程复杂,标定效率低

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120703660B_ABST
    Figure CN120703660B_ABST
Patent Text Reader

Abstract

The application discloses a magnetometer extrinsic parameter calibration method, system, device and storage medium of an electronic device, and belongs to the technical field of magnetometer calibration. The method of the embodiment of the application comprises the following steps: 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 is perpendicular to the horizontal plane, and the second axis points to a first direction; acquiring a plurality of first magnetometer data collected by a magnetometer in the process that the electronic device rotates at least one round around the first axis; 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 the second axis of the electronic device points to the first direction, and obtaining third magnetometer data by eliminating soft magnetism and hard magnetism from the second magnetometer data; calculating a second rotation matrix of the second axis of the magnetometer transformed to the second axis of the electronic device in the stationary state according to the third magnetometer data; and calibrating the extrinsic parameter 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] This application relates to the field of magnetometer calibration technology, and in particular to a method, system, device, and storage medium for calibrating the external parameters of a magnetometer in an electronic device. Background Technology

[0002] For electronic devices equipped with magnetometers, to ensure that the magnetometer provides accurate geographic location information, it is necessary to perform soft and hard magnetic calibration as well as extrinsic parameter calibration. Soft and hard magnetic calibration compensates for errors within the three-axis magnetometer's own coordinate system, enabling the magnetometer to measure more accurate magnetometer data. Extrinsic parameter calibration, on the other hand, determines the rotation matrix between the magnetometer's coordinate system and the electronic device's coordinate system, thereby aligning the magnetometer's coordinate system to the electronic device's coordinate system.

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

[0004] In a first aspect, embodiments of this application provide a method for calibrating the external parameters of a magnetometer in an electronic device, including: The electronic device is positioned on a horizontal plane and is in a stationary state, with a first axis and a second axis. 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. During the process of the electronic device rotating at least one revolution around the first axis of the electronic device in a stationary state, multiple first magnetometer data collected by the magnetometer are acquired; a first rotation matrix for transforming the first axis of the magnetometer to the first axis of the electronic device in a stationary state, determined by fitting the multiple first magnetometer data, is calculated; Select the 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 perform soft and hard magnetic elimination on the second magnetometer data to obtain the third magnetometer data; Calculate the second rotation matrix of the second axis of the magnetometer, determined by the third magnetometer data, to transform the second axis of the electronic device into 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, determined by fitting the data from the plurality of first magnetometers, to transform the first axis of the magnetometer to the first axis of the electronic device in a stationary state includes: Based on the data from the multiple first magnetometers, a first plane is fitted to determine the 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 static state.

[0006] In some embodiments, obtaining third magnetometer data by performing soft and hard magnetic elimination on the second magnetometer data includes: Based on the data from the multiple first magnetometers, a first ellipse is fitted to obtain the first center of the first ellipse; Determine the second transformed magnetometer data corresponding to the second magnetometer data when the first ellipse is transformed into a circle, so as to perform soft magnetic elimination; Hard magnetic elimination is performed on the second transformed magnetometer data based on the first center to obtain the third magnetometer data.

[0007] In some embodiments, fitting a first ellipse based on the plurality of first magnetometer data includes: A second plane is fitted based on the data from the plurality of first magnetometers; Determine the projection points of the plurality of first magnetometer data in the second plane; The first ellipse is fitted based on the projection points; The transformation of the first ellipse into a circle includes: restoring the first ellipse into a circle by taking the first center of the first ellipse as the center of the circle and the square root of the product of the major and minor axes of the first ellipse as the radius of the circle.

[0008] In some embodiments, before the electronic device rotates about a first axis of the electronic device in a stationary state, the method further includes: acquiring 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 the second rotation matrix, determined by the third magnetometer data, to transform the second axis of the magnetometer to the second axis of the electronic device in a stationary state, includes: The third magnetometer data is transformed along a first axis to obtain the fifth magnetometer data; The horizontal component of the fifth magnetometer data is acquired, wherein the horizontal component indicates the second axis of the magnetometer after the first axis transformation, and the first component indicates the second axis of the electronic device in a static state; The second rotation matrix is ​​calculated based on the first component and the horizontal component.

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

[0010] Secondly, embodiments of this application also provide a magnetometer extrinsic parameter calibration system for an electronic device, comprising: Electronic devices; A hexahedron, wherein the electronic device is placed on one horizontal plane of the hexahedron; A calibration device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a magnetometer extrinsic parameter calibration method for any of the above-described electronic devices.

[0011] Thirdly, embodiments of this application also provide a calibration device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the magnetometer extrinsic parameter calibration method of any of the above-described electronic devices.

[0012] Fourthly, embodiments of this application also provide an electronic device, including a magnetometer whose external parameters are calibrated using the magnetometer external parameter calibration method of any of the above-described electronic devices.

[0013] Fifthly, embodiments of this application also provide a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the magnetometer extrinsic parameter calibration method of any of the above-described electronic devices. Attached Figure Description

[0014] To more clearly illustrate the technical solutions in this application or related technologies, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

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

[0016] Figure 2 This is a schematic diagram of the terminal structure provided in the embodiments of this application.

[0017] Figure 3 This is a schematic flowchart of the magnetometer external parameter calibration method for an electronic device provided in the embodiments of this application.

[0018] Figure 4 This is a schematic diagram of the structure of the AR glasses provided in the embodiments of this application.

[0019] Figure 5 This is a schematic diagram of defining the coordinate system of an electronic device in the magnetometer extrinsic parameter calibration method for an electronic device provided in the embodiments of this application.

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

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

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

[0023] Figure 9 This is a schematic diagram of the magnetometer external parameter calibration system of the electronic device provided in the embodiments of this application.

[0024] Figure 10 This is a schematic diagram of the calibration device provided in the embodiments of this application. Detailed Implementation

[0025] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0026] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first" and "second" are generally of the same class, not limited in number; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

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

[0028] It is understandable that the accuracy of the intrinsic and extrinsic parameters between the three sensors and the electronic device has a significant 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 parameter calibration, particularly for magnetometers, to ensure that the magnetometer provides accurate geographic location information to electronic devices such as smartwatches, smart bracelets, smart rings, augmented reality (AR) / virtual reality (VR) / mixed reality devices, mobile phones, laptops, ultra-mobile personal computers (UMPCs), netbooks, and personal digital assistants (PDAs), it is necessary to perform both soft and hard magnetic calibration (i.e., intrinsic parameter calibration) and extrinsic parameter calibration on the magnetometer within the three-axis magnetometer's own coordinate system. Soft and hard magnetic calibration refers to error compensation within the three-axis magnetometer's own coordinate system, while extrinsic parameter calibration involves determining the rotation matrix between the magnetometer and the electronic device to align the magnetometer coordinates to the electronic device's coordinates.

[0030] For a magnetometer, if the magnetometer is rotated in space around the origin of the magnetometer coordinate system in various directions, along the three orthogonal axes of the magnetometer (e.g., Figure 1 The magnetometer data (Bx, By, and Bz) shown are ideally distributed on a spherical surface, with the center of the sphere being the origin of the magnetometer coordinate system. Figure 1 The blue data points form a spherical surface, representing the triaxial magnetometer data collected under ideal conditions. If the magnetometer is subjected to soft magnetic interference, the triaxial magnetometer data will no longer fit a sphere but will be distorted into an ellipsoid. If the magnetometer is subjected to hard magnetic interference, the center of the sphere / ellipsoid will shift and will no longer be the origin of the magnetometer coordinate system. Figure 1The red data points in the image form an ellipsoid and its center. It is evident that after being subjected to both soft and hard magnetic interference, the magnetometer data measured is inaccurate and unreliable. Using this inaccurate and unreliable magnetometer data for extrinsic parameter calibration results in inaccurate extrinsic parameters as well, and the magnetometer coordinate system and the electronic equipment coordinate system cannot be truly aligned. Therefore, in related technologies, magnetometers require both soft and hard magnetic calibration before extrinsic parameter calibration. This ensures that the magnetometer can measure accurate and reliable magnetometer data after calibration, thereby improving the accuracy of the extrinsic parameter calibration.

[0031] It should be noted that soft magnetic calibration of a magnetometer uses a 3×3 matrix as soft magnetic parameters to restore the ellipsoid to a sphere, while hard magnetic calibration uses a 3×1 vector as hard magnetic parameters to restore the sphere's center to the origin of the magnetometer coordinate system. In other words, both soft and hard magnetic calibration require acquiring magnetometer data along three orthogonal axes in the magnetometer coordinate system, and ensuring that this data is distributed as evenly as possible. Therefore, related technologies involve the acquisition and processing of large amounts of data, leading to a complex and inefficient external parameter calibration process.

[0032] Therefore, this application provides a method for calibrating the extrinsic parameters of a magnetometer for an electronic device. The method involves determining a first axis and a second axis of the electronic device when it is placed on a horizontal plane and in a stationary state. The first axis of the electronic device is perpendicular to the horizontal plane, and the second axis points in a first direction. During the process of the electronic device rotating at least one revolution around the first axis in the stationary state, multiple first magnetometer data points are acquired. A first rotation matrix, determined by fitting the multiple first magnetometer data points, is calculated to transform the first axis of the magnetometer to the first axis of the electronic device in the stationary state. Second magnetometer data points are selected from the multiple first magnetometer data points when the second axis of the electronic device points in the first direction. Soft and hard magnetic elimination is performed on the second magnetometer data to obtain third magnetometer data. A second rotation matrix, determined by the third magnetometer data, is calculated to transform the second axis of the magnetometer to the second axis of the electronic device in the stationary state. The extrinsic parameters of the magnetometer are calibrated based on the first and second rotation matrices. In other words, the method of this application does not require the magnetometer to be calibrated in terms of both soft and hard magnetic properties before the magnetometer's external parameters are calibrated. That is, the method provided in the embodiments of this application can calibrate the external parameters of the magnetometer to the electronic device without first calibrating the complete soft and hard magnetic properties of the magnetometer, which simplifies the entire external parameter calibration process and improves the external parameter calibration efficiency of the magnetometer.

[0033] The magnetometer extrinsic parameter calibration method for electronic devices provided in this application can be applied to calibration devices. The calibration device can be the electronic device itself described in this application, meaning the steps described in the method are performed by the electronic device itself, which has a magnetometer. Alternatively, the calibration device can be other devices, such as other devices that establish a communication connection (including direct or indirect connection) with the electronic device (which may or may not have a magnetometer). In other words, this application does not limit the electronic device with the magnetometer and the calibration device to be the same device or different devices. In some examples, the calibration device can be a mobile phone, tablet computer, wearable device, in-vehicle device, augmented reality (AR) / virtual reality (VR) device (e.g., AR glasses), laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), etc. It can also be a database, server, and a service response system based on terminal artificial intelligence. This application does not impose any restrictions on the specific type of 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 communication over a wireless system, as well as next-generation communication systems, such as mobile terminals in 5G networks, mobile terminals in future evolved Public Land Mobile Networks (PLMNs), or mobile terminals in future evolved Non-terrestrial Networks (NTNs).

[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 devices that are intelligently designed and developed using wearable technology to make everyday wearables, such as gloves, watches, AR (Augmented Reality) head-mounted displays, VR (Virtual Reality) head-mounted displays, or MR (Mixed Reality) head-mounted displays, etc., equipped with far-field communication modules and / or near-field communication modules.

[0036] In some embodiments, the calibration device described above may be equipped with, for example, Figure 2 The hardware structure of the mobile phone 100 shown is as follows: Figure 2 As shown, the mobile phone 100 may specifically include: 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, etc. Those skilled in the art will understand that... Figure 2 The structure of the mobile phone 100 shown does not constitute a limitation on the calibration device. The calibration device may include more or fewer components than shown, or combine certain components, or have different component arrangements.

[0037] The following is combined with Figure 2 A detailed introduction to each component of a mobile phone: RF circuit 110 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and processes it with processor 180; additionally, it transmits uplink data to the base station. Typically, RF circuitry includes, but is not limited to, antennas, at least one amplifier, transceiver, coupler, low-noise amplifier (LNA), duplexer, etc. Furthermore, RF circuit 110 can also communicate wirelessly with networks and other devices. The aforementioned wireless communication can use any communication standard or protocol, including 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, LEO satellite connectivity, and / or IR technology, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS), etc.

[0038] The memory 120 can be used to store software programs and modules. The processor 180 executes various mobile phone functions and data processing 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. The program storage area may store the operating system, applications required for at least one function (such as sound playback function, 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, phonebook, etc.). In addition, the memory 120 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Specifically, the memory 120 may store pictures taken by the electronic device or downloaded via wireless network.

[0039] The input unit 130 can be used to receive input numerical or character information, and to generate key signal inputs related to 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 touch operations performed by the user on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel 131), and drive the corresponding connection devices according to a pre-set program. Optionally, the touch panel 131 may include two parts: a touch detection device and a touch controller. The touch detection device detects the user's touch position and the signal generated by the touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, sends it to the processor 180, and can receive and execute commands sent by the processor 180. 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 also include other input devices 132. Specifically, other input devices 132 may include, but are not limited to, one or more of the following: physical keyboard, function keys (such as volume control buttons, power buttons, etc.), trackball, mouse, joystick, etc.

[0040] Display unit 140 can be used to display information input by the user or information provided to the user, as well as various menus of the mobile phone. Display unit 140 may include a display panel 141, optionally configured as a Liquid Crystal Display (LCD), Light Emitting Diode (LED), Organic Light Emitting Diode (OLED), Active-Matrix Organic Light Emitting Diode (AMOLED), etc. Further, touch panel 131 may cover display panel 141. When touch panel 131 detects a touch operation on or near it, it transmits the information to processor 180 to determine the type of touch event. Subsequently, processor 180 provides corresponding visual output on display panel 141 according to the type of touch event. Although in Figure 2 In this embodiment, the touch panel 131 and the display panel 141 are two separate components to realize the input and output functions of the mobile phone. However, 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. The ambient light sensor can adjust the brightness of the display panel 141 according to the ambient light level, and the proximity sensor can turn off the display panel 141 and / or backlight when the phone is moved to the ear. As a type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in various directions (generally three axes). When stationary, it can detect the magnitude and direction of gravity and can be used for applications that recognize the phone's posture (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition-related functions (such as pedometer, tapping), etc. Other sensors that may be configured in the phone, such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, will not be described in detail here.

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

[0043] Wi-Fi, Bluetooth, and Near Field Communication (NFC) are short-range wireless transmission technologies. Mobile phones, through the short-range wireless communication module 170, can help users send and receive emails, browse web pages, and access streaming media, providing wireless broadband internet access. The aforementioned short-range wireless communication module 170 may include a Wi-Fi chip, a Bluetooth chip, and an NFC chip. The Wi-Fi chip enables the mobile phone 100 to establish Wi-Fi Direct connections with other electronic devices. It can also enable the mobile phone 100 to operate in Access Point (AP) mode, which provides wireless access services and allows other wireless devices to connect, or in Station (STA) mode, which allows connection to an AP but does not accept 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, connecting various parts of the phone through various interfaces and lines. It executes software programs and / or modules stored in the memory 120, and calls data stored in the memory 120 to perform various functions and process data, thereby providing overall monitoring of the 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), etc. Different processing units can 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) that supplies power to various components. Preferably, the power supply can be logically connected to the processor 180 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system.

[0046] The mobile phone 100 may also include a camera. Optionally, the camera may be positioned on the front or rear of the phone, and this embodiment does not limit this.

[0047] Figure 3This is one of the flowcharts illustrating a method for calibrating the external parameters of a magnetometer in an electronic device according to an embodiment of this application. The method includes steps S310, S320, S330, S340, and S350. These steps are merely one possible implementation of this application.

[0048] Step S310: Determine the first axis and the second axis of the electronic device when it is placed on a horizontal plane and in a stationary state. 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.

[0049] Specifically, this document uses electronic devices, such as AR glasses, as examples for illustration, but this is not intended to limit the scope of this application.

[0050] like Figure 4 The diagram shown is a schematic representation of AR glasses provided in at least one embodiment of this disclosure. Figure 4 As shown, Figure 4 An example of an AR glasses structure is shown. AR glasses can have a structure similar to conventional glasses, including lenses 1010, frames 1020, and one or more temples 1030. For example, AR glasses can also provide various "intelligent" functions that conventional glasses cannot offer, such as audio / video playback, application display, voice interaction, and real-time translation. Therefore, AR glasses integrate the relevant components required for a computing device to realize intelligent functions. For example, the processing unit of the AR glasses can be arranged within the temples 1030, for example, at the location shown for the processing unit 1031. The processing unit can perform various operations according to acquired 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 the 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 spoken text and the translated text of the non-wearer, or the first and second display units can only display the translated text of the non-wearer.

[0051] In some examples, each display unit may include its own optical engine and waveguide. A first optical engine (also referred to as the "left optical engine") and a first waveguide (also referred to as the "left waveguide") are used to display an image to the left eye; a second optical engine (also referred to as the "right optical engine") and a second waveguide (also referred to as the "right waveguide") are used to display an image to the right eye. After the optical engine completes the imaging process, the waveguide's grating coupler couples light into its own glass substrate. Through the principle of "total internal reflection," the light is transmitted to the grating coupler exit, for example, in front of the wearer's eye, and then reflected out onto the waveguide. In this process, the waveguide is only responsible for transmitting the image and usually does not perform any additional processing on the image itself (such as magnification or reduction). It can be understood as "parallel light in, parallel light out." For example, the optical engine can be configured to image a cylindrical display position within the viewing window and display the image light in the wearer's eye through the corresponding waveguide.

[0052] To transmit the image light generated by the optical engine to the human eye, a process of optical coupling-in and coupling-out of optical waveguide sheets is required on the optical waveguide. Figure 4 An example of left-eye image coupling in and out is shown. (See example...) Figure 4 As shown, the first optical engine can be located near the left optical input region 1041, for example, arranged on the left side of the lens frame. After the image is generated, it can be fed through the optical input region 1041 into the first optical waveguide sheet realized in the left lens. After total internal reflection in the optical waveguide sheet, the light is emitted at a specific optical output region 1042 and thus seen by the left eye. Although not shown in the figure, the input and output of the right eye image can correspond to the case of the left eye.

[0053] like Figure 4 As shown, the processing unit 1031 can be a single processor or may include multiple processors. In some embodiments, the processing unit 1031 may include a general-purpose main processor and one or more special-purpose coprocessors, such as a graphics processing unit (GPU), a digital signal processor (DSP), etc. In some embodiments, at least a portion of the processing unit 1031 may be implemented using custom 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 may be configured to process the magnetometer extrinsic parameter calibration method described in any embodiment of this application.

[0054] like Figure 4As shown, to enable voice interaction, AR glasses can also be equipped with microphones, such as the first microphone 1032 and the second microphone 1021 illustrated. The first microphone 1032 can be positioned on the temple 1030 to receive the wearer's verbal commands from a location where clear speech is easily accessible. The second microphone 1021 can be positioned on the frame and is primarily used to acquire voice input from the person the wearer is conversing with. The first microphone 1032 and the second microphone 1021 can be considered as a microphone array for directional amplification of the acquired voice signals. In other examples, both the first microphone 1032 and the second microphone 1021 can be positioned, for example, on the frame or the temple. AR glasses can also include a speaker 1033 for playing voice feedback or wearer-specified sound content, such as music, to the wearer. To provide better sound quality, speakers 1033 can be provided on both temples near the ears, 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, configured to form an acoustic dipole effect, for example, one speaker is located at the top of the temple 1030 and the other speaker is located at the bottom of the temple 1030. It can be understood that the speaker located at the bottom of the temple is closer to the wearer's ear, while the speaker located at the top of the temple is farther from the wearer's ear. Therefore, the far-field sound fields of the two speakers at the wearer's ear cancel each other out, while having no effect on the near-field sound field, thus improving the privacy of the AR glasses' voice communication.

[0056] In addition, although Figure 4 Although not shown in the diagram, AR glasses may also include a memory for storing computer-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 embodiments of this application. The memory may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application required for a 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 mentioned above).

[0057] Those skilled in the art will understand that Figure 4The illustrations are merely exemplary and not intended to limit the structure of the AR glasses disclosed herein; the AR glasses may include more or fewer components than illustrated, or combine certain components, or have different component arrangements; or the components in the AR glasses may be deployed in other different locations. For example, the AR glasses may include more microphones. Furthermore, it is understood that in this disclosure, the terms "first," "second," etc., are used to distinguish similar objects and are not used to describe a specific order or sequence, and do not have any additional limiting effect.

[0058] It should be noted that the AR glasses have a glasses-body coordinate system, which includes a first axis, a second axis, and a third axis that are orthogonal to each other. 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 can be understood that when the AR glasses are stationary on a horizontal plane, the first axis is perpendicular to the horizontal plane, and the second axis is an axis pointing in the first direction within the horizontal plane. In one example, a horizontal platform can be used to place the AR glasses, such that the first axis is perpendicular to the surface of the horizontal platform, and the plane defined by the second and third axes is parallel to the surface of the horizontal platform.

[0059] It can be understood that the first axis of the AR glasses always remains perpendicular to the horizontal plane, while the second axis points in a first direction relative to the horizontal plane. This first direction can be any direction, changing as the AR glasses are oriented on the horizontal plane. In some examples, for ease of calculation and orientation, the first direction can be set to one of the four cardinal directions (north, south, east, west), for example: the first direction is... Figure 5 As shown, pointing north (i.e., the Y-axis direction), the second axis component of the magnetometer data can be understood as (0, 1, 0). For example, the first direction is as follows: Figure 5 As shown in the east direction (i.e., the X-axis direction), the second axis component of the magnetometer data at this time can be understood as (1, 0, 0).

[0060] like Figure 5As shown, the AR glasses are placed on a horizontal platform, and a coordinate system for the glasses' body is established. The origin of this 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 orientation of geographical location through the direction of the human eye's gaze, when the AR glasses are stationary on the horizontal platform, their gaze direction is aligned with the first direction. The axis passing through the origin along the gaze direction 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 of the electronic device's coordinate system and the relationship between the first direction and the orientation of the electronic device can be defined according to the shape or usage of the electronic device (e.g., mobile phones are usually held in hand and the top camera faces forward). As long as the electronic device is in a horizontal and stationary state, the first axis of the electronic device's 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 axes: a first axis, a second axis, and a third axis. Understandably, assuming 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 will correspond to the second axis of the glasses' body coordinate system, and the third axis will correspond to the third axis of the glasses' body coordinate system. In this case, all the magnetometer's extrinsic parameters are 1. However, deviations always occur during actual installation. Therefore, 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 transformed magnetometer data for calculating the AR glasses' attitude.

[0063] Step S320: During the process of the electronic device rotating at least one revolution around the first axis of the electronic device in the stationary state, multiple first magnetometer data collected by the magnetometer are acquired; a first rotation matrix is ​​calculated to transform the first axis of the magnetometer to the first axis of the electronic device in the stationary state, which is determined by fitting the multiple first magnetometer data.

[0064] In this embodiment, the AR glasses are rotated around a first axis in a stationary state, that is, the AR glasses are rotated around the first axis in a horizontal plane. This can be achieved by rotating the horizontal platform supporting the AR glasses along the first axis, thereby allowing the AR glasses to rotate around the first axis in a horizontal plane.

[0065] During the rotation of the AR glasses, the magnetometer inside also rotates horizontally along the first axis of the AR glasses, obtaining multiple first magnetometer data points after at least one rotation. Since the magnetometer also rotates in the horizontal plane, without considering errors, multiple first magnetometer data... The corresponding data points will be distributed within the same plane. If the magnetometer is not affected by soft or hard magnetic interference, the data points will form a circle centered at the origin of the magnetometer's coordinate system; if the magnetometer is affected by soft or hard magnetic interference, the data points will form an ellipse, with the center of the ellipse offset from the origin of the magnetometer's coordinate system. For example... Figure 6 As shown, multiple first magnetometer data are displayed. The distribution of the corresponding data points in the coordinate system of the glasses body, where the red points represent the data from the first magnetometer. The corresponding data points. It should be noted that the magnetometer data is represented in the magnetometer coordinate system. Restoring it to the circular plane and moving it to the origin are for calibrating the magnetometer's intrinsic parameters. Therefore, intrinsic and extrinsic parameters are needed to convert it into data in the eyeglass body coordinate system.

[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 eyeglass body coordinate system in a static state. That is, the first axis of the magnetometer coordinate system and the first axis of the eyeglass body coordinate system are aligned by rotation transformation, thereby obtaining the first rotation matrix that transforms the first axis (Z-axis) of the magnetometer coordinate system to the first axis (Z-axis) of the eyeglass body coordinate system.

[0067] Step S330: Select the 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 perform soft and hard magnetic elimination on the second magnetometer data to obtain the third magnetometer data.

[0068] Referring to the foregoing description, the second axis of AR glasses can be either the coordinate axis directly in front of the display unit when the glasses are placed horizontally, or the coordinate axis from the left eye display unit to the right eye display unit. Figure 5 The first direction can be either the Y-axis or the X-axis shown. Figure 5 The direction of the Y-axis or the opposite direction, or the direction of the X-axis or the opposite direction, shown in the embodiments of this application are not limited in any way.

[0069] In one example, the soft magnetic field elimination process is the process of restoring the above ellipse to a circle. After restoring it to a circle, the second magnetometer data for eliminating soft magnetic field is obtained. Hard magnetic field elimination is the process of calculating the center coordinates of the ellipse in the magnetometer coordinate system, and then subtracting the center coordinates of the ellipse from the second magnetometer data after soft magnetic field elimination to obtain the third magnetometer data for eliminating both soft and hard magnetic field.

[0070] For example: the first direction is north (i.e.) Figure 5 In the case of the positive Y-axis direction shown, data from multiple first magnetometers... The second magnetometer data was measured when the second axis of the AR glasses was determined to be pointing due north. Calculate the coordinates of the center of the ellipse in the magnetometer coordinate system. v c The second magnetometer data after eliminating the soft magnetism is Then, the data from the third magnetometer after eliminating both hard and soft magnetism is: Third magnetometer data The horizontal component indicates the second axis of the magnetometer before the first axis transformation.

[0071] In this embodiment, the elimination of both soft and hard magnetism is carried out in the plane where the data points corresponding to the multiple first magnetometer data are distributed. That is, in the process of eliminating soft and hard magnetism, the two-dimensional soft and hard magnetism parameters are solved. The two-dimensional data (in the form of an ellipse) can be collected very densely and uniformly. Compared with the traditional method of collecting uniform and dense data points on an ellipsoid, the operation is easier and the amount of data to be calculated is less (reducing the amount of calculation in one dimension).

[0072] Step S340: Calculate the 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 involves processing the data from the third magnetometer. The first axis transformation is performed to obtain the data from the fifth magnetometer. The purpose of process one is to align the z-axis with the data from the third magnetometer. The second process involves determining the horizontal component from the data of the fifth magnetometer, which indicates the second axis of the magnetometer after the first axis transformation.

[0074] Data from the third magnetometer Performing the first axis transformation means transforming the third magnetometer data according to the first rotation matrix to obtain the fifth magnetometer data. In other words, the fifth magnetometer data is: in, This is the first rotation matrix. It can be seen that the second magnetometer data was measured when the second axis of the AR glasses pointed due north. After converting internal parameters to eliminate the influence of soft and hard magnetism in the environment, the third magnetometer data was obtained. and data from the third magnetometer 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 data from the fifth magnetometer The horizontal component represents the second axis of the magnetometer after the first axis transformation, i.e., the second axis of the magnetometer coordinate system after the first axis transformation, such as the y-axis of the magnetometer coordinate system after the first axis transformation. The second axis of the magnetometer is then transformed to match the second axis of the AR glasses in a static state. This means aligning the second axis of the magnetometer coordinate system with the second axis of the glasses' body coordinate system through a rotation transformation, thus obtaining the second rotation matrix. It should be noted that once both axes of the two coordinate systems are aligned, the third axis is also aligned, thereby aligning the magnetometer coordinate system and the glasses' body coordinate system.

[0076] Step S350: Calibrate the extrinsic parameters of the magnetometer based on the first rotation matrix and the second rotation matrix. Specifically, the extrinsic parameters of the magnetometer can be obtained according to the following formula. : .in, This is the second rotation matrix. This extrinsic parameter represents the rotation relationship from the magnetometer coordinate system to the eyeglass body coordinate system, that is, the point product of the magnetometer data points to the extrinsic parameter. This will align with the coordinate system of the glasses themselves, thus providing the AR glasses with real geographical location information.

[0077] In this embodiment, it is not necessary to perform a complete soft and hard magnetic calibration of the magnetometer before the external parameter calibration. Instead, during the external parameter calibration process, soft and hard magnetic elimination is performed in the plane where the data points corresponding to the multiple first magnetometer data are distributed. This avoids the influence of soft and hard magnetic fields on the external parameter calibration, which not only accurately calibrates the external parameters from the magnetometer to the electronic device, but also simplifies the entire external parameter calibration process and improves the external parameter calibration efficiency of the magnetometer.

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

[0079] In some embodiments, calculating the first rotation matrix in step S320, which transforms the first axis of the magnetometer determined by fitting the data of the plurality of first magnetometers to the first axis of the electronic device in a stationary state, specifically includes: The normal to the first plane is determined by fitting the data from the plurality of first magnetometers to the first plane.

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

[0081] In one example, still using AR glasses as an example, such as Figure 6 As shown, since the AR glasses rotate in the horizontal plane, the magnetometer also rotates in the horizontal plane. Therefore, without considering errors, multiple 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 points will be affected. The corresponding data points are distributed on the circumference of the ellipse. In this embodiment, the data from the first magnetometer distributed on the circumference of the ellipse are used... The corresponding data points are fitted to a plane to obtain the first fitted plane. The normal to the first plane is a straight line perpendicular to it, denoted as . n Due to the data from the first magnetometer All data is represented in the magnetometer coordinate system, and the magnetometer rotates with the AR glasses. Therefore, the first magnetometer data obtained based on the rotation... The first plane fitted to the corresponding point corresponds to the horizontal plane, and the coordinate axis parallel to the normal of the first plane is determined as the first axis of the magnetometer coordinate system.

[0082] It should be noted that existing mature plane fitting methods can be used for plane fitting. In this embodiment, the specific method of plane fitting is not limited.

[0083] The first axis of the AR glasses in a static state, for example, the z-axis, is denoted as: So, normal n The rotational relationship expression when the AR glasses are rotated to align with the first axis in their stationary state is as follows: By using this rotation relationship, the first rotation matrix that aligns the first axis of the magnetometer coordinate system with the first axis of the AR glasses can be obtained. .

[0084] In some embodiments, step S330, which involves performing soft and hard magnetic elimination on the second magnetometer data to obtain the third magnetometer data, specifically includes: The first ellipse is fitted based on the data from the multiple first magnetometers to obtain the first center of the first ellipse.

[0085] The second transformed magnetometer data corresponding to the second magnetometer data when the first ellipse is transformed into a circle is determined in order to perform soft magnetic elimination.

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

[0087] In one example, still using AR glasses as an example, a first ellipse is fitted using data points corresponding to multiple first magnetometer data points. Existing mature curve fitting methods can be used for ellipse fitting; in this embodiment, the specific method of ellipse fitting is not limited. After the first ellipse is fitted, its first center is determined, and the coordinates of the ellipse's center in the magnetometer coordinate system can be obtained as follows: v c .

[0088] The second magnetometer data is selected from multiple first magnetometer data points and measured when the second axis of the AR glasses points in the first direction. For example, if the first direction is north, the second magnetometer data would be... The first ellipse is transformed into a circle to eliminate the soft magnetism, resulting in the second transformed magnetometer data, which is the second magnetometer data after eliminating the soft magnetism. .

[0089] Since hard magnetic cancellation is essentially restoring the first circle center to the origin of the magnetometer coordinate system, hard magnetic cancellation of the second transformed magnetometer data based on the first circle center refers to the second transformed magnetometer data... Subtract the coordinates of the first center of the circle v c That is, the third magnetometer data obtained after eliminating soft and hard magnetism is .

[0090] like Figure 7 and 8 As shown, Figure 7 This is a schematic diagram showing the distribution of data points on a circle after the soft magnetic field has been eliminated. Figure 8 A schematic diagram showing how the coordinates of the center of the circle are restored to the origin of the magnetometer coordinate system after the hard magnetism is eliminated.

[0091] In this embodiment, by fitting an ellipse onto multiple first magnetometer data points in a plane, restoring the ellipse to a circle, and subtracting the center coordinates of the circle from the second magnetometer data, the influence of soft and hard magnetism on external parameter calibration is eliminated within the plane. Furthermore, eliminating soft and hard magnetism within the plane, compared to the traditional method of restoring the ellipsoid to a sphere and then calculating the center coordinates to eliminate soft and hard magnetism, reduces the computational workload by one dimension, thus improving the efficiency of external parameter calibration while maintaining the accuracy of the magnetometer's external parameter calibration.

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

[0093] Determine the projection points of the plurality of first magnetometer data in the second plane.

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

[0095] In this embodiment, the method of fitting the second plane is basically the same as that of fitting the first plane. Of course, the first plane can also be directly used as the second plane to reduce one fitting step. The projection points of the plurality of first magnetometer data in the second plane are determined, and the first ellipse is fitted based on these projection points. This allows for a more accurate fitting of the first ellipse, ensuring that the fitted first ellipse lies within a single plane.

[0096] In this embodiment, the transformation of the first ellipse into a circle 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 and minor axes of the first ellipse as the radius of the circle, to restore the first ellipse into a circle.

[0097] In some embodiments, prior to step S320, the method further includes: acquiring 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 the second rotation matrix of the second axis of the magnetometer determined by the third magnetometer data, which transforms the second axis of the electronic device to its stationary state, includes: The third magnetometer data is transformed along the first axis to obtain the fifth magnetometer data.

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

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

[0101] In one example, still using AR glasses as an example, data from the fourth magnetometer 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 north (i.e., Figure 5 In the case of the positive Y-axis direction shown, the first component is .

[0102] Third magnetometer data Performing the first axis conversion refers to converting the data from the third magnetometer. Transform using the first rotation matrix to obtain the data from the fifth magnetometer. .

[0103] Acquiring data from the fifth magnetometer The horizontal component, i.e. The horizontal component indicates the second axis of the magnetometer after the first axis transformation, for example, the y-axis, while the first component indicates the second axis of the AR glasses in a static state, for example, the y-axis.

[0104] According to the first component Horizontal components Calculate the second rotation matrix. Specifically, calculate it according to the following formula: , of which the first component and horizontal components All quantities are known, thus the second rotation matrix can be calculated. .

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

[0106] In one example, a hexahedron is chosen as the horizontal platform to support the AR glasses. The AR glasses are placed on the horizontal surface 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] Secondly, embodiments of this application also provide a magnetometer extrinsic parameter calibration system for electronic devices, such as... Figure 9 As shown, it includes: Electronic devices 910, such as AR glasses.

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

[0109] The calibration device 930 includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the magnetometer extrinsic parameter calibration method of the electronic device as described above.

[0110] Specifically, the calibration device 930 can be wired or wirelessly connected to the electronic device 910 to obtain the data of each 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 electronic device.

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

[0112] Thirdly, embodiments of this application also provide an electronic device, including a magnetometer whose extrinsic parameters are calibrated using the magnetometer extrinsic parameter calibration method described in any of the above-mentioned electronic devices. Through the extrinsic parameter calibration using the above method, the coordinate systems of the electronic device and the magnetometer therein are aligned, ensuring that the magnetometer can provide the electronic device with correct geographical location information.

[0113] Figure 10 An example is a schematic diagram of the physical structure 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 can call logical instructions in the memory 103 to execute a magnetometer extrinsic parameter calibration method for the electronic device, the method including: The electronic device is positioned on a horizontal plane and is in a stationary state, with a first axis and a second axis. 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.

[0114] During the process of the electronic device rotating at least once around the first axis of the electronic device in a stationary state, multiple first magnetometer data collected by the magnetometer are acquired; a first rotation matrix is ​​calculated to transform the first axis of the magnetometer to the first axis of the electronic device in a stationary state, which is determined by fitting the multiple first magnetometer data.

[0115] Select the second magnetometer data obtained when the second axis of the electronic device points to the first direction from the plurality of first magnetometer data, and perform soft and hard magnetic elimination on the second magnetometer data to obtain the third magnetometer data.

[0116] The second rotation matrix is ​​calculated to transform the second axis of the magnetometer, determined by the third magnetometer data, into 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] Furthermore, the logical instructions in the aforementioned memory 103 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to related technologies, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0119] On the other hand, this application also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the magnetometer extrinsic parameter calibration method for the electronic device provided by the above methods, the method including: The electronic device is positioned on a horizontal plane and is in a stationary state, with a first axis and a second axis. 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.

[0120] During the process of the electronic device rotating at least once around the first axis of the electronic device in a stationary state, multiple first magnetometer data collected by the magnetometer are acquired; a first rotation matrix is ​​calculated to transform the first axis of the magnetometer to the first axis of the electronic device in a stationary state, which is determined by fitting the multiple first magnetometer data.

[0121] Select the second magnetometer data obtained when the second axis of the electronic device points to the first direction from the plurality of first magnetometer data, and perform soft and hard magnetic elimination on the second magnetometer data to obtain the third magnetometer data.

[0122] The second rotation matrix is ​​calculated to transform the second axis of the magnetometer, determined by the third magnetometer data, into 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, this application also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements a magnetometer extrinsic parameter calibration method for the electronic device provided by the methods described above, the method comprising: The electronic device is positioned on a horizontal plane and is in a stationary state, with a first axis and a second axis. 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.

[0125] During the process of the electronic device rotating at least once around the first axis of the electronic device in a stationary state, multiple first magnetometer data collected by the magnetometer are acquired; a first rotation matrix is ​​calculated to transform the first axis of the magnetometer to the first axis of the electronic device in a stationary state, which is determined by fitting the multiple first magnetometer data.

[0126] Select the second magnetometer data obtained when the second axis of the electronic device points to the first direction from the plurality of first magnetometer data, and perform soft and hard magnetic elimination on the second magnetometer data to obtain the third magnetometer data.

[0127] The second rotation matrix is ​​calculated to transform the second axis of the magnetometer, determined by the third magnetometer data, into 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. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0130] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of software products. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0131] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A method for calibrating the external parameters of a magnetometer in an electronic device, comprising: The electronic device is positioned on a horizontal plane and is in a stationary state, with a first axis and a second axis. 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. During the process of the electronic device rotating at least once around the first axis of the electronic device in a stationary state, multiple first magnetometer data collected by the magnetometer are acquired; Calculate the first rotation matrix that transforms the first axis of the magnetometer, determined by fitting the data from the plurality of first magnetometers, into the first axis of the electronic device in a stationary state; Select the 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 perform soft and hard magnetic elimination on the second magnetometer data to obtain the third magnetometer data; Calculate the second rotation matrix of the second axis of the magnetometer, determined by the third magnetometer data, to transform the second axis of the electronic device into 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 the first rotation matrix, determined by fitting the data from the plurality of first magnetometers, to transform the first axis of the magnetometer to the first axis of the electronic device in a stationary state, includes: Based on the data from the multiple first magnetometers, a first plane is fitted to determine the 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 static state.

3. The method according to claim 1, wherein, The third magnetometer data obtained by performing soft and hard magnetic elimination on the second magnetometer data includes: Based on the data from the multiple first magnetometers, a first ellipse is fitted to obtain the first center of the first ellipse; Determine the second transformed magnetometer data corresponding to the second magnetometer data when the first ellipse is transformed into a circle, so as to perform soft magnetic elimination; Hard magnetic elimination is performed on the second transformed magnetometer data based on the first 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 includes: A second plane is fitted based on the data from the plurality of first magnetometers; Determine the projection points of the plurality of first magnetometer data in the second plane; The first ellipse is fitted based on the projection points; The transformation of the first ellipse into a circle includes: restoring the first ellipse into a circle by taking the first center of the first ellipse as the center of the circle and the square root of the product of the major and minor axes of the first ellipse as the radius of the 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: acquiring 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 the second rotation matrix, determined by the third magnetometer data, to transform the second axis of the magnetometer to the second axis of the electronic device in a stationary state, includes: The third magnetometer data is transformed along a first axis to obtain the fifth magnetometer data; The horizontal component of the fifth magnetometer data is acquired, wherein the horizontal component indicates the second axis of the magnetometer after the first axis transformation, and the first component indicates the second axis of the electronic device in a static state; The second rotation matrix is ​​calculated based on the first component and the horizontal component.

6. The method according to claim 1, wherein, The horizontal plane is one face of a hexahedron, and the first, second, and third axes of the electronic device in its stationary state are all perpendicular to two opposite faces of the hexahedron.

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

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 executes the computer program to implement a magnetometer extrinsic parameter calibration method for an electronic device as described in any one of claims 1 to 6.

9. An electronic device comprising a magnetometer whose external parameters are calibrated using the magnetometer external parameter calibration method of any one of claims 1 to 6.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement a magnetometer extrinsic parameter calibration method for an electronic device as described in any one of claims 1 to 6.

Citation Information

Patent Citations

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

    CN115014390A

  • Magnetometer error correction method based on ellipsoid fitting

    CN118535846A