A vehicle trajectory simplification method, device, storage medium and electronic equipment
By traversing vehicle trajectory data and extracting key points using distance thresholds and orientation angle features, and combining the Lamer-Douglas-Puk algorithm to simplify vehicle trajectories, the problem of simplifying massive vehicle trajectory data is solved, achieving a reduction in data volume and an improvement in analysis efficiency.
Patent Information
- Application Number
- CN202111182991.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-11
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2041-10-11
AI Technical Summary
Faced with massive amounts of vehicle trajectory data, how can we effectively simplify vehicle trajectories to reduce data volume and improve analysis efficiency?
By acquiring vehicle trajectory data, traversing the data in the order of trajectory points, extracting key points using distance thresholds and direction angle features, retaining vehicle turning or turning points, eliminating redundant data, and using the Lamer-Douglas-Puk algorithm to further simplify the turning array.
It effectively simplifies vehicle trajectory data, retains key points, reduces data volume, improves the efficiency of subsequent analysis and processing, and ensures that the simplified trajectory matches the original trajectory.
Smart Images

Figure CN115964449B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, specifically to a method, apparatus, storage medium, and electronic device for simplifying vehicle trajectories. Background Technology
[0002] With the widespread application of the Global Positioning System (GPS) and the continuous development of smart cities, massive amounts of vehicle trajectory data are accumulating in daily life and being applied to various fields. In the field of smart security, vehicle trajectory data is mainly used for vehicle tracking and driving behavior analysis. However, how to effectively simplify such massive amounts of vehicle trajectory data has become a hot topic of great interest. Summary of the Invention
[0003] To address the existing technical problems, embodiments of this application provide a vehicle trajectory simplification method, apparatus, storage medium, and electronic device, which can effectively simplify vehicle trajectory data.
[0004] To achieve the above objectives, the technical solution of this application embodiment is implemented as follows:
[0005] In a first aspect, embodiments of this application provide a method for simplifying vehicle trajectories, including:
[0006] Acquire vehicle trajectory data; the vehicle trajectory data includes multiple trajectory points;
[0007] According to the order of the trajectory points in the vehicle trajectory data, traverse each trajectory point in the vehicle trajectory data except for the first trajectory point, and after the traversal is completed, use the trajectory points in the target array as the simplified vehicle trajectory data.
[0008] The following operations are performed each time a trajectory point is reached:
[0009] Determine the first distance between the target trajectory point traversed and the last trajectory point in the target array; the first trajectory point in the target array is the first trajectory point in the vehicle trajectory data.
[0010] If the first distance is not less than a set threshold, then a second distance is determined between the target trajectory point and a set straight line; the set straight line is the line connecting the last trajectory point in the target array and the second-to-last trajectory point in the target array; if the second distance is greater than the set threshold, and the target array does not include the trajectory point preceding the target trajectory point, then the trajectory point preceding the target trajectory point is added to the target array; or,
[0011] If the first distance is not less than the set threshold, then the third distance between the target trajectory point and the last trajectory point in the target array, and the fourth distance between the previous trajectory point of the target trajectory point and the last trajectory point in the target array are determined respectively; if the third distance is less than the fourth distance, and the target array does not include the previous trajectory point of the target trajectory point, then the previous trajectory point of the target trajectory point is added to the target array.
[0012] The vehicle trajectory simplification method provided in this application embodiment, after obtaining vehicle trajectory data, can traverse each trajectory point in the vehicle trajectory data except for the first trajectory point according to the order of the trajectory points in the vehicle trajectory data. After the traversal is completed, the trajectory points in the target array are used as the simplified vehicle trajectory data. Specifically, the following operations are performed for each trajectory point traversed: when it is determined that the first distance between the target trajectory point and the last trajectory point in the target array is not less than a set threshold, a second distance can be determined between the target trajectory point and the straight line obtained by connecting the last trajectory point and the second-to-last trajectory point in the target array. If the second distance is greater than the set threshold, and the target array does not include the trajectory point preceding the target trajectory point, then the trajectory point preceding the target trajectory point is added to the target array; or, when it is determined that the first distance between the target trajectory point and the last trajectory point in the target array is not less than the set threshold, a third distance between the target trajectory point and the last trajectory point in the target array, and a fourth distance between the trajectory point preceding the target trajectory point and the last trajectory point can be determined respectively. If the third distance is less than the fourth distance, and the target array does not include the trajectory point preceding the target trajectory point, then the trajectory point preceding the target trajectory point is added to the target array. Since key points in vehicle trajectory data can be extracted based on features such as the distance between trajectory points and the direction angle, the vehicle trajectory data can be effectively simplified. Key points of vehicle turning or turning back in the vehicle trajectory data can be retained, while redundant data can be eliminated, thereby reducing the amount of data for subsequent application and analysis of vehicle trajectory data, and thus improving the efficiency of subsequent data analysis and processing.
[0013] In an optional embodiment, the method further includes:
[0014] If the second distance is greater than the set threshold, and the target array includes the previous trajectory point of the target trajectory point, then the target trajectory point is added to the target array; or,
[0015] If the third distance is less than the fourth distance, and the target array includes the previous trajectory point of the target trajectory point, then the target trajectory point is added to the target array.
[0016] In this embodiment, if the second distance is greater than a set threshold and the target array includes the previous trajectory point of the target trajectory point, then the target trajectory point is added to the target array; or, if the third distance is less than the fourth distance and the target array includes the previous trajectory point of the target trajectory point, then the target trajectory point is added to the target array. Since the previous trajectory point can be added to the target array when the target trajectory point meets the set conditions and the target array does not include the previous trajectory point, and the target trajectory point can be added to the target array when the target trajectory point meets the set conditions and the target array includes the previous trajectory point, this avoids repeatedly adding trajectory points that meet the conditions to the target array, thus improving the simplification effect of simplifying vehicle trajectory data.
[0017] In an optional embodiment, the method further includes:
[0018] If the third distance is less than the fourth distance, then the newly added trajectory point to the target array is marked as a turning point;
[0019] After traversing all trajectory points, the target array is divided into multiple turn-off arrays based on each turn-off point; each turn-off array contains multiple trajectory points.
[0020] Each return array is simplified individually to obtain a simplified return array. The simplified return arrays are then merged to obtain the simplified target array.
[0021] In this embodiment, if the third distance is less than the fourth distance, the newly added trajectory point to the target array is marked as a turnaround point. After traversing all trajectory points, the target array can be divided into multiple turnaround arrays based on each turnaround point. Each turnaround array is then simplified to obtain a simplified turnaround array. Finally, the simplified turnaround arrays are merged to obtain the simplified target array. This further simplifies the simplified vehicle trajectory data and improves the simplification effect.
[0022] In one optional embodiment, dividing the target array into multiple turnaround arrays according to each turnaround point includes:
[0023] The trajectory points between every two turn points in the target array, together with the next turn point in every pair of turn points, form a turn-off array.
[0024] In this embodiment, the trajectory points between every two turnaround points in the target array, along with the next turnaround point in each pair, can be considered as a turnaround array. This allows the target array to be segmented based on the determined turnaround points, resulting in multiple turnaround arrays. Furthermore, the trajectory points included in each turnaround array can be simplified, improving the efficiency and effectiveness of simplification of vehicle trajectory data.
[0025] In one optional embodiment, the simplification of each turnaround array to obtain each simplified turnaround array includes:
[0026] For each loopback array, perform the following operations:
[0027] Retain the first and last trajectory points in the reversal array, and connect the first and last trajectory points to obtain a line segment;
[0028] Determine the trajectory point that is farthest from the line segment between the first trajectory point and the last trajectory point, and determine the distance between the trajectory point and the line segment. If the distance is greater than a first distance threshold, retain the trajectory point; otherwise, remove all trajectory points between the first trajectory point and the last trajectory point.
[0029] If the trajectory point is retained, then the trajectory point is connected to the first trajectory point and the last trajectory point respectively to obtain the corresponding line segment. The process of determining the trajectory point farthest from the line segment and determining the distance between the trajectory point and the line segment is repeated. If the distance is greater than the first distance threshold, the trajectory point is retained; otherwise, all trajectory points between the connected trajectory points are removed until there are no trajectory points between the two connected trajectory points.
[0030] Based on all the retained trajectory points and the first and last trajectory points in the reversal array, a simplified reversal array is obtained.
[0031] In this embodiment, for each loop array, the first and last trajectory points in the loop array are retained, and a line is drawn between them to obtain a line segment. After determining the trajectory point farthest from the first and last trajectory points from the line segment, the distance between this trajectory point and the line segment is also determined. If this distance is greater than a first distance threshold, the trajectory point is retained; otherwise, all trajectory points between the first and last trajectory points are discarded. Furthermore, if the trajectory point is retained, it is drawn between the first and last trajectory points respectively to obtain the corresponding line segment. The process of determining the trajectory point farthest from the line segment and the distance between the trajectory point and the line segment is repeated. If the distance is greater than the first distance threshold, the trajectory point is retained; otherwise, all trajectory points between the connected trajectory points are discarded, until there are no trajectory points between the two connected trajectory points. Finally, based on all retained trajectory points and the first and last trajectory points in the loop array, a simplified loop array can be obtained. This allows for simplification of the trajectory points contained in each turnaround array, further simplifying the intermediate points of long-distance, small-angle changes in vehicle trajectory data and improving the simplification effect.
[0032] In an optional embodiment, the method further includes:
[0033] If the first distance is not less than the set threshold, and there is only one trajectory point in the target array, and the target array does not include the previous trajectory point of the target trajectory point, then the previous trajectory point of the target trajectory point is added to the target array; or
[0034] If the first distance is not less than the set threshold, and there is only one trajectory point in the target array, and the target array includes the previous trajectory point of the target trajectory point, then the target trajectory point is added to the target array.
[0035] In this embodiment, when the first distance is not less than a set threshold, and there is only one trajectory point in the target array, and the target array does not contain a previous trajectory point, the previous trajectory point of the target trajectory point can be added to the target array. When the first distance is not less than the set threshold, and there is only one trajectory point in the target array, and the target array includes a previous trajectory point of the target trajectory point, the target trajectory point can be added to the target array. Since the decision to remove a target trajectory point can be determined based on whether the distance between the traversed target trajectory point and the last trajectory point in the target array is greater than the set threshold, and when the distance is less than the set threshold, the target trajectory point is removed; when the distance is greater than the set threshold, the target trajectory point or its previous trajectory point can be added to the target array, key points in the vehicle trajectory data can be extracted, improving the simplification effect of the vehicle trajectory data.
[0036] Secondly, embodiments of this application also provide a vehicle trajectory simplification device, comprising:
[0037] A trajectory data acquisition unit is used to acquire vehicle trajectory data; the vehicle trajectory data includes multiple trajectory points;
[0038] The trajectory data simplification unit is used to traverse each trajectory point in the vehicle trajectory data (excluding the first trajectory point) according to the order of the trajectory points in the vehicle trajectory data, and after the traversal is completed, use the trajectory points in the target array as the simplified vehicle trajectory data; wherein, for each trajectory point traversed, the following operations are performed: determining a first distance between the traversed target trajectory point and the last trajectory point in the target array; the first trajectory point in the target array is the first trajectory point in the vehicle trajectory data; if the first distance is not less than a set threshold, then determining a second distance between the target trajectory point and a set straight line; the set straight line is the distance between the last trajectory point in the target array and the reciprocal of the target array. The connection between the second trajectory points; if the second distance is greater than the set threshold, and the target array does not include the previous trajectory point of the target trajectory point, then the previous trajectory point of the target trajectory point is added to the target array; or, if the first distance is not less than the set threshold, then the third distance between the target trajectory point and the last trajectory point in the target array, and the fourth distance between the previous trajectory point of the target trajectory point and the last trajectory point in the target array are determined respectively; if the third distance is less than the fourth distance, and the target array does not include the previous trajectory point of the target trajectory point, then the previous trajectory point of the target trajectory point is added to the target array.
[0039] In an optional embodiment, the trajectory data simplification unit is further configured to:
[0040] If the second distance is greater than the set threshold, and the target array includes the previous trajectory point of the target trajectory point, then the target trajectory point is added to the target array; or,
[0041] If the third distance is less than the fourth distance, and the target array includes the previous trajectory point of the target trajectory point, then the target trajectory point is added to the target array.
[0042] In an optional embodiment, the trajectory data simplification unit is further configured to:
[0043] If the third distance is less than the fourth distance, then the newly added trajectory point to the target array is marked as a turning point;
[0044] After traversing all trajectory points, the target array is divided into multiple turn-off arrays based on each turn-off point; each turn-off array contains multiple trajectory points.
[0045] Each return array is simplified individually to obtain a simplified return array. The simplified return arrays are then merged to obtain the simplified target array.
[0046] In an optional embodiment, the trajectory data simplification unit is further configured to:
[0047] The trajectory points between every two turn points in the target array, together with the next turn point in every pair of turn points, form a turn-off array.
[0048] In an optional embodiment, the trajectory data simplification unit is further configured to:
[0049] For each loopback array, perform the following operations:
[0050] Retain the first and last trajectory points in the reversal array, and connect the first and last trajectory points to obtain a line segment;
[0051] Determine the trajectory point that is farthest from the line segment between the first trajectory point and the last trajectory point, and determine the distance between the trajectory point and the line segment. If the distance is greater than a first distance threshold, retain the trajectory point; otherwise, remove all trajectory points between the first trajectory point and the last trajectory point.
[0052] If the trajectory point is retained, then the trajectory point is connected to the first trajectory point and the last trajectory point respectively to obtain the corresponding line segment. The process of determining the trajectory point farthest from the line segment and determining the distance between the trajectory point and the line segment is repeated. If the distance is greater than the first distance threshold, the trajectory point is retained; otherwise, all trajectory points between the connected trajectory points are removed until there are no trajectory points between the two connected trajectory points.
[0053] Based on all the retained trajectory points and the first and last trajectory points in the reversal array, a simplified reversal array is obtained.
[0054] In an optional embodiment, the trajectory data simplification unit is further configured to:
[0055] If the first distance is not less than the set threshold, and there is only one trajectory point in the target array, and the target array does not include the previous trajectory point of the target trajectory point, then the previous trajectory point of the target trajectory point is added to the target array; or
[0056] If the first distance is not less than the set threshold, and there is only one trajectory point in the target array, and the target array includes the previous trajectory point of the target trajectory point, then the target trajectory point is added to the target array.
[0057] Thirdly, embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program that can run on the processor, and when the computer program is executed by the processor, the processor enables the processor to implement the vehicle trajectory simplification method of the first aspect described above.
[0058] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the vehicle trajectory simplification method of the first aspect described above.
[0059] The technical effects of any of the implementation methods in the second, third, or fourth aspects can be found in the technical effects of the implementation method in the first aspect, and will not be repeated here. Attached Figure Description
[0060] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0061] Figure 1a A flowchart illustrating a vehicle trajectory simplification method provided in an embodiment of this application;
[0062] Figure 1b A flowchart illustrating another vehicle trajectory simplification method provided in this application embodiment;
[0063] Figure 2 A flowchart illustrating another vehicle trajectory simplification method provided in this application embodiment;
[0064] Figure 3 This is a schematic diagram of vehicle trajectory data provided in an embodiment of this application;
[0065] Figure 4 A schematic diagram of another type of vehicle trajectory data provided in an embodiment of this application;
[0066] Figure 5 A schematic diagram of a return array provided in an embodiment of this application;
[0067] Figure 6 A simplified diagram of a return array provided in an embodiment of this application;
[0068] Figure 7 A simplified line graph comparing the number of trajectory points is provided in this application embodiment;
[0069] Figure 8 A line graph providing a simplified comparison of vehicle trajectory data latency, as provided in this application embodiment;
[0070] Figure 9a A simplified vehicle trajectory diagram provided for an embodiment of this application;
[0071] Figure 9b A schematic diagram illustrating another simplified vehicle trajectory provided in this application embodiment;
[0072] Figure 9c A schematic diagram illustrating another simplified vehicle trajectory provided in this application embodiment;
[0073] Figure 10 This is a schematic diagram of the structure of a vehicle trajectory simplification device provided in an embodiment of this application;
[0074] Figure 11 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0075] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0076] It should be noted that the terms "first," "second," etc., used in this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in a sequence other than that illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0077] The present application will now be described in further detail with reference to the accompanying drawings and specific embodiments.
[0078] The term "exemplary" as used below means "serving as an example, embodiment, or illustration." Any embodiment illustrated as "exemplary" is not necessarily to be construed as superior to or better than other embodiments. In the description of embodiments of this application, unless otherwise stated, "a plurality of" means two or more.
[0079] This application provides a method for simplifying vehicle trajectories, such as... Figure 1a As shown, it includes the following steps:
[0080] Step S101: Obtain vehicle trajectory data.
[0081] The vehicle trajectory data may include multiple trajectory points.
[0082] In this embodiment, the acquired vehicle trajectory data can be the positioning trajectory information actively emitted by the vehicle itself, or the trajectory data identified and collected based on monitoring networks such as traffic, Skynet, and smart cities.
[0083] Step S102: According to the order of the trajectory points in the vehicle trajectory data, traverse each trajectory point in the vehicle trajectory data except for the first trajectory point. After the traversal is completed, use the trajectory points in the target array as the simplified vehicle trajectory data.
[0084] In step S102, each trajectory point in the vehicle trajectory data except for the first trajectory point can be traversed according to the order of the trajectory points in the vehicle trajectory data, and after the traversal is completed, the trajectory points in the target array are used as the simplified vehicle trajectory data.
[0085] In this process, each time a trajectory point is traversed, it can be done according to... Figure 1b The procedure shown performs the operation. For example... Figure 1b As shown, it may include the following steps:
[0086] Step S1021: Determine the first distance between the traversed target trajectory point and the last trajectory point in the target array.
[0087] The first trajectory point in the target array is the first trajectory point in the vehicle trajectory data.
[0088] Furthermore, it can be determined whether the first distance is less than a set threshold. If the first distance is not less than the set threshold, it can be determined whether the target trajectory point meets one of the following two conditions:
[0089] Step S10221: If the first distance is not less than a set threshold, then determine the second distance between the target trajectory point and the set straight line.
[0090] Condition 1: When the first distance is not less than the set threshold, determine the second distance between the target trajectory point and the set straight line.
[0091] Here, the straight line is defined as the line connecting the last trajectory point in the target array and the second-to-last trajectory point in the target array.
[0092] Step S10231: If the second distance is greater than the set threshold and the target array does not include the previous trajectory point of the target trajectory point, then add the previous trajectory point of the target trajectory point to the target array.
[0093] Step S10222: If the first distance is not less than the set threshold, then determine the third distance between the target trajectory point and the last trajectory point in the target array, and the fourth distance between the previous trajectory point of the target trajectory point and the last trajectory point in the target array.
[0094] Condition 2: When the first distance is not less than the set threshold, the third distance between the target trajectory point and the last trajectory point in the target array, and the fourth distance between the previous trajectory point of the target trajectory point and the last trajectory point in the target array can be determined respectively.
[0095] Step S10232: If the third distance is less than the fourth distance, and the target array does not include the previous trajectory point of the target trajectory point, then add the previous trajectory point of the target trajectory point to the target array.
[0096] In one embodiment, when the second distance between the target trajectory point and the set straight line is greater than a set threshold, and the target array includes the previous trajectory point of the target trajectory point, the target trajectory point can be added to the target array; when the third distance between the target trajectory point and the last trajectory point in the target array is less than the fourth distance between the previous trajectory point of the target trajectory point and the last trajectory point in the target array, and the target array includes the previous trajectory point of the target trajectory point, the target trajectory point can be added to the target array.
[0097] Furthermore, when the third distance between the target trajectory point and the last trajectory point in the target array is determined to be less than the fourth distance between the preceding trajectory point and the last trajectory point in the target array, the newly added trajectory point to the target array can be marked as a turning point. After traversing all trajectory points, the target array can be divided into multiple turning arrays based on each turning point. That is, the trajectory points between every two turning points in the target array, and the next turning point in every two turning points, can be considered as a turning array. Each turning array includes multiple trajectory points.
[0098] After obtaining multiple return arrays, each return array can be simplified separately to obtain a simplified return array. Then, the simplified return arrays can be merged to obtain the simplified target array.
[0099] Specifically, for each loopback array, the following operations can be performed:
[0100] Keep the first and last trajectory points in the turnaround array, and connect the first and last trajectory points to obtain a line segment;
[0101] Determine the trajectory point that is farthest from the line segment between the first and last trajectory points, and determine the distance between the trajectory point and the line segment. If the distance is greater than the first distance threshold, retain the trajectory point; otherwise, remove all trajectory points between the first and last trajectory points.
[0102] If a trajectory point is retained, then the trajectory point is connected to the first trajectory point and the last trajectory point respectively to obtain the corresponding line segment. The process of determining the trajectory point farthest from the line segment and determining the distance between the trajectory point and the line segment is repeated. If the distance is greater than the first distance threshold, the trajectory point is retained; otherwise, all trajectory points between the trajectory points to be connected are removed until there are no trajectory points between the two trajectory points to be connected.
[0103] Based on all the retained trajectory points and the first and last trajectory points in the turnaround array, a simplified turnaround array is obtained.
[0104] The vehicle trajectory simplification method in this application acquires vehicle trajectory data uploaded by the vehicle terminal and collected by monitoring equipment. Based on the distance between trajectory points, direction angle, and other key features, it extracts key points and feature points from the vehicle trajectory data, simplifying the data by retaining turnaround points and turning points where vehicles make U-turns or travel short distances, while removing a large amount of intermediate trajectory data from long, straight-line trajectories. This simplifies the number of trajectory points in massive amounts of vehicle trajectory data, retaining key turnaround points and filtering out meaningless trajectory points, ensuring the basic outline of the vehicle trajectory. The simplified vehicle trajectory closely matches the original trajectory, and this degree of similarity can be controlled by setting a distance threshold, reducing the amount of data required for subsequent application analysis, improving the backend big data analysis capabilities, and enhancing the efficiency of frontend visualization.
[0105] In some embodiments, the vehicle trajectory simplification method in this application can also be based on... Figure 2 The process shown is implemented.
[0106] like Figure 2 As shown, it may include the following steps:
[0107] Step S201: Obtain vehicle trajectory data.
[0108] The vehicle trajectory data can be location trajectory information obtained through a positioning device installed in the vehicle, or vehicle trajectory data collected by monitoring equipment. Furthermore, the vehicle trajectory data can include multiple trajectory points.
[0109] Step S202: Add the first trajectory point in the vehicle trajectory data to the target array and use it as the first trajectory point in the target array.
[0110] The target array stores simplified vehicle trajectory data. Furthermore, the first trajectory point in the vehicle trajectory data can be directly stored as the first trajectory point in the target array.
[0111] Step S203: According to the order of the trajectory points in the trajectory data, traverse each trajectory point in the vehicle trajectory data except for the first trajectory point. For each target trajectory point traversed, determine the first distance between the target trajectory point and the last trajectory point in the target array.
[0112] Step S204: Determine whether the first distance is greater than the set threshold; if not, proceed to step S205; if yes, proceed to step S206.
[0113] Step S205: Traverse the next target trajectory point.
[0114] Step S206: Determine whether there is only one trajectory point in the target array; if not, proceed to step S207; if yes, proceed to step S209.
[0115] Step S207: Determine the second distance between the target trajectory point and the set straight line obtained by connecting the last trajectory point and the second-to-last trajectory point in the target array, the third distance between the target trajectory point and the last trajectory point in the target array, and the fourth distance between the previous trajectory point of the target trajectory point and the last trajectory point in the target array.
[0116] When the first distance between the target trajectory point and the last trajectory point in the target array is greater than a set threshold, and the target array contains more than one trajectory point, the second distance between the target trajectory point and the set straight line obtained by connecting the last trajectory point and the second-to-last trajectory point in the target array, the third distance between the target trajectory point and the last trajectory point in the target array, and the fourth distance between the previous trajectory point of the target trajectory point and the last trajectory point in the target array can be determined respectively.
[0117] in, Figure 3 This diagram illustrates the second distance between a target trajectory point and a predetermined straight line drawn by connecting the last trajectory point and the second-to-last trajectory point in the target array. (See diagram for example.) Figure 3 As shown, the target trajectory point is trajectory point Ot, the last trajectory point is trajectory point T1, the second to last trajectory point is trajectory point T2, and the set line obtained by connecting the last trajectory point and the second to last trajectory point is the set line L obtained by connecting trajectory point T1 and trajectory point T2. Then, the distance d2 between trajectory point Ot and line L is the second distance between the target trajectory point and the set line obtained by connecting the last trajectory point and the second to last trajectory point in the target array.
[0118] Figure 4 This diagram illustrates the determination of the third distance between the target trajectory point and the last trajectory point in the target array, and the fourth distance between the preceding trajectory point and the last trajectory point in the target array. (See diagram for example.) Figure 4 As shown, the target trajectory is trajectory point Ot, the previous trajectory point is trajectory point Ot-1, and the last trajectory point is trajectory point T1. Then, the distance d3 between trajectory point Ot and trajectory point T1 is the third distance between the target trajectory point and the last trajectory point in the target array, and the distance d4 between trajectory point Ot-1 and trajectory point T1 is the fourth distance between the previous trajectory point of the target trajectory point and the last trajectory point in the target array.
[0119] Step S208: Determine whether the second distance is greater than the set threshold or whether the third distance is less than the fourth distance; if not, proceed to step S205; if yes, proceed to step S209.
[0120] Step S209: Determine whether the target array includes the previous trajectory point of the target trajectory point; if not, proceed to step S210; if yes, proceed to step S211.
[0121] Step S210: Add the previous trajectory point of the target trajectory point to the target array.
[0122] Step S211: Add the target trajectory points to the target array.
[0123] When the second distance is determined to be no greater than the set threshold, the next target trajectory point in the vehicle trajectory data can be traversed. Similarly, when the third distance is determined to be no less than the fourth distance, the next target trajectory point in the vehicle trajectory data can be traversed.
[0124] When it is determined that the second distance is greater than the set threshold or the third distance is less than the fourth distance, and the target array does not contain the previous trajectory point of the target trajectory point, the previous trajectory point of the target trajectory point can be added to the target array and added to the end of the target array.
[0125] When it is determined that the second distance is greater than the set threshold or the third distance is less than the fourth distance, and the target array includes the previous trajectory point of the target trajectory point, the target trajectory point can be added to the target array and added to the end of the target array.
[0126] Furthermore, if it is determined that there is only one trajectory point in the target array, it can be determined whether the trajectory point included in the target array is the previous trajectory point of the target trajectory point. If the trajectory point is the previous trajectory point of the target trajectory point, the target trajectory point can be added to the target array. If the trajectory point is not the previous trajectory point of the target trajectory point, the previous trajectory point of the target trajectory point can be added to the target array.
[0127] Step S212: If the third distance is less than the fourth distance, mark the newly added trajectory point in the target array as the turning point.
[0128] Step S213: After traversing all trajectory points, the target array is divided into multiple turn-off arrays according to each turn-off point.
[0129] After traversing all trajectory points, the trajectory points between every two turn points in the target array, along with the next turn point in every pair of turn points, can be combined into a turn array.
[0130] Step S214: Simplify each return array to obtain each simplified return array.
[0131] After dividing the target array into multiple return arrays, the Ramer–Douglas–Peucker algorithm can be used to simplify each return array separately, resulting in each simplified return array.
[0132] Specifically, for each loopback array, perform the following operations:
[0133] Keep the first and last trajectory points in the turnaround array, and connect the first and last trajectory points to obtain a line segment;
[0134] Determine the trajectory point that is farthest from the line segment between the first and last trajectory points, and determine the distance between the trajectory point and the line segment. If the distance is greater than the first distance threshold, retain the trajectory point; otherwise, remove all trajectory points between the first and last trajectory points.
[0135] If a trajectory point is retained, then the trajectory point is connected to the first trajectory point and the last trajectory point respectively to obtain the corresponding line segment. The process of determining the trajectory point farthest from the line segment and determining the distance between the trajectory point and the line segment is repeated. If the distance is greater than the first distance threshold, the trajectory point is retained; otherwise, all trajectory points between the trajectory points to be connected are removed until there are no trajectory points between the two trajectory points to be connected.
[0136] Based on all the retained trajectory points and the first and last trajectory points in the turnaround array, a simplified turnaround array is obtained.
[0137] For example, Figure 5 For example, the trajectory points contained in a loop array. Figure 5 As shown, the turnaround array contains 8 trajectory points: P1, P2, P3, P4, P5, P6, P7, and P8. The following operations can be performed on this turnaround array:
[0138] First, trajectory points P1 and P8 are retained trajectory points, and a line segment L1 is obtained by connecting trajectory points P1 and P8. Among the remaining trajectory points between trajectory points P1 and P8, namely trajectory points P2, P3, P4, P5, P6 and P7, the trajectory point farthest from line segment L1 is found, which can be identified as trajectory point P3. The distance d1 between trajectory point P3 and line segment L1 is determined. Assuming that d1 is greater than the first distance threshold, trajectory point P3 is also a retained trajectory point.
[0139] Then, connect trajectory points P1 and P3 to obtain line segment L2, and connect trajectory points P3 and P8 to obtain line segment L3. Among the remaining trajectory points between trajectory points P1 and P3, find the trajectory point farthest from line segment L2. This trajectory point is identified as trajectory point P2, and the distance d2 between trajectory point P2 and line segment L2 is determined. If d2 is less than the first distance threshold, trajectory point P2 can be removed. Among the remaining trajectory points between trajectory points P3 and P8, i.e., trajectory points P4, P5, P6, and P7, find the trajectory point farthest from line segment L3. This trajectory point is identified as trajectory point P5, and the distance d3 between trajectory point P5 and line segment L3 is determined. If d3 is greater than the first distance threshold, trajectory point P5 is also retained.
[0140] Continuing, we can connect trajectory points P3 and P5 to obtain line segment L4, and connect trajectory points P5 and P8 to obtain line segment L5. Among the remaining trajectory points between trajectory points P3 and P5, we find the trajectory point farthest from line segment L4, which is trajectory point P4. We then determine the distance d4 between trajectory point P4 and line segment L4. If d4 is less than the first distance threshold, trajectory point P4 can be removed. Among the remaining trajectory points between trajectory points P5 and P8, i.e., trajectory points P6 and P7, we find the trajectory point farthest from line segment L5, which is trajectory point P7. We then determine the distance d5 between trajectory point P7 and line segment L5. If d5 is greater than the first distance threshold, trajectory point P7 is also retained.
[0141] Continuing, we can connect trajectory points P5 and P7 to obtain line segment L6. Among the remaining trajectory points between trajectory points P5 and P7, we can find the trajectory point that is farthest from line segment L6. This trajectory point is trajectory point P6. We can also determine the distance d6 between trajectory point P6 and line segment L6. If d6 is less than the first distance threshold, then trajectory point P6 can be eliminated.
[0142] Finally, the trajectory points P1, P3, P5, P7, and P8 are retained in the return array. The simplified return array can then be obtained as follows: Figure 6 As shown.
[0143] Step S215: Merge each simplified return array to obtain the simplified target array.
[0144] After obtaining multiple simplified return arrays, these simplified return arrays can be merged sequentially to obtain the simplified target array. This simplified target array is the final output result of simplifying the vehicle trajectory data.
[0145] In one embodiment, the vehicle trajectory simplification method proposed in this application can be compared with the standard Ramer–Douglas–Peucker algorithm on sample data, which consists of 10 sets of vehicle trajectory data with more than 100,000 points selected. When the distance thresholds are the same, the comparison results are shown in Table 1.
[0146]
[0147] Furthermore, it is possible to obtain, at the same time, such as Figure 7 The simplified line chart showing the comparison of point counts, and as shown... Figure 8 The line graph showing the time consumption comparison is shown in Table 1. Figure 7 As can be seen from Table 1, the vehicle trajectory simplification method proposed in this application and the standard Ramer–Douglas–Peucker algorithm, after testing on the same sample data, yield a similar number of simplified points. Figure 8 It can be seen that the vehicle trajectory simplification method proposed in this application has significantly reduced the time consumption compared with the standard Ramer–Douglas–Peucker algorithm after testing on the same sample data. Moreover, the time consumption of this method is reduced by 28% compared with the Ramer–Douglas–Peucker algorithm, and the efficiency is significantly improved.
[0148] Figure 9a , Figure 9b and Figure 9c The images show the simplified paths obtained using this method and the standard Ramer–Douglas–Peucker algorithm, as well as the extracted original paths. Figure 9b for Figure 9a The enlarged display area of the circled part in the image. Figure 9c for Figure 9c The enlarged display area of the circled portion. And in Figure 9a , Figure 9b and Figure 9c In the diagram, the solid line represents the original path, the short dashed line represents the simplified path obtained using the standard Ramer–Douglas–Peucker algorithm, and the long dashed line represents the simplified path obtained using this method. Figure 9a , Figure 9b and Figure 9c As can be seen, the simplified path obtained by this method displays the outline of the original path to a level comparable to that obtained by the standard Ramer–Douglas–Peucker algorithm.
[0149] The test results show that, compared with the standard Ramer–Douglas–Peucker algorithm, the simplification effect of this method on vehicle trajectory data is comparable, but the time consumption is greatly reduced. Therefore, the simplification effect of this method is better, the simplification efficiency is significantly improved, and the advantages are obvious.
[0150] and Figure 1a The vehicle trajectory simplification method shown is based on the same inventive concept. This application also provides a vehicle trajectory simplification device. Since this device corresponds to the vehicle trajectory simplification method of this application, and the principle by which this device solves the problem is similar to that of the method, the implementation of this device can refer to the implementation of the above method; repeated details will not be elaborated further.
[0151] Figure 10 A schematic diagram of a vehicle trajectory simplification device provided in an embodiment of this application is shown, as follows: Figure 10 As shown, the vehicle trajectory simplification device includes a trajectory data acquisition unit 1001 and a trajectory data simplification unit 1002.
[0152] The trajectory data acquisition unit 1001 is used to acquire vehicle trajectory data; the vehicle trajectory data includes multiple trajectory points.
[0153] The trajectory data simplification unit 1002 is used to traverse each trajectory point in the vehicle trajectory data except for the first trajectory point, according to the order of the trajectory points in the vehicle trajectory data. After the traversal is completed, the trajectory points in the target array are used as the simplified vehicle trajectory data. Specifically, for each trajectory point traversed, the following operations are performed: determining the first distance between the traversed target trajectory point and the last trajectory point in the target array; the first trajectory point in the target array is the first trajectory point in the vehicle trajectory data; if the first distance is not less than a set threshold, determining the second distance between the target trajectory point and a set straight line; the set straight line is the last trajectory point in the target array. The line connecting the trace point to the second-to-last trace point in the target array is used. If the second distance is greater than a set threshold and the target array does not include the trace point preceding the target trace point, then the trace point preceding the target trace point is added to the target array. Alternatively, if the first distance is not less than a set threshold, then the third distance between the target trace point and the last trace point in the target array, and the fourth distance between the trace point preceding the target trace point and the last trace point in the target array are determined respectively. If the third distance is less than the fourth distance and the target array does not include the trace point preceding the target trace point, then the trace point preceding the target trace point is added to the target array.
[0154] In an optional embodiment, the trajectory data simplification unit 1002 is further configured to:
[0155] If the second distance is greater than the set threshold, and the target array includes the previous trajectory point of the target trajectory point, then add the target trajectory point to the target array; or,
[0156] If the third distance is less than the fourth distance, and the target array includes the previous trajectory point of the target trajectory point, then add the target trajectory point to the target array.
[0157] In an optional embodiment, the trajectory data simplification unit 1002 is further configured to:
[0158] If the third distance is less than the fourth distance, then mark the newly added trajectory point in the target array as the turning point;
[0159] After traversing all trajectory points, the target array is divided into multiple turn-off arrays based on each turn-off point; each turn-off array contains multiple trajectory points.
[0160] Each return array is simplified individually to obtain a simplified return array. The simplified return arrays are then merged to obtain the simplified target array.
[0161] In an optional embodiment, the trajectory data simplification unit 1002 is further configured to:
[0162] The trajectory points between every two turn points in the target array, along with the next turn point in every pair of turn points, form a turn array.
[0163] In an optional embodiment, the trajectory data simplification unit 1002 is further configured to:
[0164] For each loopback array, perform the following operations:
[0165] Keep the first and last trajectory points in the turnaround array, and connect the first and last trajectory points to obtain a line segment;
[0166] Determine the trajectory point that is farthest from the line segment between the first and last trajectory points, and determine the distance between the trajectory point and the line segment. If the distance is greater than the first distance threshold, retain the trajectory point; otherwise, remove all trajectory points between the first and last trajectory points.
[0167] If a trajectory point is retained, then the trajectory point is connected to the first trajectory point and the last trajectory point respectively to obtain the corresponding line segment. The process of determining the trajectory point farthest from the line segment and determining the distance between the trajectory point and the line segment is repeated. If the distance is greater than the first distance threshold, the trajectory point is retained; otherwise, all trajectory points between the trajectory points to be connected are removed until there are no trajectory points between the two trajectory points to be connected.
[0168] Based on all the retained trajectory points and the first and last trajectory points in the turnaround array, a simplified turnaround array is obtained.
[0169] In an optional embodiment, the trajectory data simplification unit 1002 is further configured to:
[0170] If the first distance is not less than the set threshold, and there is only one trajectory point in the target array, and the target array does not contain the previous trajectory point of the target trajectory point, then add the previous trajectory point of the target trajectory point to the target array; or
[0171] If the first distance is not less than the set threshold, and there is only one trajectory point in the target array, and the target array contains the previous trajectory point of the target trajectory point, then the target trajectory point is added to the target array.
[0172] Based on the same inventive concept as the above-described method embodiments, this application also provides an electronic device. This electronic device can be used to simplify vehicle trajectories. In one embodiment, the electronic device can be a server, a terminal device, or other electronic equipment. In this embodiment, the structure of the electronic device can be as follows... Figure 11 As shown, it includes a memory 1101, a communication module 1103, and one or more processors 1102.
[0173] The memory 1101 is used to store computer programs executed by the processor 1102. The memory 1101 may mainly include a program storage area and a data storage area. The program storage area may store the operating system and programs required to run instant messaging functions, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.
[0174] Memory 1101 may be volatile memory, such as random-access memory (RAM); memory 1101 may also be non-volatile memory, such as read-only memory, flash memory, hard disk drive (HDD), or solid-state drive (SSD); or memory 1101 may be any other medium capable of carrying or storing desired program code having the form of instructions or data structures and accessible by a computer, but is not limited thereto. Memory 1101 may be a combination of the above-described memories.
[0175] The processor 1102 may include one or more central processing units (CPUs) or digital processing units, etc. The processor 1102 is used to implement the aforementioned vehicle trajectory simplification method when it calls the computer program stored in the memory 501.
[0176] The communication module 1103 is used to communicate with terminal devices and other servers.
[0177] This application does not limit the specific connection medium between the memory 1101, the communication module 1103, and the processor 1102 as described above. This disclosure embodiment... Figure 11 The memory 1101 and the processor 1102 are connected via a bus 1104, and the bus 1104 is in Figure 11 The connections between other components are shown in thick lines only and are not intended to be limiting. Bus 1104 can be divided into address bus, data bus, control bus, etc. For ease of illustration, Figure 11 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0178] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the vehicle trajectory simplification method described in the above embodiments.
[0179] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0180] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A vehicle trajectory simplification method, characterized by, The method comprises: acquiring vehicle trajectory data; the vehicle trajectory data comprises a plurality of trajectory points; traversing each trajectory point in the vehicle trajectory data except the first trajectory point according to the order of the trajectory points in the vehicle trajectory data, and taking the trajectory points in a target array as simplified vehicle trajectory data after the traversal ends; wherein, after traversing each trajectory point, the following operations are performed: determining a first distance between the traversed target trajectory point and the last trajectory point in the target array; the first trajectory point in the target array is the first trajectory point in the vehicle trajectory data; if the first distance is not less than a set threshold, determining a second distance between the target trajectory point and a set straight line; the set straight line is a line connecting the last trajectory point in the target array and the second last trajectory point in the target array; if the second distance is greater than the set threshold and the target array does not include the previous trajectory point of the target trajectory point, the previous trajectory point of the target trajectory point is added to the target array; or, if the first distance is not less than the set threshold, respectively determining a third distance between the target trajectory point and the last trajectory point in the target array, and a fourth distance between the previous trajectory point of the target trajectory point and the last trajectory point in the target array; if the third distance is less than the fourth distance and the target array does not include the previous trajectory point of the target trajectory point, the previous trajectory point of the target trajectory point is added to the target array.
2. The method of claim 1, wherein, The method further comprises: if the second distance is greater than the set threshold and the target array includes the previous trajectory point of the target trajectory point, the target trajectory point is added to the target array; or, if the third distance is less than the fourth distance and the target array includes the previous trajectory point of the target trajectory point, the target trajectory point is added to the target array.
3. The method of claim 2, wherein, The method further comprises: if the third distance is less than the fourth distance, marking the trajectory point newly added to the target array as a turnaround point; after traversing all the trajectory points, dividing the target array into a plurality of turnaround arrays according to each turnaround point; each turnaround array comprises a plurality of trajectory points; respectively simplifying each turnaround array to obtain each simplified turnaround array, and merging each simplified turnaround array to obtain a simplified target array.
4. The method of claim 3, wherein, The dividing the target array into a plurality of turnaround arrays according to each turnaround point comprises: taking the trajectory points between each two turnaround points in the target array and the latter one of the two turnaround points as a turnaround array.
5. The method of claim 3, wherein, The respectively simplifying each turnaround array to obtain each simplified turnaround array comprises: for each turnaround array, the following operations are respectively performed: keeping the first trajectory point and the last trajectory point in the turnaround array, and connecting the first trajectory point and the last trajectory point to obtain a line segment; determining a trajectory point farthest from the line segment between the first trajectory point and the last trajectory point, and determining a distance between the trajectory point and the line segment, if the distance is greater than a first distance threshold, retaining the trajectory point, otherwise, eliminating all trajectory points between the first trajectory point and the last trajectory point; if the trajectory point is retained, connecting the trajectory point with the first trajectory point and the last trajectory point respectively to obtain corresponding line segments, and repeating the process of determining a trajectory point farthest from the line segment, and determining a distance between the trajectory point and the line segment, if the distance is greater than the first distance threshold, retaining the trajectory point, otherwise, eliminating all trajectory points between the two trajectory points connected, until there is no trajectory point between the two trajectory points connected; obtaining a simplified turn-around array according to all retained trajectory points, and the first trajectory point and the last trajectory point in the turn-around array.
6. The method according to any one of claims 1 to 5, characterized in that, The method further comprises: if the first distance is not less than the set threshold, and there is only one trajectory point in the target array, and the target array does not include the previous trajectory point of the target trajectory point, adding the previous trajectory point of the target trajectory point to the target array; or if the first distance is not less than the set threshold, and there is only one trajectory point in the target array, and the target array includes the previous trajectory point of the target trajectory point, adding the target trajectory point to the target array.
7. A vehicle trajectory simplification device characterized by comprising: comprise: a trajectory data acquisition unit configured to acquire vehicle trajectory data; the vehicle trajectory data comprises a plurality of trajectory points; The trajectory data simplification unit is configured to traverse each trajectory point in the vehicle trajectory data except the first trajectory point in the order of the trajectory points in the vehicle trajectory data, and to take the trajectory points in the target array as the simplified vehicle trajectory data after the traversal; wherein, when each trajectory point is traversed, the following operations are performed: determining a first distance between the traversed target trajectory point and the last trajectory point in the target array; the first trajectory point in the target array is the first trajectory point in the vehicle trajectory data; if the first distance is not less than a set threshold, determining a second distance between the target trajectory point and a set straight line; the set straight line is a line connecting the last trajectory point in the target array and the second last trajectory point in the target array; if the second distance is greater than the set threshold and the target array does not include the previous trajectory point of the target trajectory point, the previous trajectory point of the target trajectory point is added to the target array; or, if the first distance is not less than the set threshold, respectively determining a third distance between the target trajectory point and the last trajectory point in the target array and a fourth distance between the previous trajectory point of the target trajectory point and the last trajectory point in the target array; if the third distance is less than the fourth distance and the target array does not include the previous trajectory point of the target trajectory point, the previous trajectory point of the target trajectory point is added to the target array.
8. The apparatus of claim 7, wherein, The trajectory data simplification unit is further configured to: if the second distance is greater than the set threshold and the target array includes the previous trajectory point of the target trajectory point, the target trajectory point is added to the target array; or, if the third distance is less than the fourth distance and the target array includes the previous trajectory point of the target trajectory point, the target trajectory point is added to the target array.
9. An electronic device, comprising: A computer readable storage medium stores a computer program, and the computer program is executable on a processor, and when the computer program is executed by the processor, the method in any one of claims 1-6 is implemented.
10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program, and the computer program is executable on a processor, and when the computer program is executed by the processor, the method in any one of claims 1-6 is implemented.
Citation Information
Patent Citations
Rapid track prediction method for large-scale moving object, medium and equipment
CN111291280A
Method, device and equipment for determining key points of vehicle track
CN112885099A