Magnetic declination and due north direction determination method and device and storage medium

By recording the sun and analyzing direction information in computer vision and astronomical theory, the problems of high-precision determination of the positive north direction and magnetic declination angle in the prior art are solved, and high-precision and low-cost magnetic declination angle and magnetic declination angle determination are achieved.

CN119984169APending Publication Date: 2025-05-13XIAMEN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510173738.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-02-18
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

In the prior art, the efficiency is low and the measurement cost is high in the high precision determination process of the positive north direction and magnetic declination angle.

Method used

By recording the sun with camera equipment, combining computer vision and astronomical theory, the sun's direction information is analyzed to determine the camera's attitude angle, and calibrate the gravity sensor and geomagnetic sensor to finally determine the magnetic declination angle and the positive north direction.

Benefits of technology

The observation accuracy in the north direction is improved, the measurement cost is reduced, and the error caused by manual alignment is reduced through the automated calibration process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119984169A_ABST
    Figure CN119984169A_ABST
Patent Text Reader

Abstract

The invention discloses a magnetic declination and due north direction determination method and device and a storage medium. The method comprises the following steps: recording the sun at a fixed pose by using camera equipment to obtain recording information; analyzing the video information in a computer vision mode to obtain sun first direction information of the sun relative to camera equipment, and determining sun second direction information of the sun relative to a ground coordinate system in an astronomical theory calculation mode; determining a camera attitude angle of the camera device relative to the ground coordinate system according to the first sun direction information and the second sun direction information; sequentially calibrating a gravity sensor and a geomagnetic sensor according to the camera attitude angle; and sequentially determining the magnetic declination and the due north direction according to the calibrated geomagnetic sensor and the calibrated gravity sensor. According to the invention, the problems of low efficiency and high measurement cost in the high-precision determination process of the due north direction and the magnetic declination in the prior art can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] In the related art, the main methods for measuring the true north direction include astronomical measurement, global positioning system (GNSS) measurement, and gyroscope measurement. Among them, the astronomical measurement method is to observe the stars in the sky (such as the North Star). Because the sun is too large and too bright, the accurate true north direction is rarely determined by measuring the position of the sun. The GNSS rule is to measure the GNSS coordinates of two points on the surface of the earth by GNSS, and then determine the direction of the meridian through coordinate transformation and geometric relationship to obtain the true north direction. The gyroscope rule is a method of determining the earth's axis and the true north direction by measuring the angle of the earth's rotation due to its rotation within a certain period of time based on the directivity of the gyroscope. The equipment required for these methods is expensive, the measurement process is complicated and time-consuming, and it is not conducive to large-scale promotion.

[0003] Currently, no effective solution has been proposed to the problems of low efficiency and high measurement cost in the high-precision determination of the true north direction and magnetic declination in the related technologies. Summary of the invention

[0004] The main purpose of the present application is to provide a method, device and storage medium for determining magnetic declination and true north direction, so as to solve the problems of low efficiency and high measurement cost in the high-precision determination of true north direction and magnetic declination in the related art.

[0005] In order to achieve the above-mentioned purpose, according to the first aspect of the present application, a method for determining the magnetic declination and the true north direction is provided. The method comprises: using a camera device to record the sun in a fixed position to obtain recording information; analyzing the recording information by computer vision to obtain the first direction information of the sun relative to the camera device, and determining the second direction information of the sun relative to the ground coordinate system by astronomical theoretical calculation; determining the camera attitude angle of the camera device relative to the ground coordinate system according to the first direction information of the sun and the second direction information of the sun; calibrating the gravity sensor and the geomagnetic sensor in turn according to the camera attitude angle to obtain a calibrated gravity sensor and a calibrated geomagnetic sensor; determining the magnetic declination and the true north direction in turn according to the calibrated geomagnetic sensor and the calibrated gravity sensor.

[0006] Furthermore, the camera attitude angle of the camera device relative to the ground coordinate system is determined according to the first direction information of the sun and the second direction information of the sun, including: setting the attitude angle variable, and determining the coordinate transformation matrix between the ground coordinate system and the camera coordinate system of the camera device; at a preset time, converting the first direction information of the sun to the ground coordinate system based on the coordinate transformation matrix to obtain the converted direction information; establishing a group of equations containing attitude angle variables by making the converted direction information equal to the second direction information of the sun; repeating the above steps of establishing a group of equations containing attitude angle variables by making the converted direction information equal to the second direction information of the sun at different times, so that the number of equation groups exceeds the number of attitude angles, and performing least squares solution calculation on the group of equations to obtain the camera attitude angle of the camera device relative to the ground coordinate system.

[0007] Furthermore, the video information is analyzed by computer vision to obtain the first direction information of the sun relative to the camera device, including: acquiring picture information in the video information, processing the video information by computer vision to obtain a sun outline image; identifying the sun center according to the sun outline image, and determining the center coordinates of the sun center in the pixel coordinate system based on the Hough transform method; and obtaining the first direction information of the sun using the coordinate transformation theory according to the center coordinates and the camera intrinsic parameters.

[0008] Furthermore, the gravity sensor is calibrated according to the camera attitude angle to obtain a calibrated gravity sensor, including: obtaining the projection of gravity in the camera coordinate system during video recording through coordinate transformation theory according to the projection of gravity in the ground coordinate system and the camera attitude angle; determining the coordinate transformation matrix between the gravity sensor body coordinate system and the camera coordinate system according to the gravity sensor reading during video recording and the projection of gravity in the camera coordinate system; according to the coordinate transformation matrix, using the coordinate transformation theory to reversely calculate the rotation angle between the body coordinate system and the camera coordinate system to obtain the installation deviation angle of the gravity sensor; and projecting the gravity sensor reading at any time into the camera coordinate system according to the installation deviation angle to obtain the calibrated gravity sensor reading as the calibration value of the gravity sensor.

[0009] Furthermore, the geomagnetic sensor is calibrated according to the camera attitude angle to obtain a calibrated geomagnetic sensor, including: recording the gravity sensor reading and the geomagnetic sensor reading of the camera during video recording; arbitrarily rotating the camera to a preset attitude angle, and again recording the gravity sensor and geomagnetic sensor readings, wherein the gravity vector is not parallel or perpendicular to the camera coordinate axis at the preset attitude angle; determining the coordinate transformation matrix of the camera coordinate system during the rotation process according to the calibration value of the gravity sensor during video recording and at the preset attitude angle; obtaining the projection of the rotation vector representing the rotation process in the camera coordinate system according to the Rodriguez formula as the first projection of the rotation vector; and obtaining the rotation vector of the geomagnetic sensor during video recording and at the preset attitude angle according to the calibration value of the gravity sensor during video recording and at the preset attitude angle. The coordinate transformation matrix of the geomagnetic sensor body coordinate system during the rotation process is determined based on the reading of the geomagnetic sensor; the projection of the rotation vector representing the rotation process in the geomagnetic sensor body coordinate system is obtained according to the Rodriguez formula, which is called the second projection of the rotation vector; based on the first projection and the second projection, the coordinate transformation matrix between the geomagnetic sensor body coordinate system and the camera coordinate system is determined using the coordinate transformation theory; based on the coordinate transformation matrix, the rotation angle of the geomagnetic sensor body coordinate system relative to the camera coordinate system is determined using the coordinate transformation theory as the installation deviation angle of the geomagnetic sensor; based on the installation deviation angle, the geomagnetic sensor reading at any time is projected into the camera coordinate system to obtain the calibrated gravity sensor reading as the calibration value of the gravity sensor.

[0010] Furthermore, the magnetic declination is determined based on the calibrated geomagnetic sensor, including: obtaining the calibration value of the geomagnetic sensor at the time of camera recording; calculating the projection of the geomagnetic vector in the ground coordinate system through coordinate transformation theory based on the camera attitude angle and the calibration value of the geomagnetic sensor at the time of camera recording; and taking the component of the geomagnetic vector projected in the horizontal plane as the magnetic declination, wherein the angle between the geomagnetic vector and the horizontal plane is the magnetic inclination.

[0011] Furthermore, the true north direction is determined according to the calibrated geomagnetic sensor and the calibrated gravity sensor, including: calculating the projection of the gravity vector and the geomagnetic vector in the camera coordinate system during video recording according to the geomagnetic sensor reading, the gravity sensor reading, the installation deviation angle of the gravity sensor, and the installation deviation angle of the geomagnetic sensor; calculating the projection of the gravity vector and the geomagnetic vector in the ground coordinate system according to the projection of the gravity vector and the geomagnetic vector in the camera coordinate system and the camera attitude angle using coordinate transformation theory as the readings of the gravity sensor and the geomagnetic sensor when the camera coordinate system is parallel to the ground coordinate system; calculating the calibration values ​​of the gravity sensor and the geomagnetic sensor according to the installation deviation angle of the gravity sensor, the installation deviation angle of the geomagnetic sensor, and the readings of the gravity sensor and the geomagnetic sensor; rotating the camera to be parallel to the ground coordinate system according to the calibration values ​​of the gravity sensor and the geomagnetic sensor; when the camera coordinate system is parallel to the ground coordinate system, correcting the direction of the geomagnetic vector based on the magnetic declination to obtain the true north direction.

[0012] In order to achieve the above-mentioned purpose, according to the second aspect of the present application, a device for determining the true north direction is provided. The device includes: a video recording unit, which is used to use a camera device to record the sun in a fixed position to obtain video information; a direction information determination unit, which is used to analyze the video information by computer vision to obtain the first direction information of the sun relative to the camera device, and to determine the second direction information of the sun relative to the ground coordinate system by astronomical theory calculation; an attitude angle determination unit, which is used to determine the camera attitude angle of the camera device relative to the ground coordinate system according to the first direction information of the sun and the second direction information of the sun; a calibration unit, which is used to calibrate the gravity sensor and the geomagnetic sensor in turn according to the camera attitude angle to obtain a calibrated gravity sensor and a calibrated geomagnetic sensor; a magnetic declination and true north determination unit, which is used to determine the magnetic declination and the true north direction in turn according to the calibrated geomagnetic sensor and the calibrated gravity sensor.

[0013] According to a third aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, a method for determining a magnetic declination and a true north direction according to any one of the above items is implemented.

[0014] According to a fourth aspect of an embodiment of the present application, an electronic device is provided, comprising: a processor; and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, any one of the above-mentioned methods for determining the magnetic declination and the true north direction is implemented.

[0015] Through this application, the following steps are adopted: using a camera device to record the sun in a fixed position to obtain video information; analyzing the video information by computer vision to obtain the first direction information of the sun relative to the camera device, and determining the second direction information of the sun relative to the ground coordinate system by astronomical theory calculation; determining the camera attitude angle of the camera device relative to the ground coordinate system according to the first direction information and the second direction information of the sun; calibrating the gravity sensor and the geomagnetic sensor in turn according to the camera attitude angle to obtain the calibrated gravity sensor and the calibrated geomagnetic sensor; determining the magnetic declination and the true north direction in turn according to the calibrated geomagnetic sensor and the calibrated gravity sensor. Through this application, the problems of low efficiency and high measurement cost in the high-precision determination process of the true north direction and magnetic declination in the related art can be solved. On the one hand, the rotation of the camera posture is realized by using the sensor feedback value, which reduces the error caused by manual alignment; on the other hand, the computer vision method is used to determine the camera attitude angle by the astronomical azimuth information of the sun, which improves the recognition accuracy of the camera attitude angle. This effectively ensures the observation accuracy of the true north direction; in addition, the devices used in this invention are mostly common electronic products, and the cost can be effectively controlled. These features can effectively improve the efficiency of determining magnetic declination and true north direction and reduce measurement costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0017] Figure 1 is a flow chart of a method for determining magnetic declination and true north direction provided in an embodiment of the present application;

[0018] Figure 2 is a schematic diagram of the relationship between a camera and a ground coordinate system during video recording provided in an embodiment of the present application;

[0019] Figure 3 is a schematic diagram of the coordinate system relationship when the camera is parallel to the ground according to an embodiment of the present application;

[0020] Figure 4 is a schematic diagram of the relationship between the magnetic declination and the installation deviation angle provided in an embodiment of the present application;

[0021] Figure 5 is a schematic diagram of a device for determining a magnetic declination and a true north direction provided in an embodiment of the present application;

[0022] Figure 6 It is a schematic diagram of the network architecture of an electronic device provided according to an embodiment of the present application. DETAILED DESCRIPTION

[0023] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0024] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0026] According to an embodiment of the present application, a method for determining a magnetic declination and a true north direction is provided.

[0027] Figure 1 : is a flow chart of a method for determining magnetic declination and true north direction according to an embodiment of the present application. Figure 1 As shown, the method comprises the following steps:

[0028] Step S101, use a camera device to record the sun in a fixed position to obtain video information.

[0029] For example, the camera device may generally refer to a mobile phone device. When the position and orientation of the camera remain unchanged during the shooting process, the camera lens is pointed toward the sun, and continuous video recording is performed to obtain video information and the like.

[0030] Step S102, analyzing the video information by computer vision to obtain the first direction information of the sun relative to the camera device, and determining the second direction information of the sun relative to the ground coordinate system by astronomical theory calculation.

[0031] Among them, the first direction information refers to the direction information of the sun relative to the camera device (i.e., the video recording device) analyzed and obtained from the video through computer vision technology, and the second direction information refers to the direction information of the sun relative to the ground coordinate system (such as the longitude and latitude coordinate system). In this application, based on the video information (i.e., video information) recorded by the camera device, the specific direction of the sun relative to the camera device can be analyzed and determined. Here, "video information" refers to all relevant data contained in the video, such as the brightness of the picture, color distribution, direction and length of the shadow of the object, etc., which can indirectly reflect the position and direction of the sun. "Direction information of the sun relative to the camera device" refers to the relative position relationship between the sun and the camera device, such as whether the sun is directly above, obliquely above, to the side or behind the camera, etc., which is an experimental measurement result obtained by experimental means. By analyzing the characteristics of light and shadow changes, color distribution, and shadows of objects in the video information, the specific direction of the sun can be inferred.

[0032] Specifically, the first direction information of the sun relative to the camera device is obtained by analyzing the video information by computer vision, which can be obtained through the following steps: acquiring image information in the video information, processing the video information by computer vision, and obtaining a sun outline image; identifying the sun center according to the sun outline image, and determining the center coordinates of the sun center in the pixel coordinate system based on the Hough transform method; and obtaining the first direction information of the sun using the coordinate transformation theory according to the center coordinates and the camera intrinsic parameters.

[0033] For example, Figure 2As shown, a camera is used to take a picture of the sun, and the position of the sun relative to the camera is determined by computer vision. This step is to extract single or multiple frames of image information from the video information. The video information is usually a video file containing a continuous sequence of images, and the image information is one or several frames of these video frames. The video information is processed by computer vision to obtain the sun outline image: In this step, computer vision technology (such as image processing algorithm) is used to process the extracted image information. The purpose of the processing is to identify and extract the sun's outline image from the picture. This usually involves steps such as image enhancement, edge detection, and morphological processing to highlight the edge of the sun and remove background noise. Identify the center of the sun based on the sun outline image: After obtaining the sun outline image, the next step is to identify the center position of the sun. This can be achieved by calculating the centroid of the outline, using a circular fitting algorithm or other image processing methods. The identification of the center of the sun is crucial for the subsequent determination of the camera direction. Determine the center coordinates of the sun's center in the pixel coordinate system based on the Hough transform method: The Hough transform is an algorithm used to detect specific shapes (such as lines, circles, etc.) in an image. Here, it may be used to more accurately determine the position of the sun's center in the pixel coordinate system. Through Hough transform, the circle that best matches the sun's outline can be identified and the coordinates of its center can be determined. Based on the coordinate transformation theory, the projection of the sun in the camera coordinate system is obtained according to the center coordinates and the camera's internal parameters to obtain the sun's first direction information, where the coordinate transformation theory can include translation, rotation, shear, reflection, etc. between coordinates.

[0034] Step S103: determining a camera attitude angle of the camera device relative to the ground coordinate system according to the first sun direction information and the second sun direction information.

[0035] The camera attitude angle includes the camera's attitude (such as pitch angle, yaw angle, roll angle) and position (such as three-dimensional coordinates relative to a reference point), which respectively describe the camera's rotation angles around the X-axis, Y-axis, and Z-axis.

[0036] In some embodiments, the camera attitude angle of the camera device relative to the ground coordinate system is determined based on the first direction information of the sun and the second direction information of the sun, which can be obtained by the following steps: setting the attitude angle variable, and determining the coordinate transformation matrix between the ground coordinate system and the camera coordinate system of the camera device; at a preset time, converting the first direction information of the sun to the ground coordinate system based on the coordinate transformation matrix to obtain the converted direction information; establishing a group of equations containing the attitude angle variables by making the converted direction information equal to the second direction information of the sun; repeating the above steps of establishing a group of equations containing the attitude angle variables by making the converted direction information equal to the second direction information of the sun at different times, so that the number of equation groups exceeds the number of attitude angles, and performing a least squares solution calculation on the group of equations to obtain the camera attitude angle of the camera device relative to the ground coordinate system.

[0037] For example, assume that the position of the center of the sun in the camera coordinate system is represented by the pixel coordinates of the sun (u, v), the coordinates of the sun in the ground coordinate system are represented by (α, β), and the distance between the sun and the earth is set to unit 1. The coordinate transformation matrix between the camera and the ground coordinate system is recorded as Ccg, which is a function of the attitude angles γ1, γ2, and γ3 of the camera coordinate system, and is therefore also written as Ccg(γ1, γ2, γ3). The coordinates of the sun in the ground coordinate system can be calculated based on (α, β), and the coordinates of the sun in the camera coordinate system can be further calculated based on the coordinate transformation Ccg(γ1, γ2, γ3), and the coordinates of the sun in the pixel coordinate system (u1, v1) can be further calculated based on the camera intrinsic parameters. Let u=u1, v=v1 to establish two equations about γ1, γ2, and γ3. Repeating the above process at other times can obtain more equations, and combining these equations can obtain a system of equations greater than 3. Since the number of unknowns is less than the number of equations, the least squares method can be used to solve the results of γ1, γ2, and γ3, which determines the attitude angle or posture of the camera.

[0038] Step S104, calibrating the gravity sensor and the geomagnetic sensor in sequence according to the camera attitude angle to obtain a calibrated gravity sensor and a calibrated geomagnetic sensor.

[0039] Specifically, the gravity sensor is calibrated according to the camera attitude angle to obtain a calibrated gravity sensor, which can be obtained through the following steps: according to the projection of gravity in the ground coordinate system and the camera attitude angle, the projection of gravity in the camera coordinate system during video recording is obtained through the coordinate transformation theory; according to the gravity sensor reading during video recording and the projection of gravity in the camera coordinate system, the coordinate transformation matrix between the gravity sensor body coordinate system and the camera coordinate system is determined; according to the coordinate transformation matrix, the rotation angle between the body coordinate system and the camera coordinate system is reversely calculated using the coordinate transformation theory to obtain the installation deviation angle of the gravity sensor; according to the installation deviation angle, the gravity sensor reading at any time is projected into the camera coordinate system to obtain the calibrated gravity sensor reading as the calibration value of the gravity sensor.

[0040] Exemplarily, the projection of the direction of the gravity vector in the ground coordinate system is known, and the projection of the gravity vector in the camera coordinate system during recording can be calculated by the camera attitude angle obtained previously. The projection of gravity in the gravity sensor during recording can be obtained based on its reading. Based on these two projections and coordinate transformation theory, the coordinate transformation matrix between the gravity sensor and the camera coordinate system and the installation deviation angle of the gravity sensor can be calculated. With this installation deviation angle information, the projection of the gravity vector in the camera coordinate system can be determined at any time based on the reading of the gravity sensor, that is, the calibration value of the gravity sensor can be obtained.

[0041] In some embodiments, the geomagnetic sensor is calibrated according to the camera attitude angle to obtain a calibrated geomagnetic sensor, which can be obtained by the following steps: recording the gravity sensor reading and the geomagnetic sensor reading of the camera when recording; rotating the camera to a preset attitude angle arbitrarily, and recording the gravity sensor and the geomagnetic sensor readings again, wherein the gravity vector is not parallel or perpendicular to the camera coordinate axis at the preset attitude angle; determining the coordinate transformation matrix of the camera coordinate system during the rotation process according to the calibration value of the gravity sensor during recording and at the preset attitude angle; obtaining the projection of the rotation vector representing the rotation process in the camera coordinate system according to the Rodriguez formula as the first projection of the rotation vector; and obtaining the first projection of the rotation vector according to the calibration value of the gravity sensor during recording and at the preset attitude angle. The reading of the geomagnetic sensor is used to determine the coordinate transformation matrix of the geomagnetic sensor body coordinate system during the rotation process; the projection of the rotation vector representing the rotation process in the geomagnetic sensor body coordinate system is obtained according to the Rodriguez formula, which is called the second projection of the rotation vector; according to the first projection and the second projection, the coordinate transformation theory is used to determine the coordinate transformation matrix between the geomagnetic sensor body coordinate system and the camera coordinate system; according to the coordinate transformation matrix, the coordinate transformation theory is used to determine the rotation angle of the geomagnetic sensor body coordinate system relative to the camera coordinate system as the installation deviation angle of the geomagnetic sensor; according to the installation deviation angle, the geomagnetic sensor reading at any time is projected into the camera coordinate system to obtain the calibrated gravity sensor reading as the calibration value of the gravity sensor.

[0042] For example, after calibrating the gravity sensor, the geomagnetic sensor can be further calibrated. Due to the magnetic declination and magnetic inclination, the projection of the geomagnetic vector in the ground coordinate system is unknown, so we cannot use the gravity sensor calibration method to calibrate the geomagnetic sensor. For this purpose, this application designs the following geomagnetic sensor calibration method:

[0043] a. Read the values ​​of the gravity sensor and geomagnetic sensor when the camera is recording;

[0044] b. Rotate the camera to an angle to avoid the camera coordinate system axis being parallel or perpendicular to the gravity vector;

[0045] c. Record the gravity sensor and geomagnetic sensor readings at this time;

[0046] d. Calibrate the readings of the gravity sensor. According to the changes in the calibration values, the coordinate transformation matrix of the camera coordinate system in this process can be determined;

[0047] e. According to the Rodriguez formula and this coordinate transformation matrix, the projection of the rotation vector in the camera coordinate system (first projection) can be calculated;

[0048] f. According to the change in the reading of the geomagnetic sensor, the coordinate change matrix of the geomagnetic sensor in this process can be calculated;

[0049] g. According to the Rodriguez formula and the coordinate change matrix, the projection of the rotation vector in the geomagnetic sensor (second projection) can be calculated;

[0050] h. Calculate the coordinate transformation matrix of the geomagnetic sensor and the camera coordinate system and the installation deviation angle of the geomagnetic sensor according to the two projections of the obtained rotation vector and the coordinate transformation theory;

[0051] i. With these installation deviation angles, the projection of the geomagnetic vector in the camera coordinate system can be determined at any time based on the readings of the geomagnetic sensor, that is, the calibration value of the geomagnetic sensor can be obtained.

[0052] Step S105, determining the magnetic declination and the true north direction in sequence according to the calibrated geomagnetic sensor and the calibrated gravity sensor.

[0053] In some embodiments, the magnetic declination is determined based on a calibrated geomagnetic sensor, which can be obtained through the following steps: obtaining the calibration value of the geomagnetic sensor at the time when the camera is recording; calculating the projection of the geomagnetic vector in the ground coordinate system through coordinate transformation theory based on the camera attitude angle and the calibration value of the geomagnetic sensor at the time when the camera is recording; and taking the component of the geomagnetic vector projected in the horizontal plane as the magnetic declination, wherein the angle between the geomagnetic vector and the horizontal plane is the magnetic inclination.

[0054] That is, after calibrating the gravity sensor and the geomagnetic sensor, the local magnetic declination can be calculated. Specifically, the geomagnetic sensor is read during video recording and the result is calibrated; then, the calibration value of the geomagnetic sensor is calculated based on the camera attitude angle when the camera is parallel to the ground coordinate system; based on this calibration value, the component of the geomagnetic vector in the horizontal plane and its angle with the horizontal plane are calculated; the component in the horizontal plane is the magnetic declination, and the angle is the magnetic inclination.

[0055] After the magnetic declination is calculated, the true north direction is determined according to the calibrated geomagnetic sensor and the calibrated gravity sensor, which can be achieved through the following steps: according to the geomagnetic sensor reading, the gravity sensor reading, the installation deviation angle of the gravity sensor, and the installation deviation angle of the geomagnetic sensor, the projection of the gravity vector and the geomagnetic vector in the camera coordinate system during video recording is calculated; according to the projection of the gravity vector and the geomagnetic vector in the camera coordinate system and the camera attitude angle, the projection of the gravity vector and the geomagnetic vector in the ground coordinate system is calculated using coordinate transformation theory as the reading of the gravity sensor and the geomagnetic sensor when the camera coordinate system is parallel to the ground coordinate system; according to the installation deviation angle of the gravity sensor, the installation deviation angle of the geomagnetic sensor, and the readings of the gravity sensor and the geomagnetic sensor, the calibration values ​​of the gravity sensor and the geomagnetic sensor are calculated; according to the calibration values ​​of the gravity sensor and the geomagnetic sensor, the camera is rotated to be parallel to the ground coordinate system; when the camera coordinate system is parallel to the ground coordinate system, the direction of the geomagnetic vector is corrected based on the magnetic declination to obtain the true north direction.

[0056] That is, with the magnetic declination, it is easy to determine the true north direction based on the calibrated gravity sensor and geomagnetic sensor. Specifically, the camera coordinate system is rotated to be parallel to the ground coordinate system. In this case, the direction pointed by the geomagnetic sensor is the true north direction after being corrected by the magnetic declination. In order to accurately rotate the camera coordinate system to be parallel to the ground coordinate system, the following method can be used. Figure 3 As shown, subscript g represents the ground coordinate system; subscript c represents the camera coordinate system; subscript m represents the geomagnetic sensor coordinate system. First, read the readings of the gravity sensor and geomagnetic sensor and calibrate them when the camera is recording; then use the coordinate transformation technology to calculate the readings of the two sensors when the camera is parallel to the ground coordinate system based on the camera attitude angle; according to the installation deviation angle, the calibration values ​​of the two are in turn converted into actual readings, which are called marked readings. Based on these two marked readings, the camera can be rotated to be parallel to the ground. Specifically, the feedback values ​​of the gravity sensor and the geomagnetic sensor are observed simultaneously during the process of rotating the camera. When the feedback value is the same as the marked reading, the camera is parallel to the ground coordinate system. In addition, the relationship between the magnetic declination and the installation deviation angle is as shown in Figure 4 shown.

[0057] In summary, the method for determining the magnetic declination and true north direction provided in the embodiment of the present application is to obtain video information by using a camera device to record the sun in a fixed position; to analyze the video information by computer vision to obtain the first direction information of the sun relative to the camera device, and to determine the second direction information of the sun relative to the ground coordinate system by astronomical theory calculation; to determine the camera attitude angle of the camera device relative to the ground coordinate system according to the first direction information of the sun and the second direction information of the sun; to calibrate the gravity sensor and the geomagnetic sensor in turn according to the camera attitude angle to obtain the calibrated gravity sensor and the calibrated geomagnetic sensor; to determine the magnetic declination and true north direction in turn according to the calibrated geomagnetic sensor and the calibrated gravity sensor. Through this application, the problems of low efficiency and high measurement cost in the high-precision determination process of the true north direction and magnetic declination in the related art can be solved. On the one hand, the rotation of the camera posture is realized by using the sensor feedback value, which reduces the error caused by manual alignment; on the other hand, the camera attitude angle is determined by the astronomical position information of the sun using the computer vision method, which improves the recognition accuracy of the camera attitude angle. This effectively ensures the observation accuracy of the true north direction; in addition, the devices used in this invention are mostly common electronic products, and the cost can be effectively controlled. These features can effectively improve the efficiency of determining the magnetic declination and the true north direction and reduce the measurement cost.

[0058] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0059] The embodiment of the present application also provides a device for determining a magnetic declination and a true north direction. It should be noted that the device for determining a magnetic declination and a true north direction in the embodiment of the present application can be used to execute the method for determining a magnetic declination and a true north direction provided in the embodiment of the present application. The device for determining a magnetic declination and a true north direction provided in the embodiment of the present application is introduced below.

[0060] Figure 5 is a schematic diagram of a device 500 for determining a magnetic declination and a true north direction according to an embodiment of the present application. Figure 5 As shown, the device includes: a video recording unit 501, a direction information determination unit 502, an attitude angle determination unit 503, a calibration unit 504, and a magnetic declination and true north determination unit 505.

[0061] Specifically, the video recording unit 501 is used to use a camera device to record the sun in a fixed position to obtain video recording information;

[0062] The direction information determining unit 502 is used to analyze the video information by computer vision to obtain the first direction information of the sun relative to the camera device, and to determine the second direction information of the sun relative to the ground coordinate system by astronomical theory calculation;

[0063] An attitude angle determination unit 503 is used to determine a camera attitude angle of the camera device relative to the ground coordinate system according to the first sun direction information and the second sun direction information;

[0064] The calibration unit 504 is used to calibrate the gravity sensor and the geomagnetic sensor in sequence according to the camera attitude angle to obtain a calibrated gravity sensor and a calibrated geomagnetic sensor;

[0065] The magnetic declination and true north determining unit 505 is used to determine the magnetic declination and true north direction in sequence according to the calibrated geomagnetic sensor and the calibrated gravity sensor.

[0066] In summary, the device for determining the magnetic declination and the true north direction provided in the embodiment of the present application uses a camera device to record the sun in a fixed position through a video recording unit 501 to obtain video information; the direction information determination unit 502 analyzes the video recording information through computer vision to obtain the first direction information of the sun relative to the camera device, and determines the second direction information of the sun relative to the ground coordinate system through astronomical theoretical calculation; the attitude angle determination unit 503 determines the camera attitude angle of the camera device relative to the ground coordinate system according to the first direction information and the second direction information; the calibration unit 504 calibrates the gravity sensor and the geomagnetic sensor in turn according to the camera attitude angle to obtain a calibrated gravity sensor and a calibrated geomagnetic sensor; the magnetic declination and true north determination unit 505 determines the magnetic declination and the true north direction in turn according to the calibrated geomagnetic sensor and the calibrated gravity sensor. On the one hand, the sensor feedback value is used to realize the rotation of the camera posture, thereby reducing the error caused by manual alignment; on the other hand, the computer vision method is used to determine the camera attitude angle through the astronomical orientation information of the sun, thereby improving the recognition accuracy of the camera attitude angle. This effectively ensures the observation accuracy of the true north direction; in addition, the devices used in this invention are mostly common electronic products, and the cost can be effectively controlled. These features can effectively improve the efficiency of determining the magnetic declination and the true north direction and reduce the measurement cost.

[0067] In the device for determining the magnetic declination and the true north direction provided in the embodiment of the present application, the attitude angle determination unit includes: a first matrix determination module, used to set the attitude angle variable and determine the coordinate transformation matrix between the ground coordinate system and the camera coordinate system of the camera device; a direction conversion module, used to convert the first direction information of the sun to the ground coordinate system based on the coordinate transformation matrix at a preset time to obtain the converted direction information; an equation group establishment module, used to establish an equation group containing the attitude angle variable by making the converted direction information equal to the second direction information of the sun; an attitude angle determination module, used to repeat the above steps of establishing an equation group containing the attitude angle variable by making the converted direction information equal to the second direction information of the sun at different times, so that the number of equation groups exceeds the number of attitude angles, and perform a least squares solution calculation on the equation group to obtain the camera attitude angle of the camera device relative to the ground coordinate system.

[0068] In the device for determining the magnetic declination and the true north direction provided in the embodiment of the present application, the direction information determination unit includes: an information processing module, which is used to obtain image information in the video information, and process the video information through computer vision to obtain a sun outline image; a coordinate determination module, which is used to identify the center of the sun according to the sun outline image, and determine the center coordinates of the center of the sun in the pixel coordinate system based on the Hough transform method; the direction information determination module is used to obtain the first direction information of the sun according to the center coordinates and the camera intrinsic parameters using the coordinate transformation theory.

[0069] In the device for determining the magnetic declination and the true north direction provided in the embodiment of the present application, the calibration unit includes: a projection acquisition module, which is used to obtain the projection of gravity in the camera coordinate system during recording through coordinate transformation theory based on the projection of gravity in the ground coordinate system and the camera attitude angle; a second matrix determination module, which is used to determine the coordinate transformation matrix between the gravity sensor body coordinate system and the camera coordinate system based on the gravity sensor reading during recording and the projection of gravity in the camera coordinate system; a deviation angle determination module, which is used to reversely obtain the rotation angle between the body coordinate system and the camera coordinate system based on the coordinate transformation matrix and the coordinate transformation theory to obtain the installation deviation angle of the gravity sensor; a sensor calibration module, which is used to project the gravity sensor reading at any time into the camera coordinate system according to the installation deviation angle to obtain the calibrated gravity sensor reading as the calibration value of the gravity sensor.

[0070] In the device for determining the magnetic declination and the true north direction provided in the embodiment of the present application, the calibration unit includes: a first reading recording module, which is used to record the gravity sensor reading and the geomagnetic sensor reading of the camera when recording; a second reading recording module, which is used to rotate the camera to a preset posture angle arbitrarily, and record the readings of the gravity sensor and the geomagnetic sensor again, wherein the gravity vector is not parallel or perpendicular to the camera coordinate axis at the preset posture angle; a first projection determination module, which is used to determine the coordinate transformation matrix of the camera coordinate system during the rotation process according to the calibration value of the gravity sensor during recording and at the preset posture angle; obtain the projection of the rotation vector representing the rotation process in the camera coordinate system according to the Rodriguez formula as the first projection of the rotation vector; and a second projection determination module, which is used to determine the coordinate transformation matrix of the camera coordinate system during the rotation process according to the calibration value of the gravity sensor during recording and at the preset posture angle. The reading of the geomagnetic sensor is used to determine the coordinate transformation matrix of the geomagnetic sensor body coordinate system during the rotation process; the projection of the rotation vector representing the rotation process in the geomagnetic sensor body coordinate system is obtained according to the Rodriguez formula, which is called the second projection of the rotation vector; the third matrix determination module is used to determine the coordinate transformation matrix between the geomagnetic sensor body coordinate system and the camera coordinate system according to the first projection and the second projection using the coordinate transformation theory; the deviation angle determination module is used to determine the rotation angle of the geomagnetic sensor body coordinate system relative to the camera coordinate system according to the coordinate transformation matrix using the coordinate transformation theory as the installation deviation angle of the geomagnetic sensor; the sensor calibration module is used to project the geomagnetic sensor reading at any time into the camera coordinate system according to the installation deviation angle to obtain the calibrated gravity sensor reading as the calibration value of the gravity sensor.

[0071] In the device for determining the magnetic declination and true north direction provided in an embodiment of the present application, the magnetic declination and true north determination unit includes: a sensor calibration acquisition module, used to obtain the calibration value of the geomagnetic sensor at the time of camera recording; a first vector projection module, used to calculate the geomagnetic vector projection of the geomagnetic vector in the ground coordinate system through coordinate transformation theory according to the camera attitude angle and the calibration value of the geomagnetic sensor at the time of camera recording; a magnetic declination determination module, used to take the component of the geomagnetic vector projected in the horizontal plane as the magnetic declination, wherein the angle between the geomagnetic vector and the horizontal plane is the magnetic inclination.

[0072] In the device for determining the magnetic declination and true north direction provided in the embodiment of the present application, the magnetic declination and true north determination unit includes: a second vector projection module, which is used to calculate the projection of the gravity vector and the geomagnetic vector in the camera coordinate system during video recording according to the geomagnetic sensor reading, the gravity sensor reading, the installation deviation angle of the gravity sensor, and the installation deviation angle of the geomagnetic sensor; a calibration value determination module, which is used to calculate the projection of the gravity vector and the geomagnetic vector in the ground coordinate system according to the projection of the gravity vector and the geomagnetic vector in the camera coordinate system and the camera attitude angle, using the coordinate transformation theory, as the reading of the gravity sensor and the geomagnetic sensor when the camera coordinate system is parallel to the ground coordinate system; a sensor reading calculation module, which is used to calculate the calibration values ​​of the gravity sensor and the geomagnetic sensor according to the installation deviation angle of the gravity sensor, the installation deviation angle of the geomagnetic sensor, and the readings of the gravity sensor and the geomagnetic sensor; a rotation module, which is used to rotate the camera to be parallel to the ground coordinate system according to the calibration values ​​of the gravity sensor and the geomagnetic sensor; and a correction module, which is used to correct the direction of the geomagnetic vector based on the magnetic declination to obtain the true north direction when the camera coordinate system is parallel to the ground coordinate system.

[0073] The device for determining the magnetic declination and true north direction comprises a processor and a memory, and the video recording unit 501, the direction information determining unit 502, the attitude angle determining unit 503, the calibration unit 504, the magnetic declination and true north determining unit 505, etc. are all stored in the memory as program units, and the processor executes the program units stored in the memory to realize the corresponding functions.

[0074] The processor includes a kernel, which calls the corresponding program unit from the memory. One or more kernels can be set, and the magnetic declination and true north direction can be determined by adjusting kernel parameters.

[0075] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0076] In the exemplary embodiment of the present application, a computer storage medium capable of implementing the above method is also provided. A program product capable of implementing the above method of the present specification is stored thereon. In some possible embodiments, various aspects of the present application can also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps described in the "Exemplary Method" section of the present specification according to various exemplary embodiments of the present application, such as the following steps: using a camera device to record the sun in a fixed position to obtain video information; analyzing the video information by computer vision to obtain the first direction information of the sun relative to the camera device, and determining the second direction information of the sun relative to the ground coordinate system by astronomical theoretical calculation; determining the camera attitude angle of the camera device relative to the ground coordinate system according to the first direction information of the sun and the second direction information of the sun; calibrating the gravity sensor and the geomagnetic sensor in turn according to the camera attitude angle to obtain a calibrated gravity sensor and a calibrated geomagnetic sensor; determining the magnetic declination and the true north direction in turn according to the calibrated geomagnetic sensor and the calibrated gravity sensor.

[0077] In an optional embodiment, the camera attitude angle of the camera device relative to the ground coordinate system is determined according to the first direction information of the sun and the second direction information of the sun, including: setting the attitude angle variable, and determining the coordinate transformation matrix between the ground coordinate system and the camera coordinate system of the camera device; at a preset time, converting the first direction information of the sun to the ground coordinate system based on the coordinate transformation matrix to obtain the converted direction information; establishing a group of equations containing the attitude angle variables by making the converted direction information equal to the second direction information of the sun; repeating the above steps of establishing a group of equations containing the attitude angle variables by making the converted direction information equal to the second direction information of the sun at different times, so that the number of equation groups exceeds the number of attitude angles, and performing a least squares solution calculation on the group of equations to obtain the camera attitude angle of the camera device relative to the ground coordinate system.

[0078] In an optional implementation, the video information is analyzed by computer vision to obtain the sun's first direction information relative to the camera device, including: acquiring image information in the video information, processing the video information by computer vision to obtain a sun outline image; identifying the sun's center according to the sun outline image, and determining the center coordinates of the sun's center in the pixel coordinate system based on the Hough transform method; and obtaining the sun's first direction information using coordinate transformation theory based on the center coordinates and the camera's intrinsic parameters.

[0079] In an optional implementation, the gravity sensor is calibrated according to the camera attitude angle to obtain a calibrated gravity sensor, including: obtaining the projection of gravity in the camera coordinate system during video recording through coordinate transformation theory according to the projection of gravity in the ground coordinate system and the camera attitude angle; determining the coordinate transformation matrix between the gravity sensor body coordinate system and the camera coordinate system according to the gravity sensor reading during video recording and the projection of gravity in the camera coordinate system; according to the coordinate transformation matrix, using the coordinate transformation theory to reversely calculate the rotation angle between the body coordinate system and the camera coordinate system to obtain the installation deviation angle of the gravity sensor; and projecting the gravity sensor reading at any time into the camera coordinate system according to the installation deviation angle to obtain the calibrated gravity sensor reading as the calibration value of the gravity sensor.

[0080] In an optional embodiment, the geomagnetic sensor is calibrated according to the camera attitude angle to obtain a calibrated geomagnetic sensor, including: recording the gravity sensor reading and the geomagnetic sensor reading of the camera when recording; arbitrarily rotating the camera to a preset attitude angle, and recording the gravity sensor and geomagnetic sensor readings again, wherein the gravity vector is not parallel or perpendicular to the camera coordinate axis at the preset attitude angle; determining the coordinate transformation matrix of the camera coordinate system during the rotation process according to the calibration value of the gravity sensor at the preset attitude angle during recording; obtaining the projection of the rotation vector representing the rotation process in the camera coordinate system according to the Rodriguez formula as the first projection of the rotation vector; and obtaining the first projection of the rotation vector according to the calibration value of the gravity sensor at the preset attitude angle during recording. The reading of the magnetic sensor is used to determine the coordinate transformation matrix of the geomagnetic sensor body coordinate system during the rotation process; the projection of the rotation vector representing the rotation process in the geomagnetic sensor body coordinate system is obtained according to the Rodriguez formula, which is called the second projection of the rotation vector; based on the first projection and the second projection, the coordinate transformation theory is used to determine the coordinate transformation matrix between the geomagnetic sensor body coordinate system and the camera coordinate system; based on the coordinate transformation matrix, the coordinate transformation theory is used to determine the rotation angle of the geomagnetic sensor body coordinate system relative to the camera coordinate system as the installation deviation angle of the geomagnetic sensor; based on the installation deviation angle, the geomagnetic sensor reading at any time is projected into the camera coordinate system to obtain the calibrated gravity sensor reading as the calibration value of the gravity sensor.

[0081] In an optional embodiment, the magnetic declination is determined based on a calibrated geomagnetic sensor, including: obtaining the calibration value of the geomagnetic sensor at the time of camera recording; calculating the projection of the geomagnetic vector in the ground coordinate system through coordinate transformation theory based on the camera attitude angle and the calibration value of the geomagnetic sensor at the time of camera recording; and taking the component of the geomagnetic vector projected in the horizontal plane as the magnetic declination, wherein the angle between the geomagnetic vector and the horizontal plane is the magnetic inclination.

[0082] In an optional embodiment, the true north direction is determined according to a calibrated geomagnetic sensor and a calibrated gravity sensor, including: calculating the projection of the gravity vector and the geomagnetic vector in the camera coordinate system during video recording according to the geomagnetic sensor reading, the gravity sensor reading, the installation deviation angle of the gravity sensor, and the installation deviation angle of the geomagnetic sensor; calculating the projection of the gravity vector and the geomagnetic vector in the ground coordinate system according to the projection of the gravity vector and the geomagnetic vector in the camera coordinate system and the camera attitude angle using coordinate transformation theory as the readings of the gravity sensor and the geomagnetic sensor when the camera coordinate system is parallel to the ground coordinate system; calculating the calibration values ​​of the gravity sensor and the geomagnetic sensor according to the installation deviation angle of the gravity sensor, the installation deviation angle of the geomagnetic sensor, and the readings of the gravity sensor and the geomagnetic sensor; rotating the camera to be parallel to the ground coordinate system according to the calibration values ​​of the gravity sensor and the geomagnetic sensor; when the camera coordinate system is parallel to the ground coordinate system, correcting the direction of the geomagnetic vector based on the magnetic declination to obtain the true north direction.

[0083] In an optional embodiment, the embodiment of the present application may also include a program product for implementing the above method, which may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present application is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.

[0084] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0085] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0086] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0087] Program code for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).

[0088] In addition, in an exemplary embodiment of the present application, an electronic device capable of implementing the above method is also provided.

[0089] Those skilled in the art will appreciate that various aspects of the present application may be implemented as a system, method or program product. Therefore, various aspects of the present application may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to as "circuit", "module" or "system" herein.

[0090] Refer to the following Figure 6 The electronic device 600 according to this embodiment of the present application is described. Figure 6 The electronic device 600 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0091] like Figure 6 As shown, the electronic device 600 is in the form of a general computing device. The components of the electronic device 600 may include, but are not limited to: the at least one processing unit 610, the at least one storage unit 620, a bus 630 connecting different system components (including the storage unit 620 and the processing unit 610), and a display unit 640.

[0092] Among them, the storage unit stores program codes, and the program codes can be executed by the processing unit 610, so that the processing unit 610 executes the steps according to various exemplary embodiments of the present application described in the above "Exemplary Method" section of this specification. For example, the processing unit 610 can execute the following steps: use a camera device to record the sun in a fixed position to obtain video information; analyze the video information by computer vision to obtain the first direction information of the sun relative to the camera device, and determine the second direction information of the sun relative to the ground coordinate system by astronomical theory calculation; determine the camera attitude angle of the camera device relative to the ground coordinate system based on the first direction information and the second direction information; calibrate the gravity sensor and the geomagnetic sensor in turn according to the camera attitude angle to obtain a calibrated gravity sensor and a calibrated geomagnetic sensor; determine the magnetic declination and the true north direction in turn according to the calibrated geomagnetic sensor and the calibrated gravity sensor.

[0093] In an optional embodiment, the camera attitude angle of the camera device relative to the ground coordinate system is determined according to the first direction information of the sun and the second direction information of the sun, including: setting the attitude angle variable, and determining the coordinate transformation matrix between the ground coordinate system and the camera coordinate system of the camera device; at a preset time, converting the first direction information of the sun to the ground coordinate system based on the coordinate transformation matrix to obtain the converted direction information; establishing a group of equations containing the attitude angle variables by making the converted direction information equal to the second direction information of the sun; repeating the above steps of establishing a group of equations containing the attitude angle variables by making the converted direction information equal to the second direction information of the sun at different times, so that the number of equation groups exceeds the number of attitude angles, and performing a least squares solution calculation on the group of equations to obtain the camera attitude angle of the camera device relative to the ground coordinate system.

[0094] In an optional implementation, the video information is analyzed by computer vision to obtain the sun's first direction information relative to the camera device, including: acquiring image information in the video information, processing the video information by computer vision to obtain a sun outline image; identifying the sun's center according to the sun outline image, and determining the center coordinates of the sun's center in the pixel coordinate system based on the Hough transform method; and obtaining the sun's first direction information using coordinate transformation theory based on the center coordinates and the camera's intrinsic parameters.

[0095] In an optional implementation, the gravity sensor is calibrated according to the camera attitude angle to obtain a calibrated gravity sensor, including: obtaining the projection of gravity in the camera coordinate system during video recording through coordinate transformation theory according to the projection of gravity in the ground coordinate system and the camera attitude angle; determining the coordinate transformation matrix between the gravity sensor body coordinate system and the camera coordinate system according to the gravity sensor reading during video recording and the projection of gravity in the camera coordinate system; according to the coordinate transformation matrix, using the coordinate transformation theory to reversely calculate the rotation angle between the body coordinate system and the camera coordinate system to obtain the installation deviation angle of the gravity sensor; and projecting the gravity sensor reading at any time into the camera coordinate system according to the installation deviation angle to obtain the calibrated gravity sensor reading as the calibration value of the gravity sensor.

[0096] In an optional embodiment, the geomagnetic sensor is calibrated according to the camera attitude angle to obtain a calibrated geomagnetic sensor, including: recording the gravity sensor reading and the geomagnetic sensor reading of the camera when recording; arbitrarily rotating the camera to a preset attitude angle, and recording the gravity sensor and geomagnetic sensor readings again, wherein the gravity vector is not parallel or perpendicular to the camera coordinate axis at the preset attitude angle; determining the coordinate transformation matrix of the camera coordinate system during the rotation process according to the calibration value of the gravity sensor at the preset attitude angle during recording; obtaining the projection of the rotation vector representing the rotation process in the camera coordinate system according to the Rodriguez formula as the first projection of the rotation vector; and obtaining the first projection of the rotation vector according to the calibration value of the gravity sensor at the preset attitude angle during recording. The reading of the magnetic sensor is used to determine the coordinate transformation matrix of the geomagnetic sensor body coordinate system during the rotation process; the projection of the rotation vector representing the rotation process in the geomagnetic sensor body coordinate system is obtained according to the Rodriguez formula, which is called the second projection of the rotation vector; based on the first projection and the second projection, the coordinate transformation theory is used to determine the coordinate transformation matrix between the geomagnetic sensor body coordinate system and the camera coordinate system; based on the coordinate transformation matrix, the coordinate transformation theory is used to determine the rotation angle of the geomagnetic sensor body coordinate system relative to the camera coordinate system as the installation deviation angle of the geomagnetic sensor; based on the installation deviation angle, the geomagnetic sensor reading at any time is projected into the camera coordinate system to obtain the calibrated gravity sensor reading as the calibration value of the gravity sensor.

[0097] In an optional embodiment, the magnetic declination is determined based on a calibrated geomagnetic sensor, including: obtaining the calibration value of the geomagnetic sensor at the time of camera recording; calculating the projection of the geomagnetic vector in the ground coordinate system through coordinate transformation theory based on the camera attitude angle and the calibration value of the geomagnetic sensor at the time of camera recording; and taking the component of the geomagnetic vector projected in the horizontal plane as the magnetic declination, wherein the angle between the geomagnetic vector and the horizontal plane is the magnetic inclination.

[0098] In an optional embodiment, the true north direction is determined according to a calibrated geomagnetic sensor and a calibrated gravity sensor, including: calculating the projection of the gravity vector and the geomagnetic vector in the camera coordinate system during video recording according to the geomagnetic sensor reading, the gravity sensor reading, the installation deviation angle of the gravity sensor, and the installation deviation angle of the geomagnetic sensor; calculating the projection of the gravity vector and the geomagnetic vector in the ground coordinate system according to the projection of the gravity vector and the geomagnetic vector in the camera coordinate system and the camera attitude angle using coordinate transformation theory as the readings of the gravity sensor and the geomagnetic sensor when the camera coordinate system is parallel to the ground coordinate system; calculating the calibration values ​​of the gravity sensor and the geomagnetic sensor according to the installation deviation angle of the gravity sensor, the installation deviation angle of the geomagnetic sensor, and the readings of the gravity sensor and the geomagnetic sensor; rotating the camera to be parallel to the ground coordinate system according to the calibration values ​​of the gravity sensor and the geomagnetic sensor; when the camera coordinate system is parallel to the ground coordinate system, correcting the direction of the geomagnetic vector based on the magnetic declination to obtain the true north direction.

[0099] The storage unit 620 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 6201 and / or a cache memory unit 6202 , and may further include a read-only memory unit (ROM) 6203 .

[0100] The storage unit 620 may also include a program / utility 6204 having a set (at least one) of program modules 6205, such program modules 6205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0101] Bus 630 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0102] The electronic device 600 may also communicate with one or more external devices 700 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 600, and / or communicate with any device that enables the electronic device 600 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 650. Furthermore, the electronic device 600 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 660. As shown, the network adapter 660 communicates with other modules of the electronic device 600 via a bus 630. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 600, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.

[0103] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the implementation methods of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation methods of the present application.

[0104] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present application, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0105] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application. The specification and embodiments are to be regarded as exemplary only, and the true scope and spirit of the present application are indicated by the claims.

Claims

1. A method for determining magnetic declination and true north direction, characterized in that: include: Use a camera device to record the sun in a fixed position to obtain video information; Analyzing the video information by computer vision to obtain first direction information of the sun relative to the camera device, and determining second direction information of the sun relative to the ground coordinate system by astronomical theory calculation; Determine a camera attitude angle of the camera device relative to the ground coordinate system according to the first sun direction information and the second sun direction information; Calibrate the gravity sensor and the geomagnetic sensor in sequence according to the camera attitude angle to obtain a calibrated gravity sensor and a calibrated geomagnetic sensor; The magnetic declination and the true north direction are determined in sequence according to the calibrated geomagnetic sensor and the calibrated gravity sensor.

2. The method according to claim 1, characterized in that Determining a camera attitude angle of the camera device relative to the ground coordinate system according to the first sun direction information and the second sun direction information includes: Setting an attitude angle variable and determining a coordinate transformation matrix between the ground coordinate system and the camera coordinate system of the camera device; At a preset time, converting the first direction information of the sun into the ground coordinate system based on the coordinate transformation matrix to obtain converted direction information; The converted direction information is equal to the second direction information of the sun to establish an equation group including the attitude angle variable; Repeat the above steps of establishing a set of equations containing the attitude angle variables by making the converted direction information equal to the second direction information of the sun at different times, so that the number of the set of equations exceeds the number of attitude angles, and perform least square solution calculation on the set of equations to obtain the camera attitude angle of the camera device relative to the ground coordinate system.

3. The method according to claim 1, characterized in that The video information is analyzed by computer vision to obtain first direction information of the sun relative to the camera device, including: Acquire image information in the video information, and process the video information by computer vision to obtain a sun profile image; Identify the center of the sun according to the sun outline image, and determine the center coordinates of the center of the sun in a pixel coordinate system based on a Hough transform method; The first direction information of the sun is obtained according to the center coordinates and the camera internal parameters using coordinate transformation theory.

4. The method according to claim 1, characterized in that Calibrating the gravity sensor according to the camera attitude angle to obtain a calibrated gravity sensor includes: According to the projection of gravity in the ground coordinate system and the camera attitude angle, the projection of gravity in the camera coordinate system during video recording is obtained through coordinate transformation theory; Determine a coordinate transformation matrix between a gravity sensor body coordinate system and the camera coordinate system according to a gravity sensor reading during video recording and a projection of the gravity in the camera coordinate system; According to the coordinate transformation matrix, the rotation angle between the body coordinate system and the camera coordinate system is reversely calculated using the coordinate transformation theory to obtain the installation deviation angle of the gravity sensor; The gravity sensor reading at any time is projected into the camera coordinate system according to the installation deviation angle to obtain the calibrated gravity sensor reading as the calibration value of the gravity sensor.

5. The method according to claim 4, characterized in that The geomagnetic sensor is calibrated according to the camera attitude angle to obtain a calibrated geomagnetic sensor, including: Record the gravity sensor readings and geomagnetic sensor readings of the camera while recording; Rotate the camera to a preset attitude angle at random, and record the readings of the gravity sensor and the geomagnetic sensor again, wherein the gravity vector is not parallel or perpendicular to the camera coordinate axis at the preset attitude angle; Determine the coordinate transformation matrix of the camera coordinate system during the rotation process according to the calibration value of the gravity sensor during the video recording and at the preset posture angle; obtain the projection of the rotation vector representing the rotation process in the camera coordinate system according to the Rodriguez formula as the first projection of the rotation vector; According to the readings of the geomagnetic sensor during the video recording and at the preset posture angle, the coordinate transformation matrix of the geomagnetic sensor body coordinate system during the rotation process is determined; according to the Rodriguez formula, the projection of the rotation vector representing the rotation process in the geomagnetic sensor body coordinate system is obtained, which is called the second projection of the rotation vector; Determine a coordinate transformation matrix between a geomagnetic sensor body coordinate system and a camera coordinate system using coordinate transformation theory according to the first projection and the second projection; According to the coordinate transformation matrix, the rotation angle of the geomagnetic sensor body coordinate system relative to the camera coordinate system is determined by using coordinate transformation theory as the installation deviation angle of the geomagnetic sensor; The geomagnetic sensor reading at any time is projected into the camera coordinate system according to the installation deviation angle to obtain the calibrated geomagnetic sensor reading, which is the calibration value of the geomagnetic sensor.

6. The method according to claim 5, characterized in that Determining the magnetic declination according to the calibrated geomagnetic sensor includes: Get the calibration value of the geomagnetic sensor when the camera is recording; According to the camera attitude angle and the calibration value of the geomagnetic sensor at the time of recording the camera, the projection of the geomagnetic vector in the ground coordinate system is calculated by coordinate transformation theory; The component of the geomagnetic vector projected on the horizontal plane is taken as the magnetic declination, wherein the angle between the geomagnetic vector and the horizontal plane is the magnetic inclination.

7. The method according to claim 6, characterized in that Determining the true north direction according to the calibrated geomagnetic sensor and the calibrated gravity sensor includes: Calculate the projection of the gravity vector and the geomagnetic vector in the camera coordinate system during video recording according to the geomagnetic sensor reading, the gravity sensor reading, the installation deviation angle of the gravity sensor, and the installation deviation angle of the geomagnetic sensor; According to the projections of the gravity vector and the geomagnetic vector in the camera coordinate system and the camera attitude angle, the projections of the gravity vector and the geomagnetic vector in the ground coordinate system are calculated using coordinate transformation theory as readings of the gravity sensor and the geomagnetic sensor when the camera coordinate system is parallel to the ground coordinate system; Calculating calibration values ​​of the gravity sensor and the geomagnetic sensor according to the installation deviation angle of the gravity sensor, the installation deviation angle of the geomagnetic sensor, and the readings of the gravity sensor and the geomagnetic sensor; Rotating the camera to be parallel to the ground coordinate system according to the calibration values ​​of the gravity sensor and the geomagnetic sensor; When the camera coordinate system is parallel to the ground coordinate system, the direction of the geomagnetic vector is corrected based on the magnetic declination to obtain the true north direction.

8. A device for determining magnetic declination and true north direction, characterized in that: include: A video recording unit, used to use a camera device to record the sun in a fixed position to obtain video information; a direction information determination unit, configured to analyze the video information by computer vision to obtain first direction information of the sun relative to the camera device, and to determine second direction information of the sun relative to a ground coordinate system by astronomical theory calculation; an attitude angle determining unit, configured to determine a camera attitude angle of the camera device relative to the ground coordinate system according to the first sun direction information and the second sun direction information; A calibration unit, used to calibrate the gravity sensor and the geomagnetic sensor in sequence according to the camera attitude angle to obtain a calibrated gravity sensor and a calibrated geomagnetic sensor; The magnetic declination and true north determining unit is used to determine the magnetic declination and true north direction in sequence according to the calibrated geomagnetic sensor and the calibrated gravity sensor.

9. A computer-readable storage medium, characterized in that: The storage medium includes a stored program, wherein the program executes the method for determining the magnetic declination and the true north direction as described in any one of claims 1 to 7.

10. An electronic device, characterized in that: include: One or more processors, a memory, a display device, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include a method for determining the magnetic declination and true north direction as described in any one of claims 1 to 7.