A Contour Line Intelligent Smoothing Method and Apparatus Based on Feature Constraints and Parameter Adaptation
The intelligent contour smoothing method based on feature constraints and parameter adaptation solves the problems of terrain feature distortion and low efficiency in digital topographic map production, and achieves efficient and automated smoothing processing to generate contour data that conforms to cartographic standards.
Patent Information
- Application Number
- CN202610271604.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-06
- Publication Date
- 2026-05-26
AI Technical Summary
In current digital topographic map production, smoothing methods based on pure geometric algorithms lead to distortion of terrain features, while manual interactive methods are inefficient and lack a unified solution for automation and accuracy control.
A contour line intelligent smoothing method based on feature constraints and parameter adaptation is adopted. It intelligently identifies terrain feature points, adaptively calculates the smoothing intensity coefficient, combines the constrained B-spline curve fitting method for smoothing, and ensures accuracy through iterative optimization.
It enables the generation of standardized contour data that is both smooth and aesthetically pleasing while strictly preserving terrain features without human intervention, improving processing efficiency by tens of times and ensuring terrain accuracy and feature precision.
Smart Images

Figure CN122089598A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method and apparatus for intelligent contour smoothing based on feature constraints and parameter adaptation, belonging to the field of geographic information systems and digital map making technology. Background Technology
[0002] In the production of digital topographic maps, the original contour lines extracted from digital elevation models often exhibit a jagged shape due to the limitations of the grid data structure, which does not meet cartographic standards and visual requirements, and must be smoothed.
[0003] Existing smoothing techniques are mainly divided into two categories: one is global smoothing based on pure geometric algorithms, such as B-spline curve fitting and moving average filtering. Although it can improve the aesthetics of the curve, it is easy to cause displacement of key terrain features such as ridge points and valley points, resulting in loss of terrain accuracy. The other is interactive post-processing that relies on human experience. Cartographers manually identify feature points and set parameters in segments, which is inefficient and the results are difficult to standardize.
[0004] While existing research has proposed some accuracy control schemes, such as using control point displacement tolerance or combining terrain feature lines for constraints, there are still significant shortcomings: it fails to organically combine terrain feature protection with adaptive local smoothing intensity within a unified framework; and it lacks a complete system integrating feature recognition, adaptive smoothing, and closed-loop accuracy verification. Therefore, a fully automated solution that can intelligently identify the terrain skeleton, dynamically adjust processing strategies, and ensure high-fidelity results is urgently needed. Summary of the Invention
[0005] To address the aforementioned issues, this invention proposes a contour line intelligent smoothing method and apparatus based on feature constraints and parameter adaptation. This method resolves the contradiction between "automatic smoothing leading to terrain distortion" and "fidelity processing relying on manual intervention," enabling the production of standardized contour line data that is both smooth and aesthetically pleasing while strictly preserving terrain features without human intervention.
[0006] The technical solution adopted by this invention to solve its technical problem is as follows: On the one hand, a contour line intelligent smoothing method based on feature constraints and parameter adaptation is provided, including the following steps: Step S1: Obtain the digital elevation model (DEM) data and its extracted raw contour data, and perform data preprocessing; Step S2: Intelligent identification and fusion of terrain feature points, which include primary feature points and secondary feature points; Step S3: Based on the local terrain parameters traversed by the original contour lines, adaptively calculate the smoothing intensity coefficient α of each contour line or each curve segment, where α∈[0,1]; Step S4: Using the terrain feature points as constraints and the smoothing intensity coefficient α as control parameters, the original contour lines are smoothed using the constrained B-spline curve fitting method to generate smoothed contour lines. Step S5: Perform accuracy compliance verification on the smoothed contour lines. If the error exceeds the preset threshold, locate the error area and reduce the smoothing intensity coefficient α of the area. Return to step S4 for iterative optimization until the error meets the standard or the maximum number of iterations is reached. Step S6: Perform topology checks and repairs on the final smoothed contour lines, and output a smoothed contour line vector file that conforms to cartographic specifications.
[0007] On the other hand, a contour line intelligent smoothing device based on feature constraints and parameter adaptation is provided, including: The data preprocessing module is used to input digital elevation model (DEM) data and its extracted raw contour data, and to perform data preprocessing. The feature point fusion module is used to intelligently identify and fuse terrain feature points, which include primary feature points and secondary feature points. The parameter adaptive calculation module is used to adaptively calculate the smoothing intensity coefficient α of each contour line or each curve segment based on the local terrain parameters crossed by the original contour lines, where α∈[0,1]. The constrained smoothing calculation module is used to perform smoothing calculations on the original contour lines using the terrain feature points as constraints and the smoothing intensity coefficient α as control parameters, and to generate smoothed contour lines by using the constrained B-spline curve fitting method. The iterative optimization module is used to verify the accuracy of the smoothed contour lines. If the error exceeds a preset threshold, the error area is located and the smoothing intensity coefficient α of the area is reduced. Iterative optimization is performed until the error meets the standard or the maximum number of iterations is reached. The output module is used to perform topology checks and repairs on the final smoothed contour lines and output smoothed contour line vector files that conform to cartographic standards.
[0008] Thirdly, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the contour line intelligent smoothing method based on feature constraints and parameter adaptation as described above.
[0009] Fourthly, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the contour line intelligent smoothing method based on feature constraints and parameter adaptation as described above.
[0010] One of the above technical solutions has the following advantages or beneficial effects: 1. High terrain fidelity: By using terrain feature points as smooth hard constraints, distortion of key terrain locations is fundamentally avoided, and the terrain skeleton is accurately preserved; 2. Intelligence and Adaptability: It abandons the global uniform parameters and achieves a "divide and conquer" effect by dynamically adjusting the smoothing intensity according to local terrain undulations; 3. Fully automated accuracy assurance: Through closed-loop control of "processing-verification-adjustment", the accuracy of the results is strictly managed in the automated process to ensure the reliability of the results; 4. High processing efficiency: It achieves fully automated batch and process-oriented processing, which is dozens of times more efficient than traditional manual methods.
[0011] Another technical solution mentioned above has the following advantages or beneficial effects: by adopting a combination of feature point constraints and parameter adaptation, it overcomes the technical problem of terrain distortion caused by traditional smoothing methods, and achieves the technical effect of contour line smoothing while maintaining terrain accuracy. Attached Figure Description
[0012] Figure 1 This is a flowchart illustrating an intelligent contour smoothing method based on feature constraints and parameter adaptation, according to an exemplary embodiment. Figure 2 This is a schematic diagram of the structure of a contour line intelligent smoothing device based on feature constraints and parameter adaptation, according to an exemplary embodiment. Figure 3 This is a detailed flowchart illustrating an automated processing pipeline for intelligent contour smoothing, according to an exemplary embodiment. Figure 4 This is a schematic diagram illustrating feature point recognition and fusion according to an exemplary embodiment; Figure 5 This is a schematic diagram illustrating the calculation of local terrain parameters according to an exemplary embodiment; Figure 6 This is a schematic diagram illustrating an adaptive smoothing parameter spatialization according to an exemplary embodiment; Figure 7 This is a comparison diagram showing the effect of constraint smoothing before and after, according to an exemplary embodiment. Detailed Implementation
[0013] To more clearly illustrate the technical features of the present invention, the present invention will be described in detail below through specific embodiments and in conjunction with the accompanying drawings.
[0014] In this embodiment, the primary feature points refer to the spatial intersections of contour lines and terrain feature lines (ridge lines, valley lines). These are mandatory protection points reflecting the terrain framework, and the smoothing process must strictly pass through these points without any displacement deviation. The secondary feature points refer to key vertices extracted through geometric morphology analysis, including local curvature extrema of the original contour lines (such as hilltops, saddles, and steep slope edges) and core vertices retained after simplification by the Douglas-Puk algorithm. These are important constraint points for maintaining terrain details, and slight displacement (not exceeding 0.3 times the DEM resolution) is allowed during smoothing. The smoothing intensity coefficient α is a dimensionless parameter with a value range of [0,1], used to quantify the strength of the smoothing process. When α=0, no smoothing is performed, and the original contour line shape is completely preserved. When α=1, the strongest smoothing is performed, maximizing the elimination of jagged noise. The value of α is dynamically adjusted according to the terrain slope and roughness to achieve adaptive control. The parameter attenuation zone refers to a local area centered on the feature point (with a radius typically 1-3 times the DEM resolution). Within this area, the smoothing intensity coefficient α linearly increases from its minimum value (approaching 0) at the feature point towards the region boundary to the target value, ensuring a continuous transition of the smoothing effect around the feature point and avoiding abrupt changes in shape. The terrain roughness refers to a parameter characterizing the severity of local terrain undulations, defined as the standard deviation of all elevation values within a specific window (e.g., a 3×3 or 5×5 DEM grid). A larger standard deviation indicates a rougher terrain, and vice versa. The elevation consistency error refers to the difference between the elevation value obtained by back-interpolating points on the smoothed contour lines to the original DEM and the theoretical elevation value of that contour line, used to measure the impact of smoothing on elevation accuracy.
[0015] like Figure 1 As shown in the figure, the intelligent contour smoothing method based on feature constraints and parameter adaptation provided by this invention includes the following steps: Step S1: Obtain the digital elevation model (DEM) data and its extracted raw contour data, and perform data preprocessing.
[0016] Specifically, step S1 includes the following steps: Step S11: Check whether there are topological problems such as self-intersection, breakage, and overlap of the original contour lines. Specifically, the sweep line algorithm is used to detect self-intersection of contour lines; the endpoint matching algorithm is used to detect breakage of contour lines; and the buffer overlay analysis is used to detect overlap of contour lines. Step S12: Unify the DEM data and contour data to the same coordinate system and projection system, specifically: unify the DEM data and contour data to the CGCS2000 coordinate system; unify the DEM data and contour data to the Gauss-Kruger projection system. Step S13: Establish a quadtree index structure and construct a spatial index of contour lines and DEM grid. Specifically, construct a quadtree spatial index based on the DEM data range; divide the contour lines into line segments that match the quadtree nodes; and establish a many-to-many spatial relationship index between contour line segments and DEM grid.
[0017] Step S2: Intelligent identification and fusion of terrain feature points, which include primary feature points and secondary feature points.
[0018] Specifically, step S2 includes the following steps: Step S21: Based on the intersection point identification of terrain feature lines, calculate the spatial intersection points of contour lines with ridge lines and valley lines, and mark them as first-level feature points. The intersection point identification based on terrain feature lines specifically includes: using the terrain curvature method to calculate the profile curvature and planar curvature of the DEM, and using the curvature extreme points to connect the ridge lines and valley lines; or using the hydrological analysis method to calculate the confluence path through the water flow direction to determine the valley lines, and then using terrain inversion to extract the ridge lines; using the spatial overlay analysis algorithm to calculate the spatial intersection points of contour lines with ridge lines and valley lines. Step S22: Based on geometric feature point recognition, extract the curvature extrema points of the original contour lines, and combine them with the key vertices retained after simplification by the Douglas-Puk algorithm, which together serve as secondary feature points. Specifically, the geometric feature point recognition includes: calculating the curvature sequence of the original contour lines, where the curvature calculation formula is: Where x and y are the coordinates of the contour line vertices, and ′ represents the derivative with respect to the arc length; a curvature threshold dynamically determined based on DEM resolution is set to identify local curvature extrema. The dynamic determination method of the curvature threshold is as follows: the threshold base is determined based on the average slope of the terrain, the larger the slope, the larger the threshold base; the threshold adjustment coefficient is determined based on the DEM resolution, the higher the resolution, the smaller the threshold; curvature threshold = threshold base × threshold adjustment coefficient; a simplification tolerance of 0.2 times the DEM resolution is set, and the original contour lines are simplified using the Douglas-Puk algorithm, retaining key vertices; Step S23: Merge the primary and secondary feature point sets, delete redundant points that are too close, and assign weight attributes to the merged feature points to form the final feature point constraint set. The merging of the primary and secondary feature point sets specifically includes: deleting redundant feature points that are less than 1 times the DEM resolution, prioritizing the deletion of vertices simplified by the Douglas-Puk algorithm, and then deleting curvature extrema points; assigning a weight of 1.0 to the primary feature points and a weight of 0.7 to the secondary feature points.
[0019] Step S3: Based on the local terrain parameters traversed by the original contour lines, adaptively calculate the smoothing intensity coefficient α for each contour line or each curve segment, where α∈[0,1].
[0020] Specifically, step S3 includes the following steps: Step S31: Based on the DEM data, calculate the local slope and terrain roughness of the neighborhood or curve segment of each feature point. The calculation of local terrain parameters includes: calculating the local slope using the maximum slope method, with the following formula: ,in, , The slope of the DEM in the x and y directions is given; the terrain roughness is calculated using the standard deviation method, with the following formula: ,in, The elevation value within the window. The average elevation of the window is used; in the process of calculating local terrain parameters, the size of the local window is selected according to the terrain type: for areas with gentle terrain, a 5×5 grid window is used to calculate local terrain parameters; for areas with drastic terrain undulations, a 3×3 grid window is used to calculate local terrain parameters. Step S32, according to the mapping function Calculate the smoothing intensity coefficient α, where To preset the maximum smoothing intensity, For local slope, For terrain roughness, and Here is the adjustment coefficient, where the adjustment coefficient is... and The method for determining the terrain is as follows: experimental areas are selected for four terrain categories: plains, hills, mountains, and high mountains. It varies in steps of 0.1 within the interval [0.1, 10]. The value is varied in increments of 0.1 within the interval [0.1, 5]; a grid search method is used to process each group ( , Apply a smoothing algorithm; evaluate the smoothing results, and select the group that satisfies the condition that the planar displacement does not exceed 1 times the DEM resolution and has the highest feature point preservation rate. , ) as a suggested coefficient for this terrain category; Step S33: Establish a smoothing intensity coefficient sequence for each contour line. Furthermore, a parameter attenuation zone is set near the feature point, so that the α value linearly increases from the minimum value at the feature point to the boundary within the attenuation zone. The parameter attenuation zone is set as follows: with the feature point as the center, an attenuation zone with a radius of 1-3 times the DEM resolution is set; 3 times the DEM resolution is used in areas with gentle terrain, and 1 times the DEM resolution is used in areas with drastic terrain undulations; linear interpolation is used to achieve a continuous transition of the α value within the attenuation zone from approaching 0 at the feature point to the target value at the boundary.
[0021] Step S4: Using the terrain feature points as constraints and the smoothing intensity coefficient α as a control parameter, the original contour lines are smoothed using the constrained B-spline curve fitting method to generate smoothed contour lines.
[0022] Specifically, step S4 includes the following steps: Step S41: Using a cubic B-spline curve as the fitting basis function, embed the feature points as constraints into the fitting equation: Where C(u) is the fitted curve, To control the vertices, The basis functions are cubic B-spline functions. The process of embedding feature points as constraints into the fitting equation is as follows: For first-order feature points, set equality constraints: The fitted curve is forced to pass through this point; for secondary feature points, inequality constraints are set: Where δ = 0.3 times the DEM resolution, allowing for minute displacements; constraint weights Set to 100 × feature point weight coefficient, smooth weight The value is fixed at 10. The basis function Ni,3(u) satisfies the recurrence relation: , ,in, For node vectors, a uniform node distribution is used: ; Step S42, construct the optimization objective function that integrates feature point constraints and smoothing intensity coefficients: ,in, Weights are constrained for feature points. To smooth out the weights, The second derivative of the curve. Let α be the feature point and α be the smoothing intensity coefficient. Step S43: The constraints are incorporated into the objective function using the Lagrange multiplier method, which transforms the function into a system of linear equations. The LU decomposition method is then used to solve the system, resulting in the optimal control vertex and the constrained B-spline fitting curve.
[0023] As one possible implementation of this embodiment, step S4 further includes a segmented smoothing strategy: Using feature points as dividing nodes, the long contour line is divided into several curve segments. The endpoints of each curve segment are characteristic points; For adjacent curve segments and At the common endpoint, the first derivative must be continuous: ; And the second derivative is continuous: ; During the solution process, the control vertices of adjacent curve segments are associated to form a joint optimization equation system, ensuring that there are no sharp angles or abrupt changes at the segment connection points.
[0024] As one possible implementation of this embodiment, the segmented smoothing strategy further includes: For the segmented curve segments, the smoothing intensity coefficient of the segment is recalculated based on the local topographic parameters of the region. For areas with dense terrain features, appropriately reduce the segment length and increase the density of feature points; For areas with gentle terrain, appropriately increase the segment length to reduce the amount of calculation.
[0025] Step S5: Perform accuracy compliance verification on the smoothed contour lines. If the error exceeds the preset threshold, locate the error area and reduce the smoothing intensity coefficient α of the area. Return to step S4 for iterative optimization until the error meets the standard or the maximum number of iterations is reached.
[0026] Specifically, step S5 includes the following steps: Step S51: Calculate the accuracy verification index of the smoothed contour lines, including planar displacement and elevation consistency error. The calculation process of the accuracy verification index is as follows: 1) Planar displacement: Sample uniformly on the smoothed contour lines at intervals of 3 times the DEM resolution, calculate the vertical distance from the sampling point to the original contour line segment, and count the maximum and average displacement; 2) Elevation consistency error: Interpolate the elevation of the sampling points on the original DEM, use bilinear interpolation to obtain the elevation value, calculate the difference with the theoretical elevation value of the contour line, and count the maximum and average errors. Step S52: Compare the accuracy index with the preset tolerance threshold, wherein the preset tolerance threshold is: the plane displacement does not exceed 1 times the DEM resolution, and the elevation consistency error does not exceed 0.3 times the contour interval; Step S53: If any error index exceeds the threshold, locate the error-exceeding region and reduce the smoothing intensity coefficient α of that region by 20%. The process of locating the error-exceeding region is as follows: determine the error distribution using spatial interpolation and construct error contour lines; identify the region in the error contour lines that exceeds the threshold; perform spatial overlay analysis on the region and the original contour lines to determine the corresponding curve segments and feature points; the process of reducing the smoothing intensity coefficient α of that region by 20% is as follows: dynamically adjust the reduction amount of α according to the degree of error exceeding the threshold; when the error exceeds the threshold but is less than 1.5 times the threshold, α is reduced by 20%; when the error exceeds 1.5 times the threshold but is less than 2 times the threshold, α is reduced by 30%; when the error exceeds 2 times the threshold, α is reduced by 50%. Step S54: Return to step S4 to perform local smoothing again, repeating the iteration until all errors meet the standard or the maximum number of iterations is reached. The specific iterative optimization process is as follows: set the maximum number of iterations to 5; record the change in accuracy index for each iteration; when the accuracy improvement is less than 5% for two consecutive iterations, terminate the iteration in advance; mark the areas that still do not meet the standard after multiple iterations as "special processing areas" and make special annotations in the final results.
[0027] Step S6: Perform topology checks and repairs on the final smoothed contour lines, and output a smoothed contour line vector file that conforms to cartographic specifications.
[0028] Specifically, step S6 includes the following steps: Step S61: Perform topology check and repair on the final smoothed contour lines. The topology check and repair process is as follows: 1) Self-intersection check: Detect whether there are self-intersections in the smoothed contour lines. If so, repair them by local resampling and refitting. 2) Gap check: Detect whether there are unreasonable gaps between adjacent contour lines. If so, adjust the smoothing parameters of adjacent contour lines to make them consistent. 3) Adjacent intersection check: Detect whether contour lines at different elevations are abnormally close or intersect. If so, adjust the smoothing intensity coefficient of the corresponding area. Step S62: Output a smoothed contour vector file conforming to cartographic specifications and a quality assessment report. The output includes: outputting a smoothed contour vector file, supporting multiple formats such as Shapefile, GeoJSON, and GML; outputting a quality assessment report, including a plane displacement statistics table, an elevation error statistics table, and a feature point retention rate statistics table; and outputting a processing log, recording the processing time, parameter settings, and number of iterations for each step.
[0029] As one possible implementation of this embodiment, the quality assessment report further includes: Comparative analysis of smoothing effects under different terrain categories; Accuracy comparison data with fixed-parameter smoothing methods; Processing efficiency analysis includes total processing time and the time consumption percentage of each step.
[0030] As one possible implementation of this embodiment, step S6 further includes result verification: The smoothed contour lines were overlaid with the original DEM for analysis to verify the consistency of terrain features; The smoothed contour lines are compared with the reference data to verify the overall accuracy; The organization's cartographic experts will conduct a subjective evaluation of the smoothing effect to assess whether it conforms to cartographic standards and visual perception.
[0031] like Figure 2As shown in the figure, an embodiment of the present invention provides a contour line intelligent smoothing device based on feature constraints and parameter adaptation, comprising: The data preprocessing module is used to input digital elevation model (DEM) data and its extracted raw contour data, and to perform data preprocessing. The feature point fusion module is used to intelligently identify and fuse terrain feature points, which include primary feature points and secondary feature points. The parameter adaptive calculation module is used to adaptively calculate the smoothing intensity coefficient α of each contour line or each curve segment based on the local terrain parameters crossed by the original contour lines, where α∈[0,1]. The constrained smoothing calculation module is used to perform smoothing calculations on the original contour lines using the terrain feature points as constraints and the smoothing intensity coefficient α as control parameters, and to generate smoothed contour lines by using the constrained B-spline curve fitting method. The iterative optimization module is used to verify the accuracy of the smoothed contour lines. If the error exceeds a preset threshold, the error area is located and the smoothing intensity coefficient α of the area is reduced. Iterative optimization is performed until the error meets the standard or the maximum number of iterations is reached. The output module is used to perform topology checks and repairs on the final smoothed contour lines and output smoothed contour line vector files that conform to cartographic standards.
[0032] The core objective of this invention is to resolve the long-standing contradiction between "automatic smoothing leading to terrain distortion" and "fidelity processing relying on manual intervention," achieving the production of standardized contour data that is both smooth and aesthetically pleasing while strictly preserving terrain features without human intervention. Figure 3 As shown, this invention adopts a four-layer architecture of "feature recognition - adaptive control - constraint smoothing - closed-loop verification" to form a complete automated processing pipeline. The specific steps are as follows: Step 1: Data Input and Preprocessing: (1) Input digital elevation model (DEM) data and jagged original contour data extracted from the DEM.
[0033] (2) Data preprocessing, including: a. Check for topological issues: Check the original contour lines for topological issues such as self-intersections, breaks, and overlaps; b. Unify coordinate system: Unify DEM data and contour data to the same coordinate system (such as CGCS2000) and projection system (such as Gauss-Kruger projection). c. Establish spatial index: Use a quadtree index structure to build a spatial index of contour lines and DEM grid to improve the efficiency of subsequent spatial queries and calculations.
[0034] Step 2: Intelligent recognition and fusion of terrain feature points: (1) Identification of intersection points based on terrain feature lines: Ridge lines and valley lines are extracted from the DEM (using the topographic curvature method: calculate the profile curvature and planar curvature of the DEM, and the line connecting the extreme points of curvature is the feature line; or the hydrological analysis method: extract the confluence path by calculating the direction of water flow, determine the valley line, and then extract the ridge line by topographic inversion). The spatial overlay analysis algorithm is used to calculate the spatial intersections of contour lines and these feature lines, and the intersections are marked as primary feature points (mandatory protection points).
[0035] (2) Feature point recognition based on geometric morphology: a. Curvature extremum point extraction: Calculate the curvature sequence of the original contour lines (curvature formula) Where x and y are the coordinates of the contour line vertices, and the apostrophe indicates the derivative with respect to the arc length. A curvature threshold is set (dynamically determined based on the DEM resolution; for example, the threshold is 0.05m at a 5m resolution). - ¹), to identify local curvature extrema; b. Douglas-Puk Simplification: Set a simplification tolerance (0.2 times the DEM resolution) to simplify the original contour lines. The retained key vertices and curvature extrema are used as secondary feature points.
[0036] (3) Feature point merging: Merge the first- and second-level feature point sets, delete redundant points that are too close together, prioritizing the deletion of vertices after Douglas-Puk simplification, followed by curvature extrema; assign weight attributes to the merged feature points (first-level feature points have a weight of 1.0, and second-level feature points have a weight of 0.7), forming the final feature point constraint set.
[0037] Figure 4 This is a schematic diagram of feature point recognition and fusion, such as... Figure 4 As shown, the green lines are contour lines to be smoothed, and the yellow line is one of them, illustrating the feature point extraction diagram of that contour line. Figure 4 In the diagram, blue represents ridgelines, red represents valleylines, and red dots are the intersections of contour lines with ridgelines and valleylines—these are primary feature points. Green dots are extreme points of contour curvature, and orange dots are the Douglas-simplified nodes of the contour lines; these two categories are secondary feature points. Some extreme curvature points are located near primary feature points, and some Douglas-simplified nodes are also located near extreme curvature points. For these points, neighboring points with lower weights are removed at one DEM resolution, and the remaining feature points are assigned weighted attributes according to their category.
[0038] Step 3: Adaptive calculation of smoothing parameters: For each contour line or curve segment, the smoothing intensity control parameters are dynamically calculated based on the local terrain it passes through, achieving intelligent control of "weak smoothing in steep areas and strong smoothing in gentle areas".
[0039] (1) Calculate local terrain parameters: Based on the DEM, using a 3×3 or 5×5 local window (5×5 window for gently undulating areas, 3×3 window for dramatically undulating areas), the neighborhood or curve segment of each feature point is calculated: a. Local slope: Calculated using the maximum slope method: , in The slope of the DEM in the x and y directions; b. Terrain roughness: Calculates the standard deviation of all elevation values within the window. , in The elevation value within the window. The average elevation of the window.
[0040] (2) Smoothing intensity mapping function: Establish a mapping function from terrain parameters to smoothing intensity. ,in: The preset maximum smoothing intensity (fixed at 1.0). As an adjustment coefficient, it was determined through experiments that the greater the slope and the higher the roughness, the smaller the calculated α value and the weaker the smoothing effect.
[0041] Adjustment coefficient ( The method for determining the type of terrain is as follows: Several experimental areas are selected for different terrain categories, such as plains, hills, mountains, and high mountains. Within the intervals [0.1, 10] and [0.1, 5] respectively, a grid search method is used to search for each group at a certain step size (e.g., 0.1). A smoothing algorithm is applied to evaluate the smoothing results. The average planar displacement of the smoothed curve does not exceed 1 times the DEM resolution, and the feature point retention rate is the highest, which is taken as the suggested coefficient for the terrain.
[0042] (3) Parameter spatialization: Establish a parameter sequence for each contour line: A parameter attenuation zone (radius 1-3 times DEM resolution, 3 times for flat terrain and 1 times for undulating terrain) is set near the feature points. Linear interpolation is used to achieve parameter attenuation within the attenuation zone. Continuous transition of values.
[0043] Figure 5 This is a schematic diagram illustrating the calculation of local terrain parameters, such as... Figure 5 As shown, the calculation process for local terrain parameters at a certain point on the curve is as follows: Take the DEM elevation value of the 3x3 window at that point, substitute it into the formula to calculate that the slope at that point is 0.806 and the terrain roughness is 4.655. Substitute this value into the formula... (The optimal value for this terrain, determined experimentally), was calculated for this point. .
[0044] Step 4: Feature constraint smoothing calculation: Using feature points as constraints and adaptive parameters as controls, smooth calculations are performed.
[0045] (1) Constrained B-spline curve fitting: A cubic B-spline curve is used as the fitting basis function to achieve the fusion of feature point constraints and adaptive parameter α. Specific steps are as follows: aB spline basis function definition: Let the parametric equation of the fitted curve be: , in To control the vertices, The basis functions are cubic B-spline functions, satisfying the recurrence relation: , , in The node vector uses a uniform node distribution. ; b. Feature point constraint embedding: Let the feature point set be... Establish constraint equations: First-level feature points: (Equality constraints, mandatory satisfaction); Secondary feature points: (Inequality constraint, δ = 0.3 times DEM resolution); c. The fusion mechanism of adaptive parameter α, constructing the optimization objective function: , in, The constraint weights are 100 * the weight coefficients of the feature points. The smoothing weight is fixed at 10. The second derivative of the curve is given by the integral term; a larger integral term indicates a rougher curve. To control the smoothing force of α: the larger α is, the smaller the weight of the smoothing energy term and the smoother the curve; the smaller α is, the larger the constraint weight is and the closer the curve is to the feature point. d. Numerical solution: The constraints are incorporated into the objective function using the Lagrange multiplier method, transforming it into a system of linear equations. (X is the control vertex) The coordinate vectors are used to solve the system of equations using the LU decomposition method to obtain the optimal control vertex and generate the constrained B-spline fitting curve.
[0046] (2) Segmented smoothing strategy: a. Using feature points as dividing nodes, the long contour line is divided into several curve segments. The endpoints of each curve segment are characteristic points; b. For adjacent curve segments, and It is required that the first derivative is continuous at the common endpoint. and continuity of the second derivative ; c. When solving, the control vertices of adjacent curve segments are associated to form a joint optimization equation system to ensure that there are no sharp angles or abrupt changes at the segment connection points.
[0047] Figure 6 This is a schematic diagram of adaptive smoothing parameter spatialization. Figure 6 In the parameter decay region centered on the feature point, α increases linearly from the minimum value (approaching 0) at the feature point to the region boundary. Outside the region, the α value is calculated based on local terrain parameters, ultimately forming a continuous α sequence without abrupt changes, which serves as a smooth control parameter.
[0048] Figure 7 Comparison of the effects before and after constraint smoothing; Figure 7 The orange lines are unsmoothed contour lines with jagged edges, the yellow lines are the result of global smoothing with fixed parameters, and the red lines are the result of adaptive constraint smoothing. As you can see, the smoothing method proposed in this invention can preserve the features of the original contour lines to the greatest extent, achieving a smoothing effect that balances aesthetics and accuracy.
[0049] Step 5: Accuracy compliance verification and iterative optimization: Establish an automated quality feedback control loop to ensure that smooth results meet preset accuracy standards.
[0050] (1) Accuracy verification indicators: a. Planar displacement: Calculate the vertical distance from the uniformly sampled points (sampling interval is 3 times the DEM resolution) on the smoothed contour line to the original contour line segment, and count the maximum displacement and average displacement; b. Elevation consistency error: The elevation values are obtained by back-interpolating the sampling points to the original DEM (using bilinear interpolation), and the difference between the elevation values and the theoretical elevation values of the contour lines is calculated. The maximum error and the average error are statistically analyzed.
[0051] (2) Iterative optimization: a. Preset tolerance thresholds: Planar displacement < 1 times DEM resolution, elevation consistency error < 0.3 times contour interval; b. If any error index exceeds the threshold, the smoothing intensity coefficient α of the positioning error exceeding the limit area (the error distribution is determined by spatial interpolation) is reduced by 20%; c. Return to step 4 and perform local smoothing again, repeating the iteration until all errors meet the target or the maximum number of iterations is reached (default 5 times).
[0052] Step 6: Topology Check and Output: (1) Topology check and repair: Perform self-intersection check, gap check and adjacent intersection check on the final smoothed contour lines, repair topology errors and ensure that the topology relationship is correct; (2) Output: Output a smooth contour vector file that conforms to the mapping specifications, and can be attached with a quality assessment report containing various error statistics, including plane displacement statistics, elevation error statistics, etc.
[0053] In one embodiment of the invention, three sets of DEM data with different terrains were selected. The DEM resolution was 5 meters and the contour interval was 5 meters. The original contour lines all had different degrees of jagged noise. Smoothing was performed using fixed parameter B-spline smoothing, manual smoothing and the adaptive smoothing method of the present invention. The comparison results are shown in Table 1.
[0054] Table 1. Comparison of smoothing results between the adaptive smoothing method of this invention and other smoothing methods.
[0055] The comparison results in Table 1 show that the adaptive smoothing method of the present invention can effectively preserve the terrain skeleton and detailed features, avoid terrain distortion caused by smoothing, and the smoothing accuracy is better than that of fixed parameter smoothing and roughly equal to that of manual smoothing. It meets the accuracy requirements of 1:10,000 scale mapping, and the processing time is only 5% of that of manual smoothing.
[0056] An electronic device provided by an embodiment of the present invention includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the contour line intelligent smoothing method based on feature constraints and parameter adaptation as described above.
[0057] Specifically, the aforementioned memory and processor can be general-purpose memory and processor, without any specific limitations. When the processor runs the computer program stored in the memory, it can execute the aforementioned intelligent contour smoothing method based on feature constraints and parameter adaptation.
[0058] Those skilled in the art will understand that the structure of the electronic device does not constitute a limitation on the electronic device, and may include more or fewer components than shown in the figure, or combine some components, or split some components, or have different component arrangements.
[0059] In some embodiments, the electronic device may further include a touchscreen for displaying a graphical user interface (e.g., an application launch screen) and receiving user actions on the graphical user interface (e.g., launching an application). Specifically, the touchscreen may include a display panel and a touch panel. The display panel may be configured as an LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), or similar type. The touch panel can collect user touch or non-touch operations on or near it and generate pre-set operation commands, such as user actions using fingers, styluses, or any suitable object or accessory on or near the touch panel. Additionally, the touch panel may include a touch detection device and a touch controller. The touch detection device detects the user's touch position and posture, and detects the signals generated by the touch operation, transmitting the signals to the touch controller. The touch controller receives touch information from the touch detection device, converts it into information that the processor can process, sends it to the processor, and can also receive and execute commands from the processor. Furthermore, touch panels can be implemented using various types of sensors, including resistive, capacitive, infrared, and surface acoustic wave sensors, as well as any future technologies. Moreover, the touch panel can cover the display panel. Users can operate on or near the touch panel, which is covered by the graphical user interface displayed on the display panel. After detecting the operation on or near the touch panel, the touch panel transmits it to the processor to determine the user input. The processor then responds to the user input by providing corresponding visual output on the display panel. Additionally, the touch panel and display panel can be implemented as two separate components or integrated together.
[0060] Corresponding to the above application startup method, this embodiment of the invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the contour line intelligent smoothing method based on feature constraints and parameter adaptation as described above.
[0061] The application launch device provided in this application embodiment can be specific hardware on the device or software or firmware installed on the device. The device provided in this application embodiment has the same implementation principle and technical effects as the foregoing method embodiments. For the sake of brevity, any parts not mentioned in the device embodiment can be referred to the corresponding content in the foregoing method embodiments. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can all be referred to the corresponding processes in the above method embodiments, and will not be repeated here.
[0062] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0063] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and there may be other division methods in actual implementation. Furthermore, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the coupling or direct coupling or communication connection shown or discussed may be through some communication interface, and the indirect coupling or communication connection of the apparatus or modules may be electrical, mechanical, or other forms.
[0064] The modules described as separate components may or may not be physically separate. Similarly, the components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0065] In addition, the functional modules in the embodiments provided in this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.
[0066] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0067] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0068] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0069] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit it. Although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the specific implementation of the present invention. Any modifications or equivalent substitutions that do not depart from the spirit and scope of the present invention should be covered within the protection scope of the claims of the present invention.
Claims
1. A contour line intelligent smoothing method based on feature constraints and parameter adaptation, characterized in that, Includes the following steps: Step S1: Obtain the digital elevation model (DEM) data and its extracted raw contour data, and perform data preprocessing; Step S2: Intelligent identification and fusion of terrain feature points, which include primary feature points and secondary feature points; Step S3: Based on the local terrain parameters traversed by the original contour lines, adaptively calculate the smoothing intensity coefficient of each contour line or each curve segment; Step S4: Using the terrain feature points as constraints and the smoothing intensity coefficient as control parameters, the original contour lines are smoothed using the constrained B-spline curve fitting method to generate smoothed contour lines. Step S5: Perform accuracy compliance verification on the smoothed contour lines. If the error exceeds the preset threshold, locate the error area and reduce the smoothing intensity coefficient of the area. Return to step S4 for iterative optimization until the error meets the standard or the maximum number of iterations is reached. Step S6: Perform topology checks and repairs on the final smoothed contour lines, and output a smoothed contour line vector file that conforms to cartographic specifications.
2. The intelligent contour smoothing method based on feature constraints and parameter adaptation according to claim 1, characterized in that, Step S1 includes the following steps: Step S11: Check if there are any topological problems such as self-intersection, breakage, or overlap in the original contour lines; Step S12: Unify the DEM data and contour data to the same coordinate system and projection system; Step S13: Establish a quadtree index structure and construct a spatial index of contour lines and DEM grid.
3. The intelligent contour smoothing method based on feature constraints and parameter adaptation according to claim 1, characterized in that, Step S2 includes the following steps: Step S21: Based on the intersection identification of terrain feature lines, calculate the spatial intersections of contour lines with ridge lines and valley lines, and mark them as first-level feature points; Step S22: Based on the feature point recognition of geometric shape, extract the curvature extrema of the original contour lines, and combine them with the key vertices retained after simplification by the Douglas-Puk algorithm, which together serve as secondary feature points; Step S23: Merge the sets of primary and secondary feature points, delete redundant points that are too close, and assign weight attributes to the merged feature points to form the final feature point constraint set.
4. The intelligent contour smoothing method based on feature constraints and parameter adaptation according to claim 1, characterized in that, Step S3 includes the following steps: Step S31: Based on the DEM data, calculate the local slope and terrain roughness of the neighborhood or curve segment of each feature point. Step S32, according to the mapping function Calculate the smoothing intensity coefficient α, where To preset the maximum smoothing intensity, For local slope, For terrain roughness, and As an adjustment coefficient, the smoothing intensity coefficient α has a value range of 0 ≤ α ≤ 1; Step S33: Establish a smoothing intensity coefficient sequence for each contour line. Furthermore, a parameter decay region is set near the feature point, so that the value of α increases linearly from the minimum value at the feature point to the boundary within the decay region.
5. The intelligent contour smoothing method based on feature constraints and parameter adaptation according to claim 1, characterized in that, Step S4 includes the following steps: Step S41: Using a cubic B-spline curve as the fitting basis function, embed the feature points as constraints into the fitting equation: , Where C(u) is the fitted curve, To control the vertices, The basis functions are cubic B-spline functions. Step S42, construct the optimization objective function that integrates feature point constraints and smoothing intensity coefficients: , in, Weights are constrained for feature points. To smooth out the weights, The second derivative of the curve. Let α be the feature point and α be the smoothing intensity coefficient. Step S43: The constraints are incorporated into the objective function using the Lagrange multiplier method, which transforms the function into a system of linear equations. The LU decomposition method is then used to solve the system, resulting in the optimal control vertex and the constrained B-spline fitting curve.
6. The intelligent contour smoothing method based on feature constraints and parameter adaptation according to claim 1, characterized in that, Step S5 includes the following steps: Step S51: Calculate the accuracy verification index of the smoothed contour lines, including plane displacement and elevation consistency error; Step S52: Compare the accuracy index with the preset tolerance threshold; Step S53: If any error index exceeds the threshold, locate the area with excessive error, and reduce the smoothing intensity coefficient α of that area by 20%. Step S54: Return to step S4 to perform local smoothing again, repeating the iteration until all errors meet the standard or the maximum number of iterations is reached.
7. The intelligent contour smoothing method based on feature constraints and parameter adaptation according to any one of claims 1 to 6, characterized in that, Step S6 includes the following steps: Step S61: Perform topology check and repair on the final smoothed contour lines; Step S62: Output a smooth contour vector file that conforms to cartographic specifications and a quality assessment report.
8. A contour line intelligent smoothing device based on feature constraints and parameter adaptation, characterized in that, include: The data preprocessing module is used to input digital elevation model (DEM) data and its extracted raw contour data, and to perform data preprocessing. The feature point fusion module is used to intelligently identify and fuse terrain feature points, which include primary feature points and secondary feature points. The parameter adaptive calculation module is used to adaptively calculate the smoothing intensity coefficient of each contour line or each curve segment based on the local terrain parameters crossed by the original contour lines. The constrained smoothing calculation module is used to perform smoothing calculations on the original contour lines using the terrain feature points as constraints and the smoothing intensity coefficient as control parameters, and adopts the constrained B-spline curve fitting method to generate smoothed contour lines. The iterative optimization module is used to verify the accuracy of the smoothed contour lines. If the error exceeds a preset threshold, the error area is located and the smoothing intensity coefficient of the area is reduced. Iterative optimization is performed until the error meets the standard or the maximum number of iterations is reached. The output module is used to perform topology checks and repairs on the final smoothed contour lines and output smoothed contour line vector files that conform to cartographic standards.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the contour line intelligent smoothing method based on feature constraints and parameter adaptation as described in any one of claims 1-7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the contour line intelligent smoothing method based on feature constraints and parameter adaptation as described in any one of claims 1-7.