Douglas-Peucker cutting trajectory compression method based on dynamic threshold

By dynamically calculating the interquartile range of the distance from the trajectory point to the trend line to allocate the distance threshold, it solves the problem of difficulty in threshold setting in the traditional Douglas-Pooker algorithm when the trajectory shape is complex, and achieves more efficient trajectory compression and accuracy retention.

CN118694376APending Publication Date: 2024-09-24FURUI DIGITAL TECH (HANGZHOU) CO LTD
View PDF 0 Cites 6 Cited by

Patent Information

Application Number
CN202410848558.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-27
Publication Date
2024-09-24

AI Technical Summary

Technical Problem

The traditional Douglas-Pook algorithm requires a given global distance threshold during the trajectory compression process, making it difficult to set an appropriate threshold when the trajectory shape is complex, resulting in problems such as lack of accuracy or incomplete simplification.

Method used

A method based on dynamic threshold is adopted, by calculating the interquartile range of the distance from the trajectory point to the trend line, dynamically assigning the distance threshold, and adapting to the trajectory characteristics of different areas for compression based on the allowable error range and data statistical characteristics.

Benefits of technology

Improved compression and precision ensure the richness of resolvable details in simplified results, and improve the robustness and versatility of the algorithm to data sets of different types and sizes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118694376A
    Figure CN118694376A
Patent Text Reader

Abstract

The invention belongs to the technical field of cutting trajectory data point compression simplification, and discloses a Douglas-Peucker cutting trajectory compression method based on a dynamic threshold value, and the method comprises the steps: obtaining a to-be-compressed trajectory point set; selecting a first data point from the to-be-compressed track point set as a starting point, and selecting a last data point as an ending point; recording a straight line determined by the starting point and the ending point as a trend line, traversing the track point set to be compressed, calculating distances from all middle track points except the starting point and the ending point to the trend line, and taking a distance maximum value and a subscript of the track point corresponding to the distance maximum value; determining a distance threshold value corresponding to the track point set to be compressed; and track compression is completed according to the distance threshold value, and a final compressed track point set is obtained. According to the method, the compression rate is improved at the cost of sacrificing relatively low algorithm efficiency, and the precision is also ensured, so that the final simplified result has relatively rich distinguishable details.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of cutting trajectory data point compression and simplification, and in particular relates to a Douglas-Peucker cutting trajectory compression method based on a dynamic threshold. Background Art

[0002] In industrial fields such as die-cutting and cutting, the initial contour must first be fitted with a trajectory to obtain a relatively smooth and smooth trajectory close to the original contour, so as to reduce material loss and improve cutting and die-cutting accuracy in subsequent cutting and die-cutting operations. However, if the trajectory data points are too dense, the cutting process will not only reduce the cutting efficiency due to the need to process a large amount of data, but also cause a loss of cutting accuracy. When the data points are too dense, the tool may move frequently, increasing tool wear and greatly reducing the tool life. Therefore, a reasonable density of data points is extremely important in the cutting process.

[0003] Trajectory simplification refers to the process of simplifying or generalizing lines by eliminating some redundant points on the lines. The Douglas-Peucker algorithm is one of the most widely used methods for vector curve compression and thinning, and is a classic algorithm widely used in two-dimensional data compression and thinning. The Douglas-Peucker algorithm can not only compress and simplify data to reduce the amount of calculation, but also retain the general trend and geometric shape of the trajectory as much as possible. The reason why it is widely used in various industries is that it has the following advantages: translation and rotation invariance; given the trajectory and tolerance, the sampling results are consistent; the algorithm structure is simple and efficient; the operation is simple and intuitive; the programming is simple, and it is suitable for scenes with high speed requirements; for sharply changing and angular trajectories, the compression effect is obvious; it can usually retain the feature points on larger curved shapes, while accurately deleting the fixed points on small curves.

[0004] However, the traditional Douglas-Peucker algorithm requires a global distance threshold for distance judgment. When the trajectory shape is complex and the degree of change in each area of ​​the trajectory is different, setting a suitable global distance threshold requires a lot of attempts, and when iterative compression is performed on different areas of the trajectory, using the same distance threshold may cause a large loss of precision in some trajectories and incomplete simplification of some trajectories. Summary of the invention

[0005] The purpose of the present invention is to provide a Douglas-Peucker cutting trajectory compression method based on dynamic threshold, which improves the compression rate at the cost of sacrificing a small algorithm efficiency, and the accuracy is also guaranteed, so that the final simplified result has richer resolvable details.

[0006] To achieve the above object, the technical solution adopted by the present invention is:

[0007] A Douglas-Peucker cutting trajectory compression method based on a dynamic threshold, the Douglas-Peucker cutting trajectory compression method based on a dynamic threshold comprising:

[0008] S1. Obtain a set of trajectory points to be compressed;

[0009] S2, selecting the first data point from the set of trajectory points to be compressed as the starting point, and selecting the last data point as the ending point;

[0010] S3, record the straight line determined by the starting point and the end point as the trend line, traverse the set of trajectory points to be compressed, calculate the distance from all intermediate trajectory points except the starting point and the end point to the trend line, and take the maximum distance and the subscript of the trajectory point corresponding to the maximum distance;

[0011] S4. Determine the distance threshold corresponding to the trajectory point set to be compressed, as follows:

[0012] S41, sorting the calculated distances from each trajectory point to the trend line in ascending order and storing them in a distance data set;

[0013] S42, calculating the interquartile range iqr of the sorted distance data set;

[0014] S43, read the preset minimum allowable error value epsilon min and the maximum allowable error epsilon max , the calculation equation of the distance threshold epsilon is as follows:

[0015]

[0016] Among them, d max is the maximum distance in this calculation;

[0017] S5. If the maximum distance is less than or equal to the distance threshold, the starting point and the ending point of the trajectory point set to be compressed are taken and stored in the compressed trajectory point set, and the processing of the current trajectory point set to be compressed is completed; if the maximum distance is greater than the distance threshold, the trajectory point set to be compressed is divided into two new trajectory point sets to be compressed according to the subscripts of the trajectory points corresponding to the maximum distance, and each trajectory point set to be compressed returns to execute step S2;

[0018] S6. After all the trajectory point sets to be compressed are processed, a final compressed trajectory point set is obtained.

[0019] Several optional methods are also provided below, but they are not intended to be additional limitations on the above-mentioned overall solution, but are merely further supplements or preferences. Under the premise that there are no technical or logical contradictions, each optional method can be combined with the above-mentioned overall solution separately, and multiple optional methods can also be combined.

[0020] Preferably, when determining the subscript of the trajectory point corresponding to the maximum distance value, if there are multiple identical maximum distance values, the subscript of the trajectory point corresponding to the maximum distance value is taken as the maximum subscript among the trajectory points corresponding to the multiple identical maximum distance values.

[0021] Preferably, the calculating the interquartile range iqr of the sorted distance data set comprises:

[0022] First, find the median of the distance data set;

[0023] The lower quartile iqr_l is obtained by dividing the lower bound of the distance data set by the median;

[0024] The upper quartile iqr_h is obtained by the upper bound of the median and distance data set;

[0025] Then the interquartile range is iqr=iqr_h-iqr_l.

[0026] The present invention provides a Douglas-Peucker cutting trajectory compression method based on dynamic thresholds, which calculates different distance thresholds for different areas of the trajectory to simplify the trajectory, and optimizes and improves the classical method in terms of algorithm accuracy. Compared with the traditional method, the compression rate is improved at the cost of sacrificing a small amount of algorithm efficiency, and the accuracy is also guaranteed, so that the final simplified result has richer distinguishable details. Different from most other improved methods, the improved method of the present invention is based on the traditional classical method, dynamically calculates the threshold according to the error range allowed by the cut trajectory and the statistical characteristics of the data, and inherits most of the advantages of the classical method. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 It is a flow chart of a Douglas-Peucker cutting trajectory compression method based on dynamic threshold of the present invention;

[0028] Figure 2 A schematic diagram of trajectory thinning by the Douglas-Peucker trajectory optimization algorithm of the present invention;

[0029] Figure 3 The simple trajectory original image to be compressed provided by the present invention;

[0030] Figure 4 Figure 1. Possible results of manually setting thresholds for the traditional Douglas-Peucker algorithm for a simple trajectory.

[0031] Figure 5 This is a graph showing the compression and thinning results of the method of the present invention for a simple trajectory;

[0032] Figure 6 The original image of the complex trajectory to be compressed provided by the present invention;

[0033] Figure 7 This is a graph showing the compression and thinning results of the method of the present invention for complex trajectories. DETAILED DESCRIPTION

[0034] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0035] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention herein are only for the purpose of describing specific embodiments and are not intended to limit the present invention.

[0036] In industrial fields such as die-cutting and cutting, the initial contour needs to be fitted first to obtain a relatively smooth and smooth trajectory close to the original contour, so as to reduce material loss and improve cutting precision in subsequent cutting and die-cutting operations. However, if the trajectory data points are too dense, not only will the cutting efficiency be reduced due to the need to process a large amount of data, but also the cutting precision will be lost. Moreover, when the data points are too dense, the tool may move frequently, increase tool wear, and greatly reduce the tool life. Therefore, data points of reasonable density are extremely important in the cutting process. When the traditional Douglas-Peucker algorithm is used to perform thinning and conformal operation on the trajectory, a global distance threshold needs to be specified for compression judgment. The setting of the distance threshold directly affects the shape and smoothness of the final trajectory. If the distance threshold is set too small, the trajectory compression rate is too low, which is not conducive to subsequent cutting operations; if the distance threshold is set too large, the trajectory compression rate is too high, which will cause a part of the trajectory to lose more feature points and the trajectory will be seriously distorted, resulting in a decrease in subsequent cutting precision. Therefore, it is very necessary to set different distance thresholds for different areas of the trajectory for thinning judgment.

[0037] The invention calculates the statistical characteristics of the distance between each point of the track and the line connecting the head and tail points of the track by calculating the error range allowed by the cut track and using the interquartile range of the distance set between each track point and the head and tail points of the track to judge the degree of dispersion of the distance between each intermediate track point and the head and tail trend line in the track segment. If the interquartile range is small, it indicates that the fluctuation of the distance between each intermediate track point of the track segment and the head and tail trend line is small, then a larger distance threshold is calculated for the track segment to filter out the intermediate track points of the track segment; if the interquartile range is large, it indicates that the fluctuation of the distance between each intermediate track point of the track segment and the head and tail trend line is large, then a smaller distance threshold is set for the track segment to further divide the track segment for the next round of iteration, so that more details can be retained.

[0038] Compared with the traditional global threshold, the distance threshold of each segment of the trajectory calculated by the method of the present invention is more consistent with the thinning critical value of the segment of the trajectory. The distance threshold is dynamically allocated by using the interquartile range to judge the degree of fluctuation of the distance between the middle trajectory point of each segment of the trajectory and the head and tail trend lines. This can ensure that suitable simplification results can be obtained on different data sets, and the robustness and versatility of the simplification algorithm can be improved. It can better adapt to data sets of different types and sizes, and can provide reasonable simplification results in various situations. In particular, the present invention has a good compression rate and shape preservation rate in the thinning and compression of a large number of redundant trajectory points.

[0039] like Figure 1 As shown, the specific process of a Douglas-Peucker cutting trajectory compression method based on dynamic threshold is described in detail as follows:

[0040] (1) First, obtain the trajectory point set P1 to be compressed as the processed point set, and prepare a point set container P after compression. result .

[0041] (2) Figure 2 As shown, the first data point is selected from the processed point set as the starting point p f , select the last data point as the end point p l , remember p f and p l are the starting and ending points of the simplified trajectory.

[0042] (3) Prepare the container length. Connect the starting point p f and end point p l , remember the trend line L fl The equation is Ax+By+C=0. Traverse the processed point set and use the distance formula from the point to the line Find the solution to remove the starting point p f and end point p l All intermediate trajectory points Pi (x i ,y i ) to the trend line L fl The distance d i , and store it in the container length, and find the maximum distance d max And the maximum distance d max Corresponding trajectory point P i Among them, A, B, C are constant parameters of the trend line equation, P i Represents the i-th trajectory point in the processed point set. Note: If there are multiple identical maximum distance values ​​d max , then let the subscript index be the last identical data point P i The corresponding subscript.

[0043] (4) Determine the distance threshold corresponding to the processed point set. This embodiment predefines the allowable error range to be [1.0, 5.0].

[0044] (41) First, the distance data in the distance container length from each point to the trend line are sorted in ascending order.

[0045] (42) Calculate the interquartile range iqr of the sorted distance data set. The calculation method of the interquartile range iqr is: 1. First, find the median of the distance data set; 2. Find the lower quartile iqr_l through the lower bound and the median of the data set; 3. Find the upper quartile iqr_h through the median and the upper bound of the data set; 4. The interquartile range iqr = iqr_h-iqr_l.

[0046] (43) Obtain the preset minimum allowable error value epsilon min and the maximum allowable error epsilon max , the calculation equation of the distance threshold epsilon is as follows:

[0047]

[0048] Among them, d max is the maximum distance between the midpoint of this iteration and the first and last trend lines, and iqr is the interquartile range of the data set in the distance container length in this iteration.

[0049] (5) If d max <=epsilon, it means that all the data points in this trajectory are close enough to the trend line L fl , then we only need to change the starting point p of this trajectory f and end point p l Deposit in container P result , and all other intermediate points of the trajectory are deleted.

[0050] If d max >epsilon, the index recorded in step (3) is used as the dividing point of the processed point set, and the processed point set is divided into two parts (the front part point set and the back part point set with index as the dividing point are called P pre and P next , P pre and P next As the new processed point set), then for the point set P after division pre and P next Return to step (2) and continue the recursive process.

[0051] (6) Until the final return value of this round of recursion is obtained, then the point set P pre and P next Merge the sub-results returned recursively into container P result (Note: point set P next The returned sub-results need to be spliced ​​into P pre ), continue to merge the sub-results returned by the previous round of recursion until the final result is obtained.

[0052] (7) The recursion ends and the final compressed trajectory point set P is obtained result .

[0053] like Figure 3 As shown, this is a simple trajectory to be compressed. Figure 4 This is the result of trajectory compression using the traditional Douglas-Peucker algorithm, as shown in Figure 4 As shown in the left figure, when the global threshold is set too small, the trajectory compression rate is too low, and some trajectory points that need to be compressed are still retained; Figure 4 The figure on the right shows the situation where the global threshold is set too large, resulting in excessive trajectory compression and severe trajectory distortion. Figure 5 The schematic diagram of the trajectory compression result after the present invention pre-sets the allowable error range [1.0, 5.0] to dynamically calculate the distance threshold, which not only ensures the approximate trend of the entire trajectory, but also fully compresses the trajectory. The compression effect is significantly better than the traditional Douglas-Peucker algorithm.

[0054] Figure 6 and Figure 7The following are schematic diagrams of the original data point set of a complex trajectory to be compressed and the point set after compression by the present invention. It can be seen that there are a large number of redundant data points in the trajectory to be compressed, and the data points overlap seriously, which is not conducive to direct subsequent operations; while the trajectory after compression by the method of the present invention, after removing a large number of redundant points, still retains the details of the original trajectory, the overall shape of the trajectory after compression has basically not changed, the trajectory is not distorted, and the data compression rate is high, which fully meets the requirements for further processing.

[0055] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0056] The above-mentioned embodiments only express several implementation modes of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the attached claims.

Claims

1. A Douglas-Peucker cutting trajectory compression method based on dynamic threshold, characterized in that: The Douglas-Peucker cutting trajectory compression method based on dynamic threshold comprises: S1. Obtain a set of trajectory points to be compressed; S2, selecting the first data point from the set of trajectory points to be compressed as the starting point, and selecting the last data point as the ending point; S3, record the straight line determined by the starting point and the end point as the trend line, traverse the set of trajectory points to be compressed, calculate the distance from all intermediate trajectory points except the starting point and the end point to the trend line, and take the maximum distance and the subscript of the trajectory point corresponding to the maximum distance; S4. Determine the distance threshold corresponding to the trajectory point set to be compressed, as follows: S41, sorting the calculated distances from each trajectory point to the trend line in ascending order and storing them in a distance data set; S42, calculating the interquartile range iqr of the sorted distance data set; S43, read the preset minimum allowable error value epsilon min and the maximum allowable error epsilon max , the calculation equation of the distance threshold epsilon is as follows: Among them, d max is the maximum distance in this calculation; S5. If the maximum distance is less than or equal to the distance threshold, the starting point and the ending point of the trajectory point set to be compressed are taken and stored in the compressed trajectory point set, and the processing of the current trajectory point set to be compressed is completed; if the maximum distance is greater than the distance threshold, the trajectory point set to be compressed is divided into two new trajectory point sets to be compressed according to the subscripts of the trajectory points corresponding to the maximum distance, and each trajectory point set to be compressed returns to execute step S2; S6. After all the trajectory point sets to be compressed are processed, a final compressed trajectory point set is obtained.

2. The Douglas-Peucker cutting trajectory compression method based on dynamic threshold according to claim 1, characterized in that: When determining the subscript of the trajectory point corresponding to the maximum distance value, if there are multiple identical maximum distance values, the subscript of the trajectory point corresponding to the maximum distance value is taken as the maximum subscript among the trajectory points corresponding to the multiple identical maximum distance values.

3. The Douglas-Peucker cutting trajectory compression method based on dynamic threshold according to claim 1, characterized in that: The step of calculating the interquartile range iqr of the sorted distance data set includes: First, find the median of the distance data set; The lower quartile iqr_l is obtained by dividing the lower bound of the distance data set by the median; The upper quartile iqr_h is obtained by the upper bound of the median and distance data set; Then the interquartile range is iqr=iqr_h-iqr_l.

Citation Information

Cited By

  • Unmanned ship control system and automatic cruise control method

    CN117008609A

  • An unmanned ship control system and automatic cruising control method

    CN117008609B

  • Temperature and humidity big data curve trend chart processing method

    CN120849921A

  • A temperature and humidity big data curve trend chart processing method

    CN120849921B

  • Patrol track adaptive correction processing and multi-parameter constraint simplification method and system

    CN120995082A