An indoor geomagnetic positioning method based on spatial registration and dynamic time warping

By constructing a geomagnetic fingerprint database and performing spatial registration based on prior information of the geometric structure of indoor channels and dynamic time warping, the problems of low fingerprint database construction efficiency and error accumulation in existing indoor geomagnetic positioning technologies are solved, and high-precision indoor positioning is achieved.

CN123045332APending Publication Date: 2026-11-06SHANDONG UNIV OF SCI & TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611569297.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-12
Publication Date
2026-11-06

AI Technical Summary

Technical Problem

Existing indoor geomagnetic positioning technologies suffer from low fingerprint database construction efficiency and the accumulation of errors in pedestrian trajectory estimation, resulting in insufficient positioning accuracy. Furthermore, the matching methods involve large computational loads and are prone to mismatches.

Method used

By acquiring prior information about the geometric structure of indoor passageways and collecting data in segments, combined with spatial registration and dynamic time warping, a geomagnetic fingerprint database is constructed and matched, including segmented pedestrian trajectory estimation, geomagnetic fingerprint point fusion, contour line extraction, and iterative registration of the nearest contour line point.

Benefits of technology

It improves the accuracy and spatial uniformity of geomagnetic fingerprint point coordinates, reduces fingerprint database maintenance costs, enhances the robustness of geomagnetic sequence matching and indoor positioning accuracy, and reduces the probability of false matches.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123045332A_ABST
    Figure CN123045332A_ABST
Patent Text Reader

Abstract

The present application relates to the field of indoor positioning and navigation, in particular to an indoor geomagnetic positioning method based on space registration and dynamic time warping, comprising obtaining the geometric structure prior information of indoor passageway, segmenting the collection path, and synchronously collecting acceleration data and magnetic field data; generating geomagnetic fingerprint points according to the segmented pedestrian dead reckoning results, and fusing the geomagnetic fingerprint points through space index, constructing the geomagnetic reference map based on the geomagnetic fingerprint database, extracting the geomagnetic contour lines, combining the real-time short-term pedestrian dead reckoning results to determine the candidate search area and candidate point set; iteratively registering the real-time pedestrian dead reckoning trajectory with the nearest contour line point space, dynamically time warping matching the real-time geomagnetic observation sequence, and generating the continuous positioning trajectory according to the matching results. The present application can reduce the dead reckoning error accumulation, narrow the candidate matching range, improve the geomagnetic fingerprint database construction efficiency and indoor continuous positioning accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of indoor positioning and navigation technology, and in particular to an indoor geomagnetic positioning method based on spatial registration and dynamic time warping. Background Technology

[0002] Global Navigation Satellite Systems (GNSS) can provide relatively accurate location services in outdoor environments. However, in indoor environments, underground parking lots, tunnels, and mines, where conditions are often obstructed, satellite signals are susceptible to building blockages and multipath effects, making continuous and reliable positioning difficult. Existing indoor positioning technologies mainly include WiFi positioning, Bluetooth positioning, ultra-wideband (UWB) positioning, inertial navigation positioning, and visual positioning. Among these, WiFi and Bluetooth positioning are easily affected by multipath effects and human presence, UWB positioning requires dedicated base stations, and visual positioning is highly sensitive to lighting conditions and computationally intensive. Geomagnetic positioning utilizes the stable local magnetic field distortions formed by ferromagnetic materials such as steel bars, metal pipes, and electrical equipment within buildings for location estimation. It offers advantages such as requiring no additional infrastructure, low power consumption, and stable signal, making it an important development direction for indoor positioning technology.

[0003] However, existing indoor geomagnetic positioning technologies still suffer from problems such as low fingerprint database construction efficiency, maintenance difficulties, and insufficient matching and positioning accuracy. Traditional manual point-by-point collection methods require the pre-deployment of a large number of reference points, resulting in high collection and maintenance costs. When collecting data using continuous pedestrian trajectory estimation, the heading estimation error accumulates with the walking distance and propagates to the preceding and subsequent paths, leading to trajectory distortion and uneven spatial distribution of fingerprint points. In addition, in terms of matching and positioning, geomagnetic contour matching methods usually only consider translational errors and are difficult to correct for rotational errors caused by heading deviations. Although dynamic time warping methods can handle sequence misalignment problems, they lack spatial constraints, have a large computational load when searching over a large area, and are prone to mismatches. Finally, the iterative nearest contour point method is sensitive to initial trajectory errors and suffers from problems such as low nearest point search efficiency and a single convergence criterion. At present, an indoor geomagnetic positioning method based on spatial registration and dynamic time warping is needed. Summary of the Invention

[0004] To address the technical problems of low fingerprint database construction efficiency and easy accumulation of pedestrian trajectory estimation errors in existing indoor geomagnetic positioning technologies, which lead to insufficient positioning accuracy, this invention provides an indoor geomagnetic positioning method based on spatial registration and dynamic time warping.

[0005] This invention provides an indoor geomagnetic positioning method based on spatial registration and dynamic time warping, employing the following technical solution: An indoor geomagnetic positioning method based on spatial registration and dynamic time warping includes: Obtain prior information on the geometric structure of the target indoor passage, segment the acquisition path, and synchronously acquire acceleration and magnetic field data with a unified timestamp along the segmented acquisition path; Based on the acquired prior information on geometric structure and acceleration data, segmented pedestrian trajectories are calculated, and the calculated trajectory points are matched with the corresponding magnetic field data to generate geomagnetic fingerprint points. A spatial index is constructed using geomagnetic fingerprint points. Geomagnetic fingerprint points that meet the spatial proximity condition are merged, and geomagnetic fingerprint points that do not meet the spatial proximity condition are inserted to obtain a geomagnetic fingerprint database. Based on the geomagnetic fingerprint database, a geomagnetic benchmark map is constructed and geomagnetic contour lines are extracted. Candidate search areas are determined by combining real-time short-term pedestrian trajectory estimation results, and a set of candidate points is generated within the candidate search areas. Based on the candidate point set, the trajectory of the real-time pedestrian track is iteratively registered with the nearest contour points to obtain the corrected trajectory and candidate matching sequence. Based on the corrected trajectory and candidate matching sequence, dynamic time warping matching is performed on the real-time geomagnetic observation sequence, and continuous positioning trajectory is generated according to the matching result.

[0006] Furthermore, the acquisition of acceleration and magnetic field data with a unified timestamp includes obtaining the planar topology of the target indoor passage, the length of each segment, the corner position, and the direction of travel of each segment as prior geometric information. Based on the prior geometric information, the acquisition path is divided into several interconnected straight line segments at the corner position, and adjacent straight line segments are spatially connected through known corner coordinates. Before collecting data along each straight line segment, the acquisition device is calibrated to a static attitude. After calibration, the three-axis acceleration data, three-axis angular velocity data, and three-axis magnetic field data with a unified timestamp are collected synchronously along the corresponding straight line segment at a fixed sampling frequency. The total magnetic field strength is calculated based on the three-axis magnetic field data corresponding to each sampling time.

[0007] Furthermore, the process of matching the calculated trajectory points with the corresponding magnetic field data includes calculating the composite amplitude of the acceleration data, and sequentially performing bandpass filtering and peak detection on the composite amplitude to obtain the effective number of steps within the corresponding segment. The single-segment distance scaling factor is determined based on the effective number of steps, the preset fixed step length, and the known length of the corresponding segment. Using the single-segment distance scaling factor, the starting coordinates of the corresponding segment, and the travel direction angle, the coordinates of each gait point are assigned to obtain the trajectory points for the segmented pedestrian trajectory calculation. The total magnetic field strength is obtained based on the gait time corresponding to each trajectory point, and a geomagnetic fingerprint point is generated, which includes the horizontal coordinate, vertical coordinate, cumulative walking distance, total magnetic field strength, and initial weight. The coordinate expression of the trajectory point is as follows: , in, , Let x and y be the x and y coordinates of the kth trajectory point, respectively. , These are the x and y coordinates of the starting point of the corresponding segment, respectively. Where is the known length of the corresponding segment, and N is the number of valid steps detected within the corresponding segment. This represents the travel direction angle for the corresponding segment.

[0008] Furthermore, obtaining the geomagnetic fingerprint database includes constructing a k-dimensional tree spatial index using the two-dimensional spatial coordinates of existing geomagnetic fingerprint points. For newly added geomagnetic fingerprint points, the k-dimensional tree spatial index is used to retrieve the existing geomagnetic fingerprint point with the closest spatial distance to it. When the spatial distance between the newly added geomagnetic fingerprint point and the existing geomagnetic fingerprint point is less than the preset fusion distance threshold, the magnetic field strength, spatial coordinates and weights are fused according to the cumulative sampling weight; When the spatial distance is greater than or equal to the preset fusion distance threshold, the newly added geomagnetic fingerprint point is inserted into the geomagnetic fingerprint database, and the k-dimensional tree spatial index is updated. The fusion result satisfies the formula: , , in, The magnetic field strength after fusion. The weights of existing geomagnetic fingerprint points, To add weights to the geomagnetic fingerprint points, To determine the magnetic field strength of the newly added geomagnetic fingerprint points, The magnetic field strength of existing geomagnetic fingerprint points, The weights are the weights after merging.

[0009] Furthermore, the step of determining the candidate search area by combining the real-time short-term pedestrian trajectory estimation results includes mapping discrete geomagnetic fingerprint points in the geomagnetic fingerprint database to a preset grid, and interpolating the magnetic field values ​​of each grid node in the preset grid to construct a continuous geomagnetic reference map. Based on real-time magnetic field observations, corresponding geomagnetic contour lines are extracted from continuous geomagnetic reference maps. Short-term pedestrian trajectory is calculated using real-time collected acceleration and angular velocity data to obtain the predicted location at the current positioning time. Candidate search areas are determined with the predicted location as the center and a preset search radius, and repeated geomagnetic feature areas that deviate from the predicted location on the geomagnetic contour lines are excluded.

[0010] Furthermore, generating a candidate point set within the candidate search area includes using a spatial index to search for the nearest isoline point between the corresponding geomagnetic isoline and the candidate search area; calculating the candidate review value based on geomagnetic feature differences, pedestrian trajectory distance constraints, time continuity constraints, and direction consistency constraints; and selecting several candidate points whose review values ​​meet preset screening conditions to generate a candidate point set. The expression for the candidate review value is: , in, The candidate review value of candidate point s. , , and These are the weighting coefficients for differences in geomagnetic characteristics, distance to the predicted location, temporal continuity, and directional consistency, respectively. The geomagnetic value corresponding to the candidate point. The geomagnetic value is obtained through real-time measurement. The location of the candidate point. For PDR predicted location, The current candidate point position. This represents the position of the matched point from the previous moment. The trajectory direction angle corresponding to the candidate point. For PDR heading angle, The distance is Euclidean.

[0011] Further, obtaining the corrected trajectory and candidate matching sequence includes determining the real-time pedestrian trajectory as the current trajectory, searching for the nearest contour points corresponding to each trajectory point in the current trajectory in the candidate point set to form a set of nearest contour points; with the goal of minimizing the sum of squared distance errors between the trajectory points after rigid body transformation and the corresponding nearest contour points, solving the rotation matrix and translation vector, and updating the current trajectory using the rotation matrix and translation vector until a preset convergence condition is met or a preset maximum number of iterations is reached, determining the final trajectory as the corrected trajectory, and associating the corrected trajectory and the corresponding nearest contour points in chronological order to generate a candidate matching sequence.

[0012] Furthermore, the preset convergence condition includes calculating the trajectory point after the k-th iteration relative to the k-th iteration. The position residual of the trajectory point after the first iteration is calculated, and the geomagnetic residual between the magnetic field value of the trajectory point in the geomagnetic reference map and the corresponding real-time magnetic field observation value after the k-th iteration is calculated, as well as the trajectory smoothness of the distance between adjacent trajectory points in the trajectory. When the location residual is less than the location residual threshold, the geomagnetic residual is less than the geomagnetic residual threshold, and the trajectory smoothness is less than the trajectory smoothness threshold, the spatial registration of the nearest contour points is determined to be converged. The preset convergence condition satisfies the following formula: , in, Let i be the trajectory point after the k-th iteration. For the kth The i-th trajectory point after 1 iteration, Let be the magnetic field value of the i-th trajectory point in the geomagnetic reference map after the k-th iteration. For the i-th real-time magnetic field observation, The position residual threshold, The threshold value for geomagnetic residuals. This is the trajectory smoothness threshold.

[0013] Furthermore, the step of generating a continuous positioning trajectory based on the matching results includes calculating the total magnetic field strength based on the real-time collected triaxial magnetic field data to form a real-time geomagnetic observation sequence; The median absolute deviation method is used to detect abnormal sampling points in the real-time geomagnetic observation sequence, and the abnormal sampling points are corrected by using adjacent valid sampling points. The corrected real-time geomagnetic observation sequence is then smoothed and filtered. The real-time geomagnetic observation sequence after smoothing and filtering is spatially resampled according to a preset spatial interval. The spatially resampled real-time geomagnetic observation sequence is then standardized and divided into several sliding window sequences that are consecutive in time sequence.

[0014] Furthermore, the step of generating a continuous positioning trajectory based on the matching results includes, for each sliding window sequence and each candidate matching sequence, calculating the local distance between the local magnetic observation values ​​in the sliding window sequence and the local magnetic reference values ​​in the candidate matching sequence, and constructing a local distance matrix. The cumulative cost matrix is ​​constructed based on the local distance matrix, and a constraint band is applied when constructing the cumulative cost matrix so that the dynamic time warped path is only located within the constraint band; The endpoint value of the cumulative cost matrix is ​​determined as the dynamic time warping distance of the corresponding candidate matching sequence, and the corresponding optimal alignment path is obtained by backtracking from the endpoint of the cumulative cost matrix to the starting point. The candidate localization results are sorted according to the dynamic time warping distance corresponding to each candidate matching sequence, and then weighted and fused according to the reciprocal of the dynamic time warping distance to obtain the fused localization result of the current sliding window sequence.

[0015] In summary, the present invention has the following beneficial technical effects: 1. This invention obtains prior information about the geometric structure of the target indoor passage, divides the acquisition path into several interconnected straight line segments, and calculates the pedestrian trajectory segment by segment based on the known length, starting coordinates, and direction of travel of each segment. This limits the error of the pedestrian trajectory calculation to a single segment, avoiding the accumulation of heading and position errors across segments during continuous acquisition, thereby improving the accuracy of geomagnetic fingerprint point coordinates and the uniformity of spatial distribution.

[0016] 2. This invention constructs a spatial index using the spatial coordinates of geomagnetic fingerprint points and performs weighted fusion or insertion of newly added geomagnetic fingerprint points based on spatial proximity conditions. This enables rapid retrieval of geomagnetic fingerprint points, fusion of duplicate points, and insertion of new points. It also facilitates incremental updates of local areas and reduces the maintenance cost of the fingerprint database.

[0017] 3. This invention extracts geomagnetic contour lines based on a geomagnetic fingerprint database and determines candidate search areas by combining real-time short-term pedestrian trajectory estimation results. The candidate locations are limited to the geomagnetic contour lines and the candidate search areas. At the same time, candidate points are screened by combining geomagnetic feature differences, predicted location distance, spatial continuity and directional consistency, which narrows the search range of candidate locations and reduces the probability of mismatches caused by repeated geomagnetic features.

[0018] 4. This invention performs translation and rotation correction on the real-time pedestrian trajectory estimation trajectory by iterative spatial registration of the nearest contour points, and uses position residual, geomagnetic residual and trajectory smoothness to form a composite convergence condition. Then, based on the corrected trajectory and candidate matching sequence, it performs constrained dynamic time warping matching and candidate result fusion, realizing the coordinated processing of spatial constraints and sequence matching, improving the robustness of geomagnetic sequence matching and the accuracy and trajectory smoothness of indoor continuous positioning. Attached Figure Description

[0019] Figure 1 This is a schematic diagram of the overall query architecture for geomagnetic sequences in an embodiment of the present invention; Figure 2 This is a schematic diagram of the two-dimensional space partitioning of the k-dimensional tree space index in an embodiment of the present invention; Figure 3 This is a plan view of the geomagnetic data acquisition area in an embodiment of the present invention; Figure 4 This is a schematic diagram of the process for calculating the segmented pedestrian trajectory in an embodiment of the present invention; Figure 5 This is a schematic diagram illustrating the geomagnetic contour line construction process in an embodiment of the present invention; Figure 6 This is a schematic diagram of the iterative spatial registration process of the nearest contour points in an embodiment of the present invention; Figure 7 This is a schematic diagram of the dynamic time warping sequence alignment process in an embodiment of the present invention; Figure 8 This is a schematic diagram of the joint optimization framework of iterative nearest contour point spatial registration and dynamic time warping in an embodiment of the present invention; Figure 9 This is a schematic diagram of sliding window matching and candidate fusion positioning in an embodiment of the present invention. Detailed Implementation

[0020] The present invention will be further described in detail below with reference to the accompanying drawings.

[0021] Example 1 Reference Figure 1 This embodiment of an indoor geomagnetic positioning method based on spatial registration and dynamic time warping includes: S1. Obtain prior information on the geometric structure of the target indoor passage, segment the acquisition path, and synchronously acquire acceleration data and magnetic field data with a unified timestamp along the segmented acquisition path. S2. Based on the acquired prior information of geometric structure and acceleration data, the pedestrian trajectory is calculated in segments, and the calculated trajectory points are matched with the corresponding magnetic field data to generate geomagnetic fingerprint points. S3. Construct a spatial index using geomagnetic fingerprint points, merge geomagnetic fingerprint points that meet the spatial proximity condition, and insert geomagnetic fingerprint points that do not meet the spatial proximity condition to obtain a geomagnetic fingerprint database. S4. Construct a geomagnetic benchmark map based on the geomagnetic fingerprint database and extract geomagnetic contour lines. Combine the real-time short-term pedestrian trajectory estimation results to determine the candidate search area and generate a set of candidate points within the candidate search area. S5. Based on the candidate point set, iteratively register the nearest contour points to the spatial registration of the real-time pedestrian trajectory to obtain the corrected trajectory and candidate matching sequence. S6. Based on the corrected trajectory and candidate matching sequence, perform dynamic time warping matching on the real-time geomagnetic observation sequence, and generate a continuous positioning trajectory based on the matching result.

[0022] Specifically, an indoor geomagnetic positioning method based on spatial registration and dynamic time warping includes the following: like Figure 1As shown in Figure S1, in this embodiment, the prior geometric information of the target indoor passage is first obtained. This prior geometric information includes the planar topology of the target indoor passage, the length of each straight segment, the corner positions, and the direction of travel for each straight segment. Specifically, the prior geometric information is obtained based on the architectural floor plan, interior CAD drawings, or BIM model, or by measuring using a laser rangefinder, measuring tape, or by accumulating the dimensions of floor tiles. After obtaining the prior geometric information, a two-dimensional global coordinate system corresponding to the target indoor passage is established, and a corner position is selected as the origin. Based on the coordinates of each corner position in the two-dimensional global coordinate system, the starting coordinates, ending coordinates, length, and direction angle of travel for each straight segment are determined.

[0023] For a data acquisition path formed by connecting multiple straight line segments in sequence, the data acquisition path is divided at the corner position so that each segment corresponds to a straight line segment with known start coordinates, end coordinates and direction of travel; adjacent straight line segments are spatially connected by the same known corner coordinates, that is, the end coordinates of the previous straight line segment are the same as the start coordinates of the next straight line segment, thus providing endpoint constraints and direction constraints for subsequent segmented pedestrian trajectory estimation.

[0024] After segmenting the acquisition path, multi-source sensor data is synchronously acquired along the segmented acquisition path. The acquisition device can be a smartphone, handheld terminal, or other mobile acquisition device with built-in accelerometers, gyroscopes, and magnetometers. Before acquiring data along each straight segment, the acquisition device is kept stationary at the starting point of the corresponding straight segment for a preset time to obtain the initial attitude information of the acquisition device; the initial attitude information includes at least the gravity direction information acquired by the accelerometer and the initial magnetic field direction information acquired by the magnetometer. After completing the static attitude calibration, the acquisition personnel walk along the corresponding straight segment, and the acquisition device synchronously acquires triaxial acceleration data, triaxial angular velocity data, and triaxial magnetic field data at a fixed sampling frequency. The triaxial acceleration data is used for subsequent gait detection, the triaxial angular velocity data is used for short-term pedestrian trajectory estimation during the real-time positioning phase, and the triaxial magnetic field data is used to generate geomagnetic fingerprint points. Each sensor data point is appended with a timestamp under the same time base to ensure that different types of sensor data can correspond according to the sampling time.

[0025] In one specific implementation, the fixed sampling frequency is 50Hz, the preset duration of static attitude calibration can be about 3 seconds, and the timestamp accuracy can be in the millisecond range; the collected data can be stored in CSV format, and each data record includes at least the sampling timestamp and the corresponding sensor sampling values ​​in three orthogonal directions.

[0026] For each sampling time, the total magnetic field strength is calculated based on the triaxial magnetic field data corresponding to that sampling time. This ensures that subsequent geomagnetic fingerprinting and geomagnetic sequence matching utilize a magnetic field magnitude that is not directly affected by single-axis attitude changes of the acquisition device. The formula for calculating the total magnetic field strength is as follows: , in, For the i-th sampling time The corresponding total magnetic field strength, These are the i-th sampling times. The magnetic field components of the acquisition device in three orthogonal directions; i is the sampling point number.

[0027] S2. After completing the synchronous data acquisition for each straight line segment in step S1, gait detection is performed on the acceleration data corresponding to each straight line segment. Specifically, for the i-th sampling time... The composite acceleration amplitude is calculated from the acquired three-axis acceleration components to reduce the impact of changes in the attitude of the acquisition device on the single-axis acceleration. The formula for calculating the composite acceleration amplitude is as follows: , in, Sampling time The corresponding composite acceleration amplitude, Sampling time The acceleration components are located in the three orthogonal directions. After obtaining the composite acceleration amplitude sequence, a bandpass filter is applied to the composite acceleration amplitude sequence to filter out high-frequency components caused by equipment jitter and sensor thermal noise, and to suppress low-frequency drift caused by the slow variation of the gravity component.

[0028] like Figure 4 As shown, in one specific embodiment, a second-order Butterworth bandpass filter is used, with the passband set to 0.5Hz to 3Hz. Subsequently, peak detection is performed on the filtered composite acceleration amplitude sequence, and the peaks satisfying the minimum peak spacing and minimum peak significance conditions are determined as effective gait peaks. In one specific embodiment, the minimum peak spacing is set to 0.4 seconds, and the minimum peak significance is set to 0.2 acceleration units. Based on the detected effective gait peaks, the gait time sequence within the corresponding straight line segment and the effective step count N are determined.

[0029] After determining the effective number of steps, the distance estimated from the pedestrian's trajectory is segmented and scaled based on a preset fixed step length and the known length of the corresponding straight line segment. Specifically, the product of the effective number of steps and the preset fixed step length is determined as the original walking distance of the corresponding straight line segment, and the ratio of the known length of the corresponding straight line segment to the original walking distance is determined as the single-segment distance scaling factor. The single-segment distance scaling factor is calculated according to the following formula: , in, This is the scaling factor for the single-segment distance of the corresponding line segment. Given the length of the corresponding line segment. This represents the number of valid steps detected within the corresponding straight line segment. This is a preset fixed step size.

[0030] After determining the scaling factor for a single segment, coordinates are assigned to the trajectory points corresponding to each gait time based on the starting coordinates of the corresponding straight segment, the direction angle of travel, and the step sequence corresponding to each gait time. The expression for the x-coordinate of the k-th trajectory point is: , The formula for calculating the ordinate of the kth trajectory point is: , in, , Let x and y be the x and y coordinates of the kth trajectory point, respectively. , These are the x and y coordinates of the starting point of the corresponding segment, respectively. Where is the known length of the corresponding segment, and N is the number of valid steps detected within the corresponding segment. Let k be the gait point index, and k = 0, 1, ..., N. Additionally, This represents the cumulative walking distance of the k-th trajectory point relative to the starting point of the corresponding straight line segment. When k=N, the corresponding trajectory point is constrained to the known endpoint coordinates of the straight line segment, thus allowing adjacent straight line segments to be naturally connected through known corner coordinates, avoiding the accumulation of pedestrian trajectory estimation errors across segments during continuous data collection. In one specific implementation, the preset fixed step size can be set to 0.60 meters.

[0031] After the coordinates of each trajectory point are assigned, the total magnetic field strength at the same time is obtained based on the gait time corresponding to each trajectory point. Specifically, the gait time corresponding to the k-th trajectory point is used as the query time. In the magnetic field data time series formed in step S1, the magnetic field sampling point with the smallest time difference from the query time is found, and the total magnetic field strength corresponding to the magnetic field sampling point is used as the total magnetic field strength of the k-th trajectory point. When two adjacent magnetic field sampling times are located before and after the query time and need to be time-aligned, the total magnetic field strength corresponding to the query time is obtained by linear interpolation. When the time difference between the most recent magnetic field sampling point and the query time exceeds a preset time threshold, the corresponding trajectory point is marked as an invalid point, or compensation is made using adjacent valid magnetic field sampling values.

[0032] Finally, a geomagnetic fingerprint record is generated for each valid trajectory point. The geomagnetic fingerprint record includes at least the x-coordinate, y-coordinate, cumulative walking distance, total magnetic field strength, and initial weight of the trajectory point. The initial weight is used to characterize the cumulative number of samplings at the corresponding spatial location.

[0033] like Figure 2 As shown in Figure S3, construct a k-dimensional tree space index for each segment of geomagnetic fingerprint points according to two-dimensional spatial coordinates to improve the nearest neighbor retrieval efficiency between newly added geomagnetic fingerprint points and existing geomagnetic fingerprint points.

[0034] Specifically, the x-coordinate and y-coordinate of each geomagnetic fingerprint point are combined to form a two-dimensional coordinate vector, and the two-dimensional coordinate vectors of all existing geomagnetic fingerprint points are used as the node data of the k-dimensional tree. When constructing the k-dimensional tree, the x-coordinate dimension or y-coordinate dimension is alternately selected as the current partitioning dimension according to the node's level. The geomagnetic fingerprint points in the current partitioning dimension are sorted, and the median of the sorted points is selected as the current node. Geomagnetic fingerprint points whose coordinate values ​​in the current partitioning dimension are less than the median are assigned to the left subtree, and those whose coordinate values ​​are greater than the median are assigned to the right subtree. This partitioning process is recursively performed on the left and right subtrees until all geomagnetic fingerprint points are inserted into the k-dimensional tree spatial index. This spatial index structure avoids calculating the distance to each geomagnetic fingerprint point individually, thereby improving the retrieval efficiency of nearest neighbor fingerprint points.

[0035] For any newly added geomagnetic fingerprint point in the newly collected batch, its x-coordinate, y-coordinate, total magnetic field strength, and weight are extracted. Then, using the k-dimensional tree spatial index, the existing geomagnetic fingerprint database is searched for the geomagnetic fingerprint point with the closest spatial distance to the newly added geomagnetic fingerprint point. The formula for calculating the spatial distance between the newly added geomagnetic fingerprint point and the existing geomagnetic fingerprint point is as follows: , in, This represents the two-dimensional spatial distance between the newly added geomagnetic fingerprint point and the nearest existing geomagnetic fingerprint point. , These are the x and y coordinates of the newly added geomagnetic fingerprint points. , These are the x and y coordinates of the most recently existing geomagnetic fingerprint points, respectively.

[0036] The calculated spatial distance is compared with a preset fusion distance threshold. In this embodiment, the preset fusion distance threshold is 0.60 meters. This value is determined based on the following: a preset fixed step size of 0.60 meters and a grid resolution of 0.3 meters for the geomagnetic reference map. Using this preset fusion distance threshold can merge duplicate sampling points at the same spatial location while avoiding the erroneous merging of fingerprint points at adjacent spatial locations. When the spatial distance is less than the preset fusion distance threshold, it is determined that the newly added geomagnetic fingerprint point corresponds to the same spatial location as the existing geomagnetic fingerprint point. The magnetic field strength, spatial coordinates, and weights of the two are then weighted and fused according to the cumulative sampling weight. The fused magnetic field strength is as follows: , The merged x-axis is represented as: , The formula for calculating the merged ordinate is: , The formula for calculating the weights after fusion is: , in, , , and These represent the merged magnetic field strength, x-axis, y-axis, and cumulative weight, respectively. These represent the magnetic field strength, x-axis, y-axis, and cumulative weight of existing geomagnetic fingerprint points. The data points are the magnetic field strength, x-axis, y-axis, and weight of the newly added geomagnetic fingerprint points. The weight is used to characterize the cumulative number of samplings at the corresponding spatial location. The larger the weight, the more times the geomagnetic observation data at the corresponding location has been sampled and verified, and the higher its stability and reliability.

[0037] When the spatial distance is greater than or equal to a preset fusion distance threshold, the newly added geomagnetic fingerprint point is determined to correspond to a new spatial location. This newly added geomagnetic fingerprint point is then inserted into the geomagnetic fingerprint database as a new fingerprint node, with its initial weight set to 1. After each newly added geomagnetic fingerprint point is fused or inserted, the k-dimensional tree spatial index is updated synchronously, enabling subsequent newly added geomagnetic fingerprint points to continue nearest neighbor retrieval based on the updated spatial index. In one specific embodiment, the preset fusion distance threshold can be set to 0.6 meters. After all newly added geomagnetic fingerprint points have been processed, each fingerprint node is sorted and stored according to its horizontal and vertical coordinates, resulting in a geomagnetic fingerprint database containing the horizontal and vertical coordinates, cumulative walking distance, total magnetic field strength, and cumulative weight.

[0038] like Figure 5As shown in S4, in this embodiment, after completing the construction of the geomagnetic fingerprint database described in step S3, a continuous geomagnetic reference map is constructed using discrete geomagnetic fingerprint points in the database. Specifically, a preset grid is set according to the spatial range of the target indoor passage and the preset positioning accuracy, and the abscissa, ordinate, and total magnetic field strength of each geomagnetic fingerprint point are mapped to the preset grid. For grid nodes that do not directly coincide with geomagnetic fingerprint points, interpolation calculations are performed based on the geomagnetic fingerprint points around the grid node to obtain the magnetic field estimate at each grid node, thereby constructing a continuous geomagnetic reference map. In a specific embodiment, the grid resolution of the preset grid can be set to 0.3 meters × 0.3 meters, and the magnetic field value of the grid node can be calculated using linear interpolation, inverse distance weighted interpolation, or Kriging interpolation methods. After the continuous geomagnetic reference map is established, geomagnetic contour lines are extracted from the continuous geomagnetic reference map according to different magnetic field strength values. For real-time magnetic field observation values... The corresponding geomagnetic contour lines are determined according to the following formula: , in, The magnetic field value is equal to Geomagnetic contour lines, Two-dimensional spatial coordinates in a continuous geomagnetic reference map. This represents the magnetic field value at coordinates (x, y) of a continuous geomagnetic reference map. For the i-th real-time magnetic field observation, in one specific implementation, multiple magnetic field strength values ​​can be set at isopleth intervals of 0.5 μT or 1.0 μT, and the MarchingSquares isopleth tracing algorithm is used to extract the corresponding geomagnetic isopleths from the gridded geomagnetic reference map. Each geomagnetic isopleth consists of several discrete isopleth points, used to constrain the spatial location corresponding to the real-time magnetic field observation to the vicinity of the corresponding isopleth.

[0039] After extracting the geomagnetic contour lines, short-term pedestrian trajectory is calculated based on real-time collected acceleration and angular velocity data to obtain the predicted location at the current positioning time.

[0040] Specifically, within the current sliding time window, gait detection is performed on the real-time collected acceleration data to obtain the gait time and number of steps before the current positioning time; the displacement length between adjacent gait points is determined according to a preset step length or step frequency-step length model, and the relative heading change between adjacent gait points is determined according to the angular velocity data collected by the gyroscope; using the starting position of the current sliding time window as a reference, the position is recursively calculated according to the displacement length and relative heading change of the gait points to obtain the predicted position at the current positioning time. Subsequently, a candidate search area is determined with the predicted position as the center and a preset search radius, where the expression for the candidate search area is: , in, Candidate search regions, As candidate positions, The predicted position is obtained by extrapolating the short-term pedestrian trajectory from the previous positioning time. To preset the search radius, This involves a two-dimensional Euclidean distance calculation. In one specific implementation, the preset search radius can be set to 3 to 5 meters. By defining the candidate search area using the above formula, duplicate geomagnetic feature regions that deviate from the predicted position on the corresponding geomagnetic contour lines can be excluded, thereby reducing false matches caused by similar magnetic field variation characteristics at different spatial locations.

[0041] After determining the candidate search area, using the spatial index constructed in step S3, search for the contour point closest to the real-time pedestrian trajectory prediction point within the intersection of the corresponding geomagnetic contour line and the candidate search area. The nearest contour point corresponding to the i-th real-time pedestrian trajectory prediction point is: , in, Let i be the nearest contour line point corresponding to the i-th real-time pedestrian trajectory point. The position of the trajectory point is calculated for the i-th real-time pedestrian trajectory. Located on the corresponding geomagnetic contour lines For contour points within the intersection with the candidate search region R, the nearest contour point retrieval is performed using the spatial index, which avoids traversing all discrete points on the geomagnetic contour lines, thereby improving the efficiency of candidate point search.

[0042] After obtaining the nearest contour point and its neighboring candidate points, the geomagnetic feature difference term, PDR distance constraint term, temporal continuity constraint term, and directional consistency constraint term are calculated respectively. The geomagnetic feature difference term characterizes the absolute difference between the geomagnetic value of the candidate point and the real-time measured geomagnetic value; the PDR distance constraint term characterizes the spatial Euclidean distance between the candidate point and the PDR predicted location, where PDR represents the pedestrian trajectory estimation; the temporal continuity constraint term characterizes the spatial distance between the current candidate point and the previously matched point to avoid abnormal jumps in adjacent positioning results; the directional consistency constraint term characterizes the angular difference between the trajectory direction corresponding to the candidate point and the PDR heading. The specific expressions for these constraints are as follows: , , , , Based on the above four constraints, the candidate point evaluation function is constructed as follows: , in, The candidate review value of candidate point s. , , and These are the weighting coefficients for differences in geomagnetic characteristics, distance to the PDR predicted location, temporal continuity, and directional consistency, respectively. The geomagnetic value corresponding to the candidate point. The geomagnetic value is obtained through real-time measurement. The location of the candidate point. For PDR predicted location, The current candidate point position. This represents the position of the matched point from the previous moment. The trajectory direction angle corresponding to the candidate point. For PDR heading angle, For Euclidean distance, This represents the difference in geomagnetic characteristics. For PDR distance constraint terms, For time continuity constraints, As a directional consistency constraint, the smaller the candidate point evaluation function value, the higher the consistency between the corresponding candidate point and the real-time magnetic field observation, PDR predicted position, the previously matched position, and the PDR heading. Candidate points are sorted in ascending order of their evaluation function values. A preset number of candidate points at the top of the sorting are selected to form the candidate point subset for the current moment. The preset number refers to the number of candidate points retained after sorting each trajectory point according to its evaluation function value J in ascending order. This number limits the number of candidate points for each trajectory point, rather than limiting the search radius of the candidate search area. The search radius determines the spatial range of the candidate search area, while the preset number further filters candidate points within that area. In this embodiment, the preset number is 5, meaning that the 5 candidate points with the smallest evaluation function values ​​are retained for each trajectory point. After filtering the candidate point subsets for each trajectory point, the candidate point subsets corresponding to multiple consecutive moments are arranged in chronological order to generate a candidate point set.

[0043] S5. After generating the candidate point set in step S4, the real-time pedestrian trajectory is determined as the current trajectory, and the candidate point set is used to perform iterative spatial registration of the nearest contour points on the current trajectory. Specifically, as follows... Figure 6As shown, in the k-th iteration, for each trajectory point in the current trajectory, the nearest contour point corresponding to that trajectory point is searched in the candidate point set to form the nearest contour point set; then, a point set registration model between the current trajectory point and the corresponding nearest contour point is established, with the minimum of the sum of squared distance errors between the trajectory point after rigid body transformation and the corresponding nearest contour point as the optimization objective, and the rotation matrix and translation vector are solved. The sum of squared distance errors is calculated according to the formula: , in, This represents the registration error between the current trajectory and the nearest set of contour points. It is a rotation matrix; It is a translation vector. Let i be the i-th trajectory point in the current trajectory. To and The corresponding nearest contour point, where n is the number of trajectory points in the current trajectory, can be minimized by the formula to simultaneously correct the translational and heading deviations in the real-time pedestrian trajectory calculation, so that the trajectory points after rigid body transformation approach the corresponding geomagnetic contour lines.

[0044] When solving for the rotation matrix and translation vector, first calculate the centroids of the current trajectory point set and the nearest contour line point set, respectively. The formulas for calculating the centroids of the two point sets are: , in, Let be the centroid of the current set of trajectory points. Let the centroid of the nearest set of contour points be denoted as . Then, center the current trajectory point set and the nearest set of contour points based on the centroids of the two point sets, and construct the covariance matrix based on the two centered point sets: , in, Let covariance matrix be the variance matrix. It is a point set matrix composed of the trajectory points in the current trajectory. Given a point set matrix composed of the nearest contour points, singular value decomposition is performed on the covariance matrix, and the rotation matrix and translation vector are calculated based on the decomposition results. The expressions for the singular value decomposition and rigid body transformation parameters are as follows: , , ; in, , , The covariance matrix H is obtained by performing singular value decomposition. After obtaining the rotation matrix and translation vector, each trajectory point in the current trajectory is subjected to rigid body transformation to obtain the updated trajectory after this iteration. The update process of the i-th trajectory point is as follows: , in, Let i be the trajectory point after the k-th iteration. For the kth The i-th trajectory point after 1 iteration, The rotation matrix is ​​obtained by solving the problem in the k-th iteration. This is the translation vector obtained in the k-th iteration. After completing the trajectory update, the updated trajectory is used as the current trajectory for the next iteration, and the process of searching for the nearest contour points and solving the rigid body transformation parameters is returned until the preset convergence condition is met or the preset maximum number of iterations is reached.

[0045] To improve the reliability of iterative convergence, this embodiment employs a multi-dimensional composite convergence condition consisting of position residual, geomagnetic residual, and trajectory smoothness. Specifically, the trajectory point after the k-th iteration is calculated relative to the k-th iteration. The position residuals of the trajectory points after one iteration are used to determine whether the position residuals satisfy the convergence condition according to the following formula: , Calculate the geomagnetic residual between the magnetic field value of the trajectory point in the continuous geomagnetic reference map after the k-th iteration and the corresponding real-time magnetic field observation value, and determine whether the geomagnetic residual satisfies the convergence condition according to the following formula: , Calculate the variance of the distance between adjacent trajectory points in the trajectory after the k-th iteration, and use this variance as the trajectory smoothness. Determine whether the trajectory smoothness meets the convergence condition according to the following formula: , in, Let i be the trajectory point after the k-th iteration. For the kth The i-th trajectory point after 1 iteration, Let be the magnetic field value of the i-th trajectory point in the geomagnetic reference map after the k-th iteration. For the i-th real-time magnetic field observation, The position residual threshold, The threshold value for geomagnetic residuals. This is the trajectory smoothness threshold.

[0046] When all three convergence conditions are met simultaneously, the spatial registration of the nearest contour points is determined to be converged, and the iteration stops. If the three convergence conditions are not met simultaneously and the number of iterations is less than the preset maximum number of iterations, the next iteration continues. If the preset maximum number of iterations is reached but the three convergence conditions are still not met simultaneously, the iteration stops, and the trajectory obtained from the last update is used as the corrected trajectory. Subsequently, the trajectory points in the corrected trajectory and their corresponding nearest contour points are associated in chronological order to generate a candidate matching sequence for dynamic time warping matching. In one specific embodiment, the preset maximum number of iterations can be set to 50, the position residual threshold can be set to 0.01 meters, the geomagnetic residual threshold can be set to 0.5 μT, and the trajectory smoothness threshold can be set to 0.05.

[0047] S6. After generating the corrected trajectory and candidate matching sequence, the real-time acquired triaxial magnetic field data is preprocessed to form a real-time geomagnetic observation sequence for dynamic time-warped matching. Specifically: for the i-th sampling time in the real-time acquisition process... The total magnetic field strength is calculated based on the magnetic field components in three orthogonal directions. The calculated total magnetic field strengths are then arranged in chronological order according to their corresponding sampling times to form a real-time geomagnetic observation sequence. After obtaining the real-time geomagnetic observation sequence, the median absolute deviation method is used to detect abnormal sampling points in the sequence. The formula for calculating the median absolute deviation is: , in, This represents the absolute deviation of the median. This represents the i-th geomagnetic observation value in the real-time geomagnetic observation sequence. This is a real-time geomagnetic observation sequence; median( () is used for median operations.

[0048] Sampling points deviating from the median of the real-time geomagnetic observation sequence by more than three times the absolute deviation of the median are identified as outliers, and linear interpolation correction is performed using valid sampling points before and after the outliers. After outlier correction, the real-time geomagnetic observation sequence is smoothed and filtered to suppress sensor thermal noise and short-term electromagnetic interference; in one specific embodiment, a moving average filtering method with a window length of 3 sampling points can be used. Subsequently, based on the spatial positions of adjacent sampling points calculated from pedestrian tracks, the smoothed and filtered real-time geomagnetic observation sequence is resampled by linear interpolation at a preset spatial interval, so that the resampled geomagnetic observation points are spatially uniformly distributed. In one specific embodiment, the preset spatial interval can be set to 0.3 meters.

[0049] After spatial resampling, the real-time geomagnetic observation sequence is standardized to eliminate differences in magnetic field magnitudes between different acquisition devices and acquisition times. The formula for calculating the standardized geomagnetic observation values ​​is as follows: , in, This represents the i-th geomagnetic observation after spatial resampling. This corresponds to the mean of the real-time geomagnetic observation sequence. To correspond to the standard deviation of the real-time geomagnetic observation sequence, This represents the i-th geomagnetic observation value after standardization. After standardization, the standardized real-time geomagnetic observation sequence is divided into several sliding window sequences in chronological order, with adjacent sliding window sequences moving according to a preset sliding step size. In one specific implementation, the length of the sliding window sequence can be set to 5 spatial resampling points, and the sliding step size can be set to 1 spatial resampling point.

[0050] For each sliding window sequence and each candidate matching sequence, the local distance between the geomagnetic observations in the sliding window sequence and the geomagnetic reference values ​​in the candidate matching sequence is calculated, and a local distance matrix is ​​constructed. Let the sliding window sequence be... The candidate matching sequence is The local distance between the i-th geomagnetic observation in the sliding window sequence and the j-th geomagnetic reference value in the candidate matching sequence is expressed as: , in, for and Local distance between them This represents the i-th geomagnetic observation in the sliding window sequence. Let j be the j-th geomagnetic reference value in the candidate matching sequence. The length of the sliding window sequence. is the length of the candidate matching sequence.

[0051] The cumulative cost matrix is ​​constructed based on the local distance matrix, and a Sakoe-Chiba constraint band is applied during the construction of the cumulative cost matrix to ensure that the dynamically warped path lies only within the constraint band. The expression for the cumulative cost matrix is ​​as follows: , in, Let $\frac{i}{j}$ be the cumulative cost in the $i$-th row and $j$-th column of the cumulative cost matrix. For Sakoe-Chiba constraint band width, This indicates that the corresponding matrix elements do not participate in the dynamic time warping path search. The three recursive terms in the cumulative cost matrix expression represent three alignment methods: candidate matching sequence stretching, sliding window sequence compression, and simultaneous advancement of two sequences. The boundary conditions of the cumulative cost matrix are: D(1,1)=d(1,1); for i=1 and j>1, D(1,j)=d(1,j)+D(1,j-1); for i>1 and j=1, D(i,1)=d(i,1)+D(i-1,1). By setting constraint bands, the deviation of the dynamic time warping path from the main diagonal can be limited, thereby reducing the matching computation and reducing abnormal alignment paths.

[0052] like Figure 7 , Figure 8 As shown, after constructing the cumulative cost matrix, the endpoint of the cumulative cost matrix is ​​determined as the dynamic time warping distance of the corresponding candidate matching sequence. Then, by backtracking from the endpoint of the cumulative cost matrix to the starting point, the optimal alignment path between the sliding window sequence and the candidate matching sequence is obtained. The formulas for calculating the dynamic time warping distance and the best candidate matching sequence are: , in, The dynamic time-warped distance corresponding to the k-th candidate matching sequence. Let be the endpoint value of the cumulative cost matrix corresponding to the k-th candidate matching sequence. Let k be the length of the candidate matching sequence. This is the sequence number of the candidate matching sequence with the smallest dynamic time warp distance. The smaller the dynamic time warp distance, the higher the similarity between the sliding window sequence and the corresponding candidate matching sequence.

[0053] like Figure 9 As shown, to avoid localization jumps caused by a single candidate matching sequence, multiple candidate localization results ranked high in dynamic time warp distance are weighted and fused. Specifically, the top candidates are selected in ascending order of dynamic time warp distance. Each candidate localization result is assigned a weight, and the reciprocal of the dynamic time-normalized distance is used as the weight for each candidate localization result to calculate the fused localization result for the current sliding window sequence. The fused localization result is then calculated according to... , in, This represents the fusion localization result corresponding to the current sliding window sequence. The number of candidate localization results participating in the fusion. This represents the candidate localization result corresponding to the k-th candidate matching sequence. This represents the dynamic time-normalized distance corresponding to the k-th candidate matching sequence. After all sliding window sequences have been processed, the fused localization results corresponding to each sliding window sequence are connected in chronological order to form a continuous localization trajectory.

[0054] Example 2 The difference between this embodiment and Embodiment 1 is that this embodiment provides a simulation experiment of an indoor geomagnetic positioning method based on spatial registration and dynamic time warping; Step 1: Set up the experimental environment and collect sensor data like Figure 3 As shown, a circular corridor on the second floor of a teaching building was selected as the experimental area. This circular corridor consists of four straight corridor sections, approximately 40 meters long in the east-west direction and 62 meters long in the north-south direction. The floor is paved with 0.6m x 0.6m tiles. Reinforced concrete columns, metal pipes, and electrical equipment are installed around the corridor, creating a spatially differentiated geomagnetic distribution.

[0055] The experiment used a smartphone with a built-in accelerometer, gyroscope, and magnetometer as the data acquisition device. A data acquisition program was used to simultaneously collect triaxial acceleration, triaxial angular velocity, and triaxial magnetic field data at a sampling frequency of 50Hz. The data acquisition personnel held the device to their chest and walked counter-clockwise along a circular corridor at a normal walking speed.

[0056] Each lap of the data acquisition path is divided into four straight segments based on the four corner positions, and each straight segment is acquired separately. Before acquiring data for each straight segment, the acquisition device remains stationary for approximately 3 seconds at the starting point of the corresponding straight segment to complete initial attitude calibration. Data is acquired for a total of three laps, with each lap including four straight segments, resulting in a total of twelve sensor data segments.

[0057] Step 2: Perform segmented pedestrian trajectory estimation and construct a geomagnetic fingerprint database. For the acceleration data corresponding to each straight line segment, the composite acceleration amplitude is first calculated, and then a second-order Butterworth bandpass filter is used to filter the composite acceleration amplitude. The filter passband is set to 0.5Hz to 3Hz. Then, peak detection is performed, the minimum peak spacing is set to 0.4 seconds, and the minimum peak significance is set to 0.2 acceleration units to obtain the effective number of steps within the corresponding straight line segment.

[0058] The preset fixed step size is 0.60 meters. A single-segment distance scaling factor is determined based on the effective number of steps, the preset fixed step size, and the known length of the corresponding straight segment. The two-dimensional coordinates of each trajectory point are then calculated using the starting coordinates of the corresponding straight segment and the travel direction angle. Subsequently, the total magnetic field strength is obtained based on the gait time corresponding to the trajectory point, generating a geomagnetic fingerprint.

[0059] After processing the twelve segments of data collected across three loops, the endpoints of each segment of the pedestrian track extrapolated by segment naturally connect with the corresponding known corner points, eliminating the need for closure correction. Experimental results show that the spatial coverage of the segmented data collection method is 99.0%; in contrast, the closure error of the continuous pedestrian track extrapolation method for the entire loop ranges from 4.7 meters to 27.6 meters, with a spatial coverage of 87.3%.

[0060] The geomagnetic fingerprint points collected from three orbits are input into a k-dimensional tree spatial index, and the fusion distance threshold is set to 0.6 meters. When the spatial distance between a newly added geomagnetic fingerprint point and the nearest existing geomagnetic fingerprint point is less than 0.6 meters, the magnetic field strength, spatial coordinates, and weights are fused according to the cumulative sampling weights; when the spatial distance is greater than or equal to 0.6 meters, the newly added geomagnetic fingerprint point is inserted as a new fingerprint node into the geomagnetic fingerprint database. After fusion processing, a two-dimensional geomagnetic fingerprint database containing 23,760 geomagnetic fingerprint points is obtained.

[0061] Step 3: Verify the incremental update process of the geomagnetic fingerprint database After completing the initial geomagnetic fingerprint database construction, an additional segmented data collection was conducted to simulate the local update process following changes in the indoor environment. The new data collection was still carried out along four straight line segments, containing approximately 7,543 raw data points.

[0062] After performing segmented pedestrian trajectory estimation and geomagnetic fingerprint point generation on the newly collected data, the k-dimensional tree spatial index is used to search for the nearest existing geomagnetic fingerprint point corresponding to each new geomagnetic fingerprint point. When the spatial distance is less than 0.6 meters, weighted fusion is performed; when the spatial distance is greater than or equal to 0.6 meters, the new geomagnetic fingerprint point is inserted into the geomagnetic fingerprint database.

[0063] After the update, the number of fingerprints in the geomagnetic fingerprint database increased from 23,760 to 27,329. Of these, 3,569 were newly added independent fingerprints, accounting for 15.0% of the total number of fingerprints before the update; approximately 3,974 new geomagnetic fingerprints were merged with existing ones. The magnetic field values ​​in the merged area showed a smooth change, without any abnormal magnetic field abrupt changes, indicating that the incremental update process can complete local data maintenance without rebuilding the entire geomagnetic fingerprint database.

[0064] Step 4: Construct a geomagnetic baseline map and perform iterative spatial registration of the nearest contour points. A geomagnetic fingerprint database containing 23,760 fingerprint points was mapped onto a preset grid of 0.3 m × 0.3 m, and the magnetic field values ​​at each grid node were estimated using a linear interpolation method to construct a continuous geomagnetic baseline map. Subsequently, geomagnetic contour lines were extracted at 0.5 μT intervals.

[0065] During the real-time positioning phase, short-term pedestrian trajectory is calculated based on acceleration and angular velocity data within the current sliding time window to obtain the predicted position at the current positioning time. A candidate search area is then determined with the predicted position as the center and a preset search radius of 5 meters. Within the corresponding geomagnetic contour lines and the candidate search area, the nearest contour line point is searched using a k-dimensional tree spatial index. A set of candidate points is generated by combining geomagnetic feature differences, pedestrian trajectory calculation distance constraints, time continuity constraints, and direction consistency constraints. Five candidate points are retained for each trajectory point.

[0066] During the iterative spatial registration of the nearest contour points, the maximum number of iterations is set to 50, the position residual threshold is set to 0.01 meters, the geomagnetic residual threshold is set to 0.5 μT, and the trajectory smoothness threshold is set to 0.05. When the initial position deviation is within the preset search radius, the iterative spatial registration of the nearest contour points typically converges after 5 to 15 iterations, outputting the corrected trajectory and candidate matching sequence.

[0067] Step 5: Perform dynamic time warping matching and compare the results. The real-time geomagnetic observation sequence was processed sequentially, including total magnetic field strength calculation, outlier detection and correction, smoothing filtering, spatial resampling, and standardization. Specifically, three times the absolute deviation of the median was used as the outlier criterion, a moving average window with a length of three sampling points was used for smoothing filtering, and linear interpolation resampling was performed at 0.3-meter spatial intervals.

[0068] In the dynamic time warping matching process, experiments were conducted with sliding window lengths of 5, 10, 15, and 20 spatial resampling points, respectively. The root mean square error of location, the mean absolute error of location, and the root mean square error of geomagnetism were used as evaluation indicators. The experimental results are shown in the table below: Table 1 Evaluation Indicators

[0069] The experimental results show that when the sliding window length is 5 spatial resampling points, the root mean square error of the position is 0.28 meters, the average absolute error of the position is 0.22 meters, and the root mean square error of the geomagnetic field is 1.66 μT; more than 90% of the positioning errors are less than 0.5 meters, and more than 95% of the positioning errors are less than 1.0 meters.

[0070] To further verify the effectiveness of the joint processing of spatial registration and dynamic time warping, a pure dynamic time warping scheme without the addition of iterative nearest contour point spatial constraints was used as a comparison. The experimental results of the pure dynamic time warping scheme under different spatial window lengths are shown in the table below: Table 2 Experimental results under different spatial window lengths

[0071] The comparison results show that the root mean square error (RMSE) of the position using the pure dynamic time warping scheme at the optimal spatial window length is 1.463 meters, while the RMSE is reduced to 0.28 meters after using iterative nearest contour point spatial registration combined with dynamic time warping. Experimental results demonstrate that the method provided in this embodiment can narrow the search range of dynamic time warping matching by utilizing geomagnetic contour lines and short-term pedestrian trajectory estimation results, and compensate for sequence misalignment caused by changes in walking speed and sampling intervals through dynamic time warping matching, thereby improving the accuracy and trajectory smoothness of indoor geomagnetic continuous positioning.

[0072] The above are all preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Therefore, all equivalent changes made in accordance with the structure, shape and principle of the present invention should be covered within the scope of protection of the present invention.

Claims

1. An indoor geomagnetic positioning method based on spatial registration and dynamic time warping, characterized in that, include: Obtain prior information on the geometric structure of the target indoor passage, segment the acquisition path, and synchronously acquire acceleration and magnetic field data with a unified timestamp along the segmented acquisition path; Based on the acquired prior information on geometric structure and acceleration data, segmented pedestrian trajectories are calculated, and the calculated trajectory points are matched with the corresponding magnetic field data to generate geomagnetic fingerprint points. A spatial index is constructed using geomagnetic fingerprint points. Geomagnetic fingerprint points that meet the spatial proximity condition are merged, and geomagnetic fingerprint points that do not meet the spatial proximity condition are inserted to obtain a geomagnetic fingerprint database. Based on the geomagnetic fingerprint database, a geomagnetic benchmark map is constructed and geomagnetic contour lines are extracted. Candidate search areas are determined by combining real-time short-term pedestrian trajectory estimation results, and a set of candidate points is generated within the candidate search areas. Based on the candidate point set, the trajectory of the real-time pedestrian track is iteratively registered with the nearest contour points to obtain the corrected trajectory and candidate matching sequence. Based on the corrected trajectory and candidate matching sequence, dynamic time warping matching is performed on the real-time geomagnetic observation sequence, and continuous positioning trajectory is generated according to the matching result.

2. The indoor geomagnetic positioning method based on spatial registration and dynamic time warping according to claim 1, characterized in that, The acquisition of acceleration and magnetic field data with a unified timestamp includes obtaining the planar topology of the target indoor passage, the length of each segment, the corner position, and the direction of travel of each segment as prior geometric information. Based on the prior geometric information, the acquisition path is divided into several interconnected straight line segments at the corner position, and adjacent straight line segments are spatially connected through known corner coordinates. Before collecting data along each straight line segment, the acquisition device is calibrated to a static attitude. After calibration, the three-axis acceleration data, three-axis angular velocity data, and three-axis magnetic field data with a unified timestamp are collected synchronously along the corresponding straight line segment at a fixed sampling frequency. The total magnetic field strength is calculated based on the three-axis magnetic field data corresponding to each sampling time.

3. The indoor geomagnetic positioning method based on spatial registration and dynamic time warping according to claim 1, characterized in that, The process of matching the calculated trajectory points with the corresponding magnetic field data includes calculating the composite amplitude of the acceleration data, and sequentially performing bandpass filtering and peak detection on the composite amplitude to obtain the effective number of steps within the corresponding segment. The single-segment distance scaling factor is determined based on the effective number of steps, the preset fixed step length, and the known length of the corresponding segment. Using the single-segment distance scaling factor, the starting coordinates of the corresponding segment, and the travel direction angle, the coordinates of each gait point are assigned to obtain the trajectory points for the segmented pedestrian trajectory calculation. The total magnetic field strength is obtained based on the gait time corresponding to each trajectory point, and a geomagnetic fingerprint point is generated, which includes the horizontal coordinate, vertical coordinate, cumulative walking distance, total magnetic field strength, and initial weight. The coordinate expression of the trajectory point is as follows: , in, , Let x and y be the x and y coordinates of the kth trajectory point, respectively. , These are the x and y coordinates of the starting point of the corresponding segment, respectively. Where is the known length of the corresponding segment, and N is the number of valid steps detected within the corresponding segment. This represents the travel direction angle for the corresponding segment.

4. The indoor geomagnetic positioning method based on spatial registration and dynamic time warping according to claim 1, characterized in that, The process of obtaining the geomagnetic fingerprint database includes constructing a k-dimensional tree spatial index using the two-dimensional spatial coordinates of existing geomagnetic fingerprint points. For newly added geomagnetic fingerprint points, the k-dimensional tree spatial index is used to retrieve the existing geomagnetic fingerprint point that is spatially closest to it. When the spatial distance between the newly added geomagnetic fingerprint point and the existing geomagnetic fingerprint point is less than the preset fusion distance threshold, the magnetic field strength, spatial coordinates and weights are fused according to the cumulative sampling weight; When the spatial distance is greater than or equal to the preset fusion distance threshold, the newly added geomagnetic fingerprint point is inserted into the geomagnetic fingerprint database, and the k-dimensional tree spatial index is updated. The fusion result satisfies the formula: , , in, The magnetic field strength after fusion. The weights of existing geomagnetic fingerprint points, To add weights to the geomagnetic fingerprint points, To determine the magnetic field strength of the newly added geomagnetic fingerprint points, The magnetic field strength of existing geomagnetic fingerprint points, The weights are the weights after merging.

5. The indoor geomagnetic positioning method based on spatial registration and dynamic time warping according to claim 1, characterized in that, The process of determining candidate search areas by combining real-time short-term pedestrian trajectory estimation results includes mapping discrete geomagnetic fingerprint points in the geomagnetic fingerprint database to a preset grid, and interpolating the magnetic field values ​​of each grid node in the preset grid to construct a continuous geomagnetic reference map. Based on real-time magnetic field observations, corresponding geomagnetic contour lines are extracted from continuous geomagnetic reference maps. Short-term pedestrian trajectory is calculated using real-time collected acceleration and angular velocity data to obtain the predicted location at the current positioning time. Candidate search areas are determined with the predicted location as the center and a preset search radius, and repeated geomagnetic feature areas that deviate from the predicted location on the geomagnetic contour lines are excluded.

6. The indoor geomagnetic positioning method based on spatial registration and dynamic time warping according to claim 5, characterized in that, The step of generating a candidate point set within the candidate search area includes using a spatial index to search for the nearest isoline point between the corresponding geomagnetic isoline and the candidate search area; calculating the candidate review value based on geomagnetic feature differences, pedestrian trajectory distance constraints, time continuity constraints, and direction consistency constraints; and selecting several candidate points whose review values ​​meet preset screening conditions to generate a candidate point set. The expression for the candidate review value is: , in, The candidate review value of candidate point s. , , and These are the weighting coefficients for differences in geomagnetic characteristics, distance to the predicted location, temporal continuity, and directional consistency, respectively. The geomagnetic value corresponding to the candidate point. The geomagnetic value is obtained through real-time measurement. The location of the candidate point. For PDR predicted location, The current candidate point position. This represents the position of the matched point from the previous moment. The trajectory direction angle corresponding to the candidate point. For PDR heading angle, The distance is Euclidean.

7. The indoor geomagnetic positioning method based on spatial registration and dynamic time warping according to claim 1, characterized in that, The process of obtaining the corrected trajectory and candidate matching sequence includes determining the real-time pedestrian trajectory as the current trajectory, searching the candidate point set for the nearest contour point corresponding to each trajectory point in the current trajectory, and forming the nearest contour point set. With the goal of minimizing the sum of squared distance errors between the trajectory points after rigid body transformation and the corresponding nearest contour points, the rotation matrix and translation vector are solved, and the current trajectory is updated using the rotation matrix and translation vector until the preset convergence condition is met or the preset maximum number of iterations is reached. The final trajectory is determined as the corrected trajectory, and the corrected trajectory and the corresponding nearest contour points are associated in chronological order to generate a candidate matching sequence.

8. The indoor geomagnetic positioning method based on spatial registration and dynamic time warping according to claim 7, characterized in that, The preset convergence condition includes calculating the trajectory point after the kth iteration relative to the kth iteration. The position residual of the trajectory point after the first iteration is calculated, and the geomagnetic residual between the magnetic field value of the trajectory point in the geomagnetic reference map and the corresponding real-time magnetic field observation value after the k-th iteration is calculated, as well as the trajectory smoothness of the distance between adjacent trajectory points in the trajectory. When the location residual is less than the location residual threshold, the geomagnetic residual is less than the geomagnetic residual threshold, and the trajectory smoothness is less than the trajectory smoothness threshold, the spatial registration of the nearest contour points is determined to be converged. The preset convergence condition satisfies the following formula: , in, Let i be the trajectory point after the k-th iteration. For the kth The i-th trajectory point after 1 iteration, Let be the magnetic field value of the i-th trajectory point in the geomagnetic reference map after the k-th iteration. For the i-th real-time magnetic field observation, The position residual threshold, The threshold value for geomagnetic residuals. This is the trajectory smoothness threshold.

9. The indoor geomagnetic positioning method based on spatial registration and dynamic time warping according to claim 1, characterized in that, The process of generating a continuous positioning trajectory based on the matching results includes calculating the total magnetic field strength based on real-time collected triaxial magnetic field data to form a real-time geomagnetic observation sequence. The median absolute deviation method is used to detect abnormal sampling points in the real-time geomagnetic observation sequence, and the abnormal sampling points are corrected by using adjacent valid sampling points. The corrected real-time geomagnetic observation sequence is then smoothed and filtered. The real-time geomagnetic observation sequence after smoothing and filtering is spatially resampled according to a preset spatial interval. The spatially resampled real-time geomagnetic observation sequence is then standardized and divided into several sliding window sequences that are consecutive in time sequence.

10. The indoor geomagnetic positioning method based on spatial registration and dynamic time warping according to claim 9, characterized in that, The step of generating a continuous positioning trajectory based on the matching results includes, for each sliding window sequence and each candidate matching sequence, calculating the local distance between the local magnetic observation values ​​in the sliding window sequence and the local magnetic reference values ​​in the candidate matching sequence, and constructing a local distance matrix. The cumulative cost matrix is ​​constructed based on the local distance matrix, and a constraint band is applied when constructing the cumulative cost matrix so that the dynamic time warped path is only located within the constraint band; The endpoint value of the cumulative cost matrix is ​​determined as the dynamic time warping distance of the corresponding candidate matching sequence, and the corresponding optimal alignment path is obtained by backtracking from the endpoint of the cumulative cost matrix to the starting point. The candidate localization results are sorted according to the dynamic time warping distance corresponding to each candidate matching sequence, and then weighted and fused according to the reciprocal of the dynamic time warping distance to obtain the fused localization result of the current sliding window sequence.