Topographic ridge line automatic extraction method based on weighted topology network diagram
Through the method based on the weighted topological network diagram, the problems of low extraction efficiency and insufficient noise resistance in the prior art are solved, and high-precision and smooth ridge line extraction effect are achieved.
Patent Information
- Application Number
- CN202411451402.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-17
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-10-17
AI Technical Summary
The prior art has problems with large calculation amounts, insufficient noise resistance, low feature point extraction accuracy, and breakage and noise in the ridge line when extracting terrain ridge lines.
Using automatic extraction method based on weighted topological network graph, through terrain rasterization, downsampling, neighborhood mean smoothing, refinement processing, construction of weighted topological network graph, breaking closed graph, filtering short ridge lines and branches, weighted averages and points The polymerization combined method performs smoothing of ridge lines.
The efficiency and accuracy of ridgeline extraction is improved, noise resistance is enhanced, and the fracture and redundant branches of ridgelines are reduced, ensuring that the extracted ridgeline is well matched with the actual terrain.
Smart Images

Figure CN119417999A_ABST
Abstract
Description
Technical Field
[0001] The patent of this invention relates to the field of digital terrain analysis technology, specifically a method for automatically extracting terrain ridgelines based on a weighted topological network graph. Background Art
[0002] Digital elevation model (DEM) is a way of discrete mathematical representation of the earth's surface. It is also one of the core data for three-dimensional spatial data processing and digital terrain analysis in remote sensing and geographic information systems. Ridge lines and valley lines can be extracted from digital elevation models to represent important dividing lines of changes in mountain terrain. They have important applications in terrain representation, digital terrain analysis, surveying and mapping, and engineering design. Therefore, automatically, accurately, and efficiently extracting ridges and valley lines from DEM has always been an important topic in the field of digital terrain analysis, and has played an important guiding role in the scientific use of terrain for infrastructure construction, regional planning, disaster prevention, and other aspects.
[0003] The existing ridgeline extraction methods mainly include:
[0004] ① The method based on terrain flow simulation. The basic idea of this method is that water always follows the natural law of flowing from high to low. The water volume of each grid point in the DEM data is calculated in sequence. If the water volume of the grid point in the grid is greater than the given threshold, it is considered to be a water point. According to a certain rule, these water points are connected in sequence to obtain the water line, and each water line in the area is found from high to low; according to the obtained water line, the boundary line of each water area is found by calculation to obtain the watershed line. The watershed line is considered to be the ridge line, and the watershed line is the valley line. This method has strong anti-noise ability, but there are problems such as the amount of calculation increases in a square relationship with the increase in the number of grids, resulting in poor extraction efficiency, and poor extraction effect for mountains with small undulations.
[0005] ② Based on the DEM terrain feature extraction method, this method refers to a cross-section extreme value method. Its basic idea is to find the maximum and minimum points on the cross-section curve of the terrain. The potential terrain feature points are related to the local extreme points on the terrain cross section. The maximum point is considered to be the watershed point of the terrain, and the minimum point is considered to be the watershed point of the terrain. Finally, the extracted feature points are connected to form a feature line. This type of method has the phenomenon and problems of being sensitive to noise, having many breaks and branches in the results, discontinuous ridge lines, and large deviations from the actual terrain.
[0006] ③ The method based on image processing. The idea of this method is: assuming that the larger the elevation value of the grid point, the brighter the grayscale value, then the top of the mountain in the image is brighter than other positions, and the ridge line extends along a grayscale value higher than the area on both sides. This method is intuitive and efficient, but there are problems such as unsatisfactory noise removal, uncontrollable break and branch removal, etc.
[0007] The patent discloses a ridgeline extraction method, device, storage medium, and electronic device (CN 117911434A), and proposes a ridgeline extraction method, including: obtaining a ridgeline image, and performing an area of interest detection on the ridgeline image; performing ridgeline detection on the detected area of interest, and constructing a sampling point set based on the ridgeline detection results; screening out target sampling points on the ridgeline from the sampling point set, and obtaining a ridgeline path based on the target sampling points. This method can be executed in parallel on multiple areas of interest, takes less time, and avoids calculations on non-target areas, reducing execution time. However, the accuracy of feature point extraction is not significantly improved, and the problems of fractures and noise in the ridgeline are not fundamentally solved.
[0008] The disclosed patent discloses an adaptive valley ridgeline extraction method and system based on scale space (CN 105550691A), which provides an adaptive valley ridgeline extraction method and system based on scale space, including first oversampling the original DEM as the initial DEM for processing, and establishing an image pyramid based on the initial DEM; starting from the top layer of the DEM pyramid, performing adaptive multi-angle terrain section elevation extreme value method extraction, and obtaining ridgelines and valley lines through post-processing, and then refining the extraction results layer by layer. Compared with the existing methods, the disclosed method can take into account the overall trend and detailed changes of ridge (valley) extraction, ensure the accuracy of extraction, and quickly obtain the extraction results to ensure the efficiency of extraction. The method can adapt to the influence of different terrain undulations on the overall result. However, it does not solve the interference of local sampling point noise and optimize fine ridgelines.
[0009] The feature point connection algorithm used in the existing technology is relatively complex. When faced with large-scale terrain data application needs, the detection results are prone to deviations. The surface geometric morphology analysis algorithm used is based on the extracted terrain feature points as the basis for generating feature lines. When the extracted feature points are insufficient or uneven, the generated terrain feature lines will be broken or crossed.
[0010] Invention patent content
[0011] In view of the shortcomings of the existing technology, the patent of the present invention provides a method for automatically extracting terrain ridgelines based on a weighted topological network graph, which has the advantages of not only ensuring extraction efficiency but also having strong noise resistance and being able to extract ridgelines with clear veins. It solves the problem that the feature point connection algorithm used in the existing technology is relatively complex, and the detection results are prone to deviations when facing large-scale terrain data application needs; the surface geometric morphology analysis algorithm used is based on the extracted terrain feature points as the basis for generating feature lines. When the extracted feature points are insufficient or uneven, the generated terrain feature lines will be broken or crossed.
[0012] To achieve the above purpose, the present invention provides the following technical solution: a method for automatically extracting terrain ridgelines based on a weighted topological network graph, comprising the following steps:
[0013] S1 rasterizes the terrain of the target area and obtains DEM data;
[0014] S2 sets the sampling step size to downsample the DEM and obtain the sampling point image;
[0015] S3 uses the neighborhood search method to extract the target point from the sampling point image, and uses the neighborhood mean smoothing to perform correction processing to obtain the weighted mountain top point;
[0016] S4 refines the mountain top point image and retains the mountain top points on the ridgeline skeleton;
[0017] S5 constructs a weighted topological network graph for the peak point graph, uses the Kruskal algorithm to break the closed graph, and forms a maximum spanning tree;
[0018] S6 filters short ridgelines, short branches on ridgelines, and redundant branches;
[0019] S7 uses a method combining point aggregation and weighted average to smooth the ridge line and obtain the final ridge line.
[0020] Further, the step S2 comprises:
[0021] S21, parameter selection: The sampling step size is usually the smaller value of the number of rows and columns multiplied by the sampling ratio a. The size of the ratio setting determines the degree of downsampling. If the downsampling degree is too high, the feature points will be misjudged. If the downsampling degree is too low, the ridge feature points will not be identified and the extraction efficiency will be affected.
[0022] S22, collecting DEM corresponding grid values at a certain interval according to a preset sampling step, and the obtained sampling point image is used for the next step of calculation.
[0023] Further, the step S3 comprises:
[0024] S31, the mountain top point is defined as the point corresponding to the maximum elevation in a certain area. If there is a point P that satisfies all the conditions in formula (1) in a certain section of the pixel along eight directions (east-west, north-south, northeast-southwest, northwest-southeast), it is a potential mountain top point and is assigned a value of 1, otherwise it is assigned a value of 0, where L(P) is the number of sampling points with a smaller elevation value than point P among the four sampling points extending from the left side of the section, and R(P) is the number of sampling points with a smaller elevation value than point P among the four sampling points extending from the right side of the section;
[0025]
[0026] S32, neighborhood mean smoothing is to specify an n×n convolution template with a sampling point as the center, and calculate the average value of the pixel values in the neighborhood. The calculation formula is as shown in formula (2), where i, j are the coordinates in the template, N is the number of pixels in the template, and f(x, y) is the pixel value at the center of the template;
[0027]
[0028] Regarding the selection of the window size, the specific operation can be set by the technicians in this field. Usually, the average focus statistics under the default 5×5 window can obtain better result accuracy and efficiency.
[0029] S33, after performing a subtraction operation on the original image and the image smoothed by the neighborhood mean, the pixels above the zero value are assigned a value of 1, which is a positive terrain, and the pixels below the zero value are assigned a value of 0, which is a negative terrain;
[0030] S34, using the positive and negative terrain images to correct the potential mountain top point image, can filter out the points in the negative terrain that are mistakenly classified as mountain tops, and effectively remove noise points;
[0031] S35, setting the weight of each mountain top point to the original grayscale value of the pixel.
[0032] Further, the step S4 comprises:
[0033] The Zhang-Suen thinning algorithm is a classic thinning algorithm. It can be used to process the result point set of S3 to retain the peak points on the trunk and effectively remove the redundant branches generated by invalid peak points. The specific algorithm is as follows:
[0034] S41, first specify a 3×3 neighborhood analysis window, the window pixel number is as shown in formula (3), and the operation of the algorithm includes two stages;
[0035]
[0036] S42, stage 1, if pixel P1 satisfies all the conditions in formula (4), then pixel P1 can be set to zero, where B(P1) represents the number of non-zero neighboring pixels of P1, and A(P1) represents the number of times the pixel value changes from 0 to 1 in the clockwise direction from P2 to P2;
[0037]
[0038] S43, stage 2, if pixel P1 satisfies all the conditions in formula (5), then pixel P1 can be set to zero, where B(P1) represents the number of non-zero neighboring pixels of P1, and A(P1) represents the number of times the pixel value changes from 0 to 1 in the clockwise direction from P2 to P2;
[0039]
[0040] Further, the step S5 comprises:
[0041] S51, taking the target mountain top point as the center, searching for other target mountain top points in eight directions in a 3×3 rectangular neighborhood to connect with it, and assigning a weight to each edge equal to the sum of the weights of the two target mountain top points. After completion, a weighted topological network diagram of the mountain top points is obtained;
[0042] S52, according to the idea of constructing a spanning tree by Kruskal, all the edges in the weighted topological network are sorted in descending order according to the weights and stored in the set of edges to be selected;
[0043] S53, taking the edge with the largest weight from the set of edges to be selected and adding it to the spanning tree;
[0044] S54, determining whether the added edge has any intersection with a non-endpoint of the spanning tree, if not, adding the edge to the spanning tree, otherwise removing the edge from the spanning tree;
[0045] S55, determining whether the added edge forms a closed loop with the spanning tree, if not, adding the edge to the spanning tree, otherwise, removing the edge from the spanning tree;
[0046] S56, repeating the operations of S43, S44, and S45 until the set of edges to be selected is empty.
[0047] Further, the step S6 comprises:
[0048] S61, determining a ridgeline threshold, and ridgelines and branches smaller than the threshold are defined as short branches and invalid ridgelines;
[0049] It is generally believed that this threshold is not a fixed value. After research, it was found that removing ridge lines and branches with an actual length of less than 200m can achieve better denoising effects;
[0050] S63, remove all defined short branches and invalid ridge lines;
[0051] S64, points without connection relationships will be removed from the target mountain top point set.
[0052] Further, the step S7 comprises:
[0053] S71, use weighted average to perform the first step of smoothing the ridge line: specify a 3×3 neighborhood analysis window, calculate the weighted average of the row and column numbers of the pixels in the neighborhood, and the calculation formula is as shown in formula (6) and formula (7), where N is the number of pixels in the neighborhood analysis window, x is n ,y n is the row and column number of the original pixel, w nis the corresponding pixel weight, f(x) and f(y) are the row and column numbers after smoothing;
[0054]
[0055] S72, clustering point operation: specify an n×n neighborhood analysis window, merge the points with connection relationship in the window into a cluster, and take the cluster point with the largest weight as the cluster center;
[0056] In order to avoid eliminating the ridgeline features when aggregating the target mountain top points, the aggregation sampling window should not be too large. The default setting of 3×3 can achieve good results.
[0057] S73, calculating the connection relationship of the cluster according to the connectivity relationship of all target mountain top points in the cluster: traversing to obtain the target mountain top point in the cluster, obtaining the adjacent points of the target mountain top point, and if the adjacent point and the target mountain top point do not belong to the same cluster, then establishing a connection relationship between the two clusters;
[0058] S74, obtaining the coordinates of each cluster center point after the first smoothing as a new cluster center, and drawing a ridge line according to the new cluster center and the connection relationship, which is the second smoothing of the ridge line;
[0059] S75, the final result of the ridge line is obtained after two smoothing steps.
[0060] Compared with the prior art, the technical solution of this application has the following beneficial effects:
[0061] 1. This method for automatically extracting terrain ridgelines based on weighted topological network graphs, after the ridgeline extraction has gone through steps such as neighborhood mean smoothing and redundancy removal, has largely eliminated the influence of noise, overcome the problem of traditional ridgeline extraction methods being sensitive to noise, and also ensured the accuracy of extraction.
[0062] 2. This method for automatically extracting terrain ridgelines based on weighted topological network graphs performs ridge point refinement before smoothing the ridgelines to reduce the jagged and redundant branches produced by the Kruskal algorithm in breaking the closed graph. When smoothing the ridgelines, a combination of weighted averaging and point aggregation is used to ensure that the ridgelines extend smoothly along the actual terrain and that the characteristic points of the ridges are on the ridgelines, which is more consistent with the actual terrain.
[0063] 3. This method for automatic extraction of terrain ridgelines based on weighted topological network graphs uses computer methods to complete the extraction of ridgelines, realizes the automatic extraction of terrain features, performs a variety of redundant removal processes in the process, improves the algorithm's anti-noise ability, and can achieve good extraction effects and speeds for terrain data with large amounts of data, greatly improving work efficiency and user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 It is a flow chart of an embodiment of the present invention;
[0065] Figure 2 The peak point result extracted from S3;
[0066] Figure 3 This is the refinement result of the S4 mountain top point;
[0067] Figure 4 The preliminary effect of the ridgeline generated for S4;
[0068] Figure 5 The ridgeline result after S5 filters out invalid ridgelines;
[0069] Figure 6 This is the ridge line effect after S6 smoothing, which is also the final result of ridge line extraction. DETAILED DESCRIPTION
[0070] The following will be combined with the drawings in the embodiments of the patent of the present invention to clearly and completely describe the technical solutions in the embodiments of the patent of the present invention. Obviously, the described embodiments are only part of the embodiments of the patent of the present invention, not all of them. Based on the embodiments in the patent 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 patent of the present invention.
[0071] See also Figures 1 to 6 In this embodiment, a method for automatically extracting terrain ridgelines based on a weighted topological network graph includes the following steps:
[0072] S1 rasterizes the terrain of the target area and obtains DEM data;
[0073] S2 sets the sampling step size to downsample the DEM and obtain the sampling point image;
[0074] S3 uses the neighborhood search method to extract the target point from the sampling point image, and uses the neighborhood mean smoothing to perform correction processing to obtain the weighted mountain top point;
[0075] S4 refines the mountain top point image and retains the mountain top points on the ridgeline skeleton;
[0076] S5 constructs a weighted topological network graph for the peak point graph, uses the Kruskal algorithm to break the closed graph, and forms a maximum spanning tree;
[0077] S6 filters short ridgelines, short branches on ridgelines, and redundant branches;
[0078] S7 uses a method combining point aggregation and weighted average to smooth the ridge line and obtain the final ridge line.
[0079] In this embodiment, step S2 includes:
[0080] S21, parameter selection: The sampling step size is usually the smaller value of the number of rows and columns multiplied by the sampling ratio a. The size of the ratio setting determines the degree of downsampling. If the downsampling degree is too high, the feature points will be misjudged. If the downsampling degree is too low, the ridge feature points will not be identified and the extraction efficiency will be affected.
[0081] S22, collecting DEM corresponding grid values at a certain interval according to a preset sampling step, and the obtained sampling point image is used for the next step of calculation.
[0082] In this embodiment, step S3 includes:
[0083] S31, the mountain top point is defined as the point corresponding to the maximum elevation in a certain area. If there is a point P that satisfies all the conditions in formula (1) in a certain section of the pixel along eight directions (east-west, north-south, northeast-southwest, northwest-southeast), it is a potential mountain top point and is assigned a value of 1, otherwise it is assigned a value of 0, where L(P) is the number of sampling points with a smaller elevation value than point P among the four sampling points extending from the left side of the section, and R(P) is the number of sampling points with a smaller elevation value than point P among the four sampling points extending from the right side of the section;
[0084]
[0085] S32, neighborhood mean smoothing is to specify an n×n convolution template with a sampling point as the center, and calculate the average value of the pixel values in the neighborhood. The calculation formula is as shown in formula (2), where i, j are the coordinates in the template, N is the number of pixels in the template, and f(x, y) is the pixel value at the center of the template;
[0086]
[0087] Regarding the selection of the window size, the specific operation can be set by the technicians in this field. Usually, the average focus statistics under the default 5×5 window can obtain better result accuracy and efficiency.
[0088] S33, after performing a subtraction operation on the original image and the image smoothed by the neighborhood mean, the pixels above the zero value are assigned a value of 1, which is a positive terrain, and the pixels below the zero value are assigned a value of 0, which is a negative terrain;
[0089] S34, using the positive and negative terrain images to correct the potential mountain top point image, can filter out the points in the negative terrain that are mistakenly classified as mountain tops, and effectively remove noise points;
[0090] S35, setting the weight of each mountain top point to the original grayscale value of the pixel.
[0091] In this embodiment, step S4 includes:
[0092] The Zhang-Suen thinning algorithm is a classic thinning algorithm. It can be used to process the result point set of S3 to retain the peak points on the trunk and effectively remove the redundant branches generated by invalid peak points. The specific algorithm is as follows:
[0093] S41, first specify a 3×3 neighborhood analysis window, the window pixel number is as shown in formula (3), and the operation of the algorithm includes two stages;
[0094]
[0095] S42, stage 1, if pixel P1 satisfies all the conditions in formula (4), then pixel P1 can be set to zero, where B(P1) represents the number of non-zero neighboring pixels of P1, and A(P1) represents the number of times the pixel value changes from 0 to 1 in the clockwise direction from P2 to P2;
[0096]
[0097] S43, stage 2, if pixel P1 satisfies all the conditions in formula (5), then pixel P1 can be set to zero, where B(P1) represents the number of non-zero neighboring pixels of P1, and A(P1) represents the number of times the pixel value changes from 0 to 1 in the clockwise direction from P2 to P2;
[0098]
[0099] In this embodiment, step S5 includes:
[0100] S51, taking the target mountain top point as the center, searching for other target mountain top points in eight directions in a 3×3 rectangular neighborhood to connect with it, and assigning a weight to each edge equal to the sum of the weights of the two target mountain top points. After completion, a weighted topological network diagram of the mountain top points is obtained;
[0101] S52, according to the idea of constructing a spanning tree by Kruskal, all the edges in the weighted topological network are sorted in descending order according to the weights and stored in the set of edges to be selected;
[0102] S53, taking the edge with the largest weight from the set of edges to be selected and adding it to the spanning tree;
[0103] S54, determining whether the added edge has any intersection with a non-endpoint of the spanning tree, if not, adding the edge to the spanning tree, otherwise removing the edge from the spanning tree;
[0104] S55, determining whether the added edge forms a closed loop with the spanning tree, if not, adding the edge to the spanning tree, otherwise, removing the edge from the spanning tree;
[0105] S56, repeating the operations of S43, S44, and S45 until the set of edges to be selected is empty.
[0106] In this embodiment, step S6 includes:
[0107] S61, determining a ridgeline threshold, and ridgelines and branches smaller than the threshold are defined as short branches and invalid ridgelines;
[0108] It is generally believed that this threshold is not a fixed value. After research, it was found that removing ridge lines and branches with an actual length of less than 200m can achieve better denoising effects;
[0109] S63, remove all defined short branches and invalid ridge lines;
[0110] S64, points without connection relationships will be removed from the target mountain top point set.
[0111] In this embodiment, step S7 includes:
[0112] S71, use weighted average to perform the first step of smoothing the ridge line: specify a 3×3 neighborhood analysis window, calculate the weighted average of the row and column numbers of the pixels in the neighborhood, and the calculation formula is as shown in formula (6) and formula (7), where N is the number of pixels in the neighborhood analysis window, x is n ,y n is the row and column number of the original pixel, w n is the corresponding pixel weight, f(x) and f(y) are the row and column numbers after smoothing;
[0113]
[0114] S72, clustering point operation: specify an n×n neighborhood analysis window, merge the points with connection relationship in the window into a cluster, and take the cluster point with the largest weight as the cluster center;
[0115] In order to avoid eliminating the ridgeline features when aggregating the target mountain top points, the aggregation sampling window should not be too large. The default setting of 3×3 can achieve good results.
[0116] S73, calculating the connection relationship of the cluster according to the connectivity relationship of all target mountain top points in the cluster: traversing to obtain the target mountain top point in the cluster, obtaining the adjacent points of the target mountain top point, and if the adjacent point and the target mountain top point do not belong to the same cluster, then establishing a connection relationship between the two clusters;
[0117] S74, obtaining the coordinates of each cluster center point after the first smoothing as a new cluster center, and drawing a ridge line according to the new cluster center and the connection relationship, which is the second smoothing of the ridge line;
[0118] S75, the final result of the ridge line is obtained after two smoothing steps.
[0119] Compared with the prior art, the technical solution of this application has the following beneficial effects:
[0120] The automatic extraction method of terrain ridgelines based on weighted topological network graph, after the ridgeline extraction has gone through the steps of neighborhood mean smoothing, redundancy removal, etc., the influence of noise is largely removed, the problem of traditional ridgeline extraction methods being sensitive to noise is overcome, and the extraction accuracy is also guaranteed. The ridge point is refined before smoothing the ridgeline to reduce the jagged and redundant branches generated by the Kruskal algorithm to break the closed graph. When smoothing the ridgeline, a combination of weighted average and point aggregation is used to ensure that the ridgeline extends smoothly along the actual terrain, and the characteristic points of the ridge are on the ridgeline, which is consistent with the actual terrain. The computer method is used to complete the extraction of the ridgeline, and the automatic extraction of terrain features is realized. A variety of redundancy removal processes are performed in the process to improve the anti-noise ability of the algorithm. At the same time, for terrain data with large data volume, good extraction effect and speed can be achieved, which greatly improves work efficiency and user experience.
[0121] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0122] The standard parts used in this application document can all be purchased from the market and can be customized according to the instructions and drawings. The specific connection methods of each part adopt conventional means such as mature bolts, rivets, welding, etc. in the prior art. The machinery, parts and equipment all adopt conventional models in the prior art. The control method is automatic control through a controller. The control circuit of the controller can be implemented through simple programming by technicians in this field, which is common knowledge in this field. Therefore, this application document will no longer explain the control method and circuit connection in detail.
[0123] Although the embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention.
Claims
1. A method for automatically extracting terrain ridgelines based on a weighted topological network graph, characterized in that: The following steps are involved: S1 rasterizes the terrain of the target area and obtains DEM data; S2 sets the sampling step size to downsample the DEM and obtain the sampling point image; S3 uses the neighborhood search method to extract the target point from the sampling point image, and uses the neighborhood mean smoothing to perform correction processing to obtain the weighted mountain top point; S4 refines the mountain top point image and retains the mountain top points on the ridgeline skeleton; S5 constructs a weighted topological network graph for the peak point graph, uses the Kruskal algorithm to break the closed graph, and forms a maximum spanning tree; S6 filters short ridgelines, short branches on ridgelines, and redundant branches; S7 uses a method combining point aggregation and weighted average to smooth the ridge line and obtain the final ridge line.
2. The method for automatically extracting terrain ridgelines based on a weighted topological network graph according to claim 1, characterized in that: The step S2 comprises: S21, parameter selection: The sampling step size is usually the smaller value of the number of rows and columns multiplied by the sampling ratio a. The size of the ratio setting determines the degree of downsampling. If the downsampling degree is too high, the feature points will be misjudged. If the downsampling degree is too low, the ridge feature points will not be identified and the extraction efficiency will be affected. S22, collecting DEM corresponding grid values at a certain interval according to a preset sampling step, and the obtained sampling point image is used for the next step of calculation.
3. The method for automatically extracting terrain ridgelines based on a weighted topological network graph according to claim 1, characterized in that: The step S3 comprises: S31, the mountain top point is defined as the point corresponding to the maximum elevation in a certain area. If there is a point P that satisfies all the conditions in formula (1) in a certain section of the pixel along eight directions (east-west, north-south, northeast-southwest, northwest-southeast), it is a potential mountain top point and is assigned a value of 1, otherwise it is assigned a value of 0, where L(P) is the number of sampling points with a smaller elevation value than point P among the four sampling points extending from the left side of the section, and R(P) is the number of sampling points with a smaller elevation value than point P among the four sampling points extending from the right side of the section; S32, neighborhood mean smoothing is to specify an n×n convolution template with a sampling point as the center, and calculate the average value of the pixel values in the neighborhood. The calculation formula is as shown in formula (2), where i, j are the coordinates in the template, N is the number of pixels in the template, and f(x, y) is the pixel value at the center of the template; Regarding the selection of the window size, the specific operation can be set by the technicians in this field. Usually, the average focus statistics under the default 5×5 window can obtain better result accuracy and efficiency. S33, after performing a subtraction operation on the original image and the image smoothed by the neighborhood mean, the pixels above the zero value are assigned a value of 1, which is a positive terrain, and the pixels below the zero value are assigned a value of 0, which is a negative terrain; S34, using the positive and negative terrain images to correct the potential mountain top point image, can filter out the points in the negative terrain that are mistakenly classified as mountain tops, and effectively remove noise points; S35, setting the weight of each mountain top point to the original grayscale value of the pixel.
4. The method for automatically extracting terrain ridgelines based on a weighted topological network graph according to claim 1, characterized in that: The step S4 comprises: The Zhang-Suen thinning algorithm is a classic thinning algorithm. It can be used to process the result point set of S3 to retain the peak points on the trunk and effectively remove the redundant branches generated by invalid peak points. The specific algorithm is as follows: S41, first specify a 3×3 neighborhood analysis window, the window pixel number is as shown in formula (3), and the operation of the algorithm includes two stages; S42, stage 1, if pixel P1 satisfies all the conditions in formula (4), then pixel P1 can be set to zero, where B(P1) represents the number of non-zero neighboring pixels of P1, and A(P1) represents the number of times the pixel value changes from 0 to 1 in the clockwise direction from P2 to P2; S43, stage 2, if pixel P1 satisfies all the conditions in formula (5), then pixel P1 can be set to zero, where B(P1) represents the number of non-zero neighboring pixels of P1, and A(P1) represents the number of times the pixel value changes from 0 to 1 in the clockwise direction from P2 to P2; 5. The method for automatically extracting terrain ridgelines based on a weighted topological network graph according to claim 1, characterized in that: The step S5 comprises: S51, taking the target mountain top point as the center, searching for other target mountain top points in eight directions in a 3×3 rectangular neighborhood to connect with it, and assigning a weight to each edge equal to the sum of the weights of the two target mountain top points. After completion, a weighted topological network diagram of the mountain top points is obtained; S52, according to Kruskal's idea of constructing a spanning tree, all the edges in the weighted topological network are sorted in descending order according to the weights and stored in the edge set to be selected; S53, taking the edge with the largest weight from the set of edges to be selected and adding it to the spanning tree; S54, determining whether the added edge has any intersection with a non-endpoint of the spanning tree, if not, adding the edge to the spanning tree, otherwise removing the edge from the spanning tree; S55, determining whether the added edge forms a closed loop with the spanning tree, if not, adding the edge to the spanning tree, otherwise, removing the edge from the spanning tree; S56, repeating the operations of S43, S44, and S45 until the set of edges to be selected is empty.
6. The method for automatically extracting terrain ridgelines based on a weighted topological network graph according to claim 1, characterized in that: The step S6 comprises: S61, determining a ridgeline threshold, and ridgelines and branches smaller than the threshold are defined as short branches and invalid ridgelines; It is generally believed that this threshold is not a fixed value. After research, it was found that removing ridge lines and branches with an actual length of less than 200m can achieve better denoising effects; S63, remove all defined short branches and invalid ridge lines; S64, points without connection relationships will be removed from the target mountain top point set.
7. The method for automatically extracting terrain ridgelines based on a weighted topological network graph according to claim 1, characterized in that: The step S7 comprises: S71, use weighted average to perform the first step of smoothing the ridge line: specify a 3×3 neighborhood analysis window, calculate the weighted average of the row and column numbers of the pixels in the neighborhood, and the calculation formula is as shown in formula (6) and formula (7), where N is the number of pixels in the neighborhood analysis window, x is n ,y n is the row and column number of the original pixel, w n is the corresponding pixel weight, f(x) and f(y) are the row and column numbers after smoothing; S72, clustering point operation: specify an n×n neighborhood analysis window, merge the points with connection relationship in the window into a cluster, and take the cluster point with the largest weight as the cluster center; In order to avoid eliminating the ridgeline features when aggregating the target mountain top points, the aggregation sampling window should not be too large. The default setting of 3×3 can achieve good results. S73, calculating the connection relationship of the cluster according to the connectivity relationship of all target mountain top points in the cluster: traversing to obtain the target mountain top point in the cluster, obtaining the adjacent points of the target mountain top point, and if the adjacent point and the target mountain top point do not belong to the same cluster, then establishing a connection relationship between the two clusters; S74, obtaining the coordinates of each cluster center point after the first smoothing as a new cluster center, and drawing a ridge line according to the new cluster center and the connection relationship, which is the second smoothing of the ridge line; S75, the final result of the ridge line is obtained after two smoothing steps.
Citation Information
Patent Citations
Self-adaptive valley and ridge line extraction method and system based on scale space
CN105550691A
Ridge line extraction method and device, storage medium and electronic equipment
CN117911434A
Mountain line extraction method based on Gaussian scale space
CN104899865A
Ridge line and valley line extraction method based on DBSCAN clustering analysis
CN113807437A
Topographic relief image generation method and topographic relief image generation device
JP2012003400A