Contour line extraction method, device, equipment, medium and product
Through the gradient calculation and differentiated filtering processing of DEM data, combined with hierarchical mosaic technology, the problem of poor contour extraction effect in plain areas is solved, and high-precision and clear and smooth contour extraction is achieved.
Patent Information
- Application Number
- CN202510436161.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-08
- Publication Date
- 2025-07-22
AI Technical Summary
The prior art has poor contour extraction effect in plain areas, and the influence of tiny landforms leads to overexpression of contour lines and the line shape is not clear and smooth enough.
By obtaining DEM data, determining the gradient calculation window and segmentation stages, establishing differentiated low-pass filtering parameters, performing filtering processing and partitioning the hierarchical mosaic of the DEM set, generating mosaic results DEM_P, performing contour extraction, and performing quality verification and iterative optimization.
The accuracy and effect of contour extraction is improved, and the problem of poor contour extraction effect in plain areas is solved, ensuring that the contour is clear and smooth.
Smart Images

Figure CN120355859A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of geographic information technology, and particularly to a contour extraction method, device, equipment, medium and product. Background Art
[0002] Using a high-precision digital elevation model (DEM) to extract contours is a common method in the application of geographic information systems. For areas with large terrain undulations, there are not too many problems with directly extracting contours using DEM. However, for plain areas, due to the influence of micro-undulating landforms, the contours directly extracted using DEM are very messy and difficult to use.
[0003] Currently in the market, for the contour extraction algorithm based on regular grid DEM, many studies have been carried out in terms of relationship construction and algorithm efficiency, and the contour extraction effect under this idea has reached a certain level. But with the continuous development of DEM data production technology, such as: making DEM based on satellite stereo image dense point cloud matching, making DEM based on airborne Lidar point cloud data, etc., the DEM data expresses micro-landforms more accurately and richly. At this time, when extracting contours based on the current research methods, the results inevitably over-express micro-landforms, resulting in too frequent "jitter" of the contours and the linear expression being significantly unclear and smooth. Summary of the Invention
[0004] The purpose of the present application is to provide a contour extraction method, device, equipment, medium and product, which can effectively solve the problem of poor contour extraction effect in plain areas while ensuring the extraction accuracy.
[0005] To achieve the above purpose, the present application provides the following solutions:
[0006] In a first aspect, the present application provides a contour extraction method, including:
[0007] Obtain the DEM data of the target area;
[0008] Determine a gradient calculation window according to the spatial resolution of the DEM data and the contour interval of the contour to be extracted;
[0009] Obtain a gradient matrix A according to the maximum gradient of each DEM data within the gradient calculation window;
[0010] Determine the segmentation level n according to the distribution characteristics of the maximum gradients in the gradient matrix A;
[0011] Based on the DEM data and the segmentation level n, respectively establish a first matrix and a second matrix; the first matrix includes n DEM data copies; the second matrix is a binary mask dilation matrix generated by performing binaryization and dilation operations on each DEM data copy in the first matrix;
[0012] For each DEM data copy in the first matrix, differential low-pass filtering parameters are respectively set for filtering to generate a filtered DEM set;
[0013] The filtered DEM set is multiplied by the second matrix point by point to generate a partitioned DEM set;
[0014] According to the terrain undulation degree of the target area, hierarchical mosaicking is performed on the partitioned DEM set to obtain the mosaicked result DEM_P;
[0015] Based on the mosaicked result DEM_P, contour extraction is performed on the target area.
[0016] Optionally, after contour extraction is performed on the target area based on the mosaicked result DEM_P, it further includes:
[0017] A partition detection method is used to verify the quality of the extracted contours;
[0018] When it is detected that the contour quality at any partition does not meet the standard, the low-pass filtering parameters of the partition are adjusted for iterative optimization.
[0019] Optionally, according to the spatial resolution of the DEM data and the contour interval of the contours to be extracted, a gradient calculation window is determined, specifically including:
[0020] According to the formula Determine the gradient calculation window;
[0021] In the formula, I is the contour interval, R is the DEM grid interval, and γ is the terrain coefficient.
[0022] Optionally, before obtaining the gradient matrix A based on the maximum gradient of each DEM data within the gradient calculation window, it further includes:
[0023] Determine the maximum gradient of each DEM data, specifically including:
[0024] According to the formula R k =mean(abs(A[i,j]-{A[i+d kx ,i+d ky |i,j=1,2,…,α}));
[0025] Among them, R k is the maximum gradient in the k direction, A[i,j] represents the unit value at the point (i,j), d kx is the distance in the x direction, d ky is the distance in the y direction, and α is the gradient window size.
[0026] Optionally, for each DEM data copy in the first matrix, different low-pass filtering parameters are set respectively for filtering to generate a filtered DEM set, specifically including:
[0027] According to the gradient division of the geomorphic sub-regions of the target area, set the size of the low-pass filtering convolution kernel; the lower the gradient of the geomorphic sub-region, the larger the size of the low-pass filtering convolution kernel; the higher the gradient of the geomorphic sub-region, the smaller the size of the low-pass filtering convolution kernel.
[0028] For each geomorphic sub-region, use the corresponding low-pass filtering convolution kernel to perform convolution operation on the DEM data copy to obtain the smoothed DEM data copy;
[0029] Generate a filtered DEM set according to each smoothed DEM data copy.
[0030] Optionally, perform hierarchical mosaicking on the partitioned DEM set according to the terrain undulation degree of the target area to obtain the mosaicked result DEM_P, specifically including:
[0031] When performing hierarchical mosaicking on the overlapping areas in the partitioned DEM set, perform hierarchical mosaicking on the partitioned DEM set based on the high-value area filtering result; the high-value area filtering result is the filtering result of the area with a high gradient in the geomorphic sub-region.
[0032] In a second aspect, the present application provides a contour extraction device, including:
[0033] A data acquisition module, configured to acquire DEM data of the target area;
[0034] A gradient calculation window calculation module, configured to determine a gradient calculation window according to the spatial resolution of the DEM data and the contour interval of the contour to be extracted;
[0035] A gradient matrix calculation module, configured to obtain a gradient matrix A according to the maximum gradient of each DEM data in the gradient calculation window;
[0036] A segmentation level calculation module, configured to determine the segmentation level n according to the distribution characteristics of the maximum gradients in the gradient matrix A;
[0037] A matrix establishment module, configured to respectively establish a first matrix and a second matrix based on the DEM data and the segmentation level n; the first matrix includes n DEM data copies; the second matrix is a binary mask dilation matrix generated after binarization and dilation operations on each DEM data copy in the first matrix;
[0038] A filtering module, configured to, for each DEM data copy in the first matrix, set different low-pass filtering parameters respectively for filtering to generate a filtered DEM set;
[0039] A partitioned DEM set generation module, configured to perform a dot product operation on the filtered DEM set and the second matrix to generate a partitioned DEM set;
[0040] A mosaicking module, configured to hierarchically mosaic the partitioned DEM set according to the terrain undulation degree of the target area to obtain a mosaicked result DEM_P;
[0041] An extraction module, configured to extract contour lines from the target area based on the mosaicked result DEM_P.
[0042] In a third aspect, the present application provides a computer device, including: a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor executes the computer program to implement a contour line extraction method described in any one of the above.
[0043] In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, it implements a contour line extraction method described in any one of the above.
[0044] In a fifth aspect, the present application provides a computer program product, including a computer program, and when the computer program is executed by a processor, it implements a contour line extraction method described in any one of the above.
[0045] According to the specific embodiments provided by the present application, the following technical effects are disclosed in the present application:
[0046] The present application provides a contour extraction method, device, equipment, medium and product. First, by obtaining the DEM data of the target area, it provides the basic data for subsequent contour extraction. Then, according to the spatial resolution of the DEM data and the contour interval of the contour to be extracted, a gradient calculation window is determined. This step ensures the accuracy and applicability of gradient calculation and provides the basis for subsequent generation of the gradient matrix. After generating the gradient matrix A, the segmentation level n is determined according to the distribution characteristics of each maximum gradient. This step reasonably determines the segmentation level by analyzing the distribution of gradients and provides the key parameters for subsequent establishment of the first matrix and the second matrix. By establishing the first matrix and the second matrix, where the second matrix is a binary mask dilation matrix generated after binarization and dilation operations on each DEM data copy in the first matrix. This step effectively differentiates different terrain features and provides accurate mask information for subsequent filtering processing. Then, for each DEM data copy in the first matrix, different low-pass filtering parameters are set respectively for filtering processing to generate a filtered DEM set. This step performs precise filtering processing for different terrain features through different filtering parameters, effectively reducing noise interference and improving the extraction accuracy. The filtered DEM set is multiplied by the second matrix point by point to generate a partitioned DEM set. This step uses the binary mask dilation matrix to partition the filtered DEM data, further improving the extraction accuracy and effect. Finally, according to the terrain undulation degree of the target area, hierarchical mosaicking is performed on the partitioned DEM set to obtain the mosaicked result DEM_P, and contour extraction is performed on the target area based on the mosaicked result DEM_P. This step comprehensively considers the terrain undulation degree through hierarchical mosaicking of the partitioned DEM set, making the contour extraction result more accurate and complete, and effectively solving the problem of poor contour extraction effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0048] Figure 1 It is an application environment diagram of a contour extraction method in an embodiment of the present application;
[0049] Figure 2 It is a flowchart of a contour extraction method provided in an embodiment of the present application;
[0050] Figure 3An effect diagram of extracting contour lines in flat areas based on satellite image dense point cloud matching DEM provided by an embodiment of the present application;
[0051] Figure 4 A flowchart of a contour line extraction algorithm provided by an embodiment of the present application;
[0052] Figure 5 A schematic diagram of low-pass filtering provided by an embodiment of the present application;
[0053] Figure 6 A schematic diagram of protrusions caused by direct DEM mosaicking and their elimination provided by an embodiment of the present application;
[0054] Figure 7 A schematic diagram of functional modules of a contour line extraction device provided by an embodiment of the present application;
[0055] Figure 8 A schematic diagram of the structure of a computer device provided by an embodiment of the present application. Detailed implementation manners
[0056] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0057] To make the above objects, features, and advantages of the present application more obvious and understandable, the present application will be further described in detail below with reference to the accompanying drawings and specific implementation manners.
[0058] The contour line extraction method provided by the embodiments of the present application can be applied to, for example Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be set separately, integrated on the server 104, placed on the cloud or other servers. The terminal 102 can send the DEM data of the target area to the server 104. After receiving the DEM data of the target area, for the DEM data of the target area, the server 104 determines a gradient calculation window according to the spatial resolution of the DEM data and the contour interval of the contour to be extracted; obtains a gradient matrix A according to the maximum gradient of each DEM data within the gradient calculation window; determines the segmentation level n according to the distribution characteristics of each maximum gradient in the gradient matrix A; respectively establishes a first matrix and a second matrix based on the DEM data and the segmentation level n; the first matrix includes n DEM data copies; the second matrix is a binary mask dilation matrix generated after binarization and dilation operations on each DEM data copy in the first matrix; for each DEM data copy in the first matrix, different low-pass filtering parameters are respectively set for filtering processing to generate a filtered DEM set; the filtered DEM set is multiplied by the second matrix point by point to generate a partitioned DEM set; the partitioned DEM set is hierarchically mosaicked according to the terrain undulation degree of the target area to obtain a mosaicked result DEM_P; based on the mosaicked result DEM_P, contour extraction is performed on the target area. The server 104 can feedback the obtained contour to the terminal 102. In addition, in some embodiments, the contour extraction method can also be implemented independently by the server 104 or the terminal 102. For example, the terminal 102 can directly perform contour extraction on the DEM data of the target area, or the server 104 can obtain the DEM data of the target area from the data storage system and perform contour extraction processing on the DEM data of the target area.
[0059] Among them, the terminal 102 can be, but is not limited to, various desktop computers, laptop computers, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, etc. The portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The server 104 can be implemented by an independent server or a server cluster composed of multiple servers, and can also be a cloud server.
[0060] In an exemplary embodiment, as Figure 2 shown, a contour extraction method is provided. This method is executed by a computer device, and can be specifically executed independently by a computer device such as a terminal or a server, or jointly executed by a terminal and a server. In the embodiments of the present application, taking this method as applied to Figure 1Taking the server 104 in [as an example for illustration, it includes the following steps 201 to step 209. Among them:
[0061] Step 201, obtain the DEM data of the target area;
[0062] Step 202, determine the gradient calculation window according to the spatial resolution of the DEM data and the contour interval of the contour to be extracted;
[0063] Step 203, obtain the gradient matrix A according to the maximum gradient of each DEM data within the gradient calculation window;
[0064] Step 204, determine the segmentation level n according to the distribution characteristics of each maximum gradient in the gradient matrix A;
[0065] Step 205, based on the DEM data and the segmentation level n, establish a first matrix and a second matrix respectively; the first matrix includes n DEM data copies; the second matrix is a binary mask dilation matrix generated after binarization and dilation operations on each DEM data copy in the first matrix;
[0066] Step 206, for each DEM data copy in the first matrix, set different low-pass filtering parameters for filtering processing to generate a filtered DEM set;
[0067] Step 207, perform a dot product operation on the filtered DEM set and the second matrix to generate a partitioned DEM set;
[0068] Step 208, perform hierarchical mosaicking on the partitioned DEM set according to the terrain undulation degree of the target area to obtain the mosaicked result DEM_P;
[0069] Step 209, perform contour extraction on the target area based on the mosaicked result DEM_P.
[0070] Among them, as Figure 4 shown, when performing steps 202-205, during the DEM segmentation process, determine the gradient window and the segmentation level, specifically as follows:
[0071] When dividing the DEM into multiple sub-areas, two parameters, namely the gradient window and the segmentation level for landform classification, need to be determined.
[0072] Specifically, the gradient window: refers to the unit range that needs to be calculated when calculating the slope, generally determined according to the DEM resolution and the contour extraction interval. Its value is recommended as:
[0073]
[0074] Where I is the contour interval (in meters), R is the DEM grid interval (in meters), and γ is the terrain coefficient. Generally, the terrain coefficient is recommended to be 3, 5, and 7 for high mountains, medium and low mountains / hills, and plains respectively. Users can also customize this value according to the actual micro-topographic features.
[0075] Segmentation level: It is the number of levels for DEM to be segmented and filtered, that is, the number of levels for DEM to be partitioned. This value is mainly determined according to the geomorphic changes. According to experience, generally 5 levels (β = 5) are sufficient. Users can also adjust it according to the geomorphic features of the working area.
[0076] Among them, when calculating the DEM gradient matrix, determine the gradient calculation window (i.e., the gradient calculation grid distance), calculate the maximum gradient (i.e., the maximum elevation change value) of each grid in the DEM within the calculation window, and form the gradient matrix A.
[0077] Specifically, it is necessary to extract the maximum gradient of each grid from the DEM. For each grid, its maximum gradient refers to the maximum gradient value in the 8-neighborhood (direction) of the grid within the gradient window. For a certain direction k, its gradient value is the average value of the gradients at different distances in this direction. The calculation method is as follows:
[0078] R k = mean(abs(A[i,j] - {A[i + d kx ,j + d ky |i,j = 1,2,…,α})).
[0079] In the formula, R k refers to the maximum gradient in the k direction, A[i,j] represents the cell value at the point (i,j), d kx refers to the distance in the x direction, d ky refers to the distance in the y direction, and α refers to the size of the gradient window.
[0080] Then, when performing DEM segmentation, after obtaining the DEM gradient matrix, taking the 5-level segmentation as an example, set 0.02, 0.05, 0.1, 0.15 as the segmentation points (these values are commonly used values for geomorphic zoning in geography), segment the DEM, and form the first matrix {DEM1, DEM2,…, DEM n}, and DEM1 = DEM2 = …… = DEM n = DEM, and perform binarization processing on each segmentation so that its value range is {0,1}, where the value is 1 within the segmentation range and the rest are 0. Then perform dilation operation on each partition. The dilation operation parameters are generally set to {1,2,4,8,16} (matching the size of the convolution kernel in the low-pass band), and form the second matrix {DEM1_Mask, DEM2_Mask, ……, DEM5_Mask} = DEM_Mask.
[0081] Among them, as Figure 4 shown, when performing step 206, specifically, it can be as follows:
[0082] The function of low-pass filtering is to eliminate microtopography. Generally, median filtering or mean filtering can be used. The low-pass filtering convolution kernels are set to {3, 5, 9, 17, 33} respectively according to the landform division from high to low (from high-gradient area to low-gradient area). Then, the DEM is convolved with this convolution kernel to obtain a set of smoothed DEMs {DEM1_F, DEM2_F, ……, DEM5_F}. Each smoothed DEMi_F has the same pixel length and width as the original DEM. Taking the convolution kernel set to 3 and using mean filtering as an example, the filtering process is as Figure 5 shown.
[0083] Among them, as Figure 4 shown, when performing steps 207 - 209, specifically, it can be as follows:
[0084] According to the level correspondence relationship, multiply the filtered DEM i _F ∈ {DEM1_F, DEM2_F, ……, DEM5_F} and DEM i _Mask ∈ {DEM1_Mask, DEM2_Mask, …, DEM n _Mask} to perform dot multiplication operation to form the filtered partition DEM i _D ∈ {DEM1_D, DEM2_D, ……, DEM5_D}. The function of the dot multiplication operation is to segment the DEM filtered with different parameters according to the slope division to form a set of filtered DEMs in different gradient regions. Specifically, the formula of DEM i _D is as follows:
[0085] DEM i _D = DEM i _F · DEM i _Mask.
[0086] Among them, during the partition low-pass filtering process, due to the different filter sizes in different regions, there will be small protrusions at the junction of the plain and the mountainous area ( Figure 6(as shown by the inner frames of the two boxes in (a)). The reason for this protrusion is that in the part of the plain area close to the mountainous area (designated as area A), since the high-value area of the mountainous area also participates in filtering, the resulting elevation value will be significantly higher than the elevation value of the plain area. And because the filter used in the mountainous area is very small, at the foot of the mountain (designated as area B), the elevation value after filtering is less affected by the high-value area of the mountainous area, and its value sometimes will be lower than the elevation value of area A, which does not conform to the actual landform and needs to be processed during mosaicking. In order to eliminate some possible topographic protrusions caused by different filter sizes, when mosaicking the DEM partitions, for the overlapping area of the partitioned DEM, generally the filtering result of the high-value area (relative to the low value) is used as the final value of the mosaicking data, that is, the mosaicking priority needs to be sorted from high to low according to the landform type, and then the DEM mosaicking is carried out, and finally Figure 6 the effect shown in (b) of
[0087] Then, after completing the DEM mosaicking, directly use a general GIS software (such as QGIS) to extract the contour lines. Then evaluate the extracted contour lines by analyzing the difference between the extracted contour lines and the original DEM elevation values. If the accuracy of the contour lines in a certain gradient partition is insufficient, it is necessary to return to step 2 (DEM low-pass filtering) according to experience, reset the filtering parameters of this gradient partition (generally 2 / 3 of the original), and then repeat the subsequent work until the data meets the requirements.
[0088] After completing the contour line extraction, the contour lines can be smoothed using simple line or smooth line to obtain qualified contour lines. The extracted qualified contour lines are as Figure 3 shown.
[0089] Based on the same inventive concept, the embodiment of the present application also provides a contour line extraction device for implementing the above-mentioned contour line extraction method. The solution provided by this device to solve the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the following contour line extraction devices can refer to the limitations on the contour line extraction method in the above text, and will not be repeated here.
[0090] In an exemplary embodiment, as Figure 7 shown, a contour line extraction device is provided, including:
[0091] A data acquisition module 701, configured to acquire DEM data of a target area;
[0092] A gradient calculation window calculation module 702, configured to determine a gradient calculation window according to the spatial resolution of the DEM data and the contour interval of the contour lines to be extracted;
[0093] The gradient matrix calculation module 703 is configured to calculate the maximum gradient of each DEM data within the gradient calculation window to obtain a gradient matrix A;
[0094] The segmentation level calculation module 704 is configured to determine the segmentation level n according to the distribution characteristics of the maximum gradients in the gradient matrix A;
[0095] The matrix establishment module 705 is configured to respectively establish a first matrix and a second matrix based on the DEM data and the segmentation level n; the first matrix includes n DEM data copies; the second matrix is a binary mask dilation matrix generated after binarization and dilation operations on each DEM data copy in the first matrix;
[0096] The filtering module 706 is configured to perform filtering processing by respectively setting different low-pass filtering parameters for each DEM data copy in the first matrix to generate a filtered DEM set;
[0097] The partitioned DEM set generation module 707 is configured to perform a dot product operation on the filtered DEM set and the second matrix to generate a partitioned DEM set;
[0098] The mosaicking module 708 is configured to perform hierarchical mosaicking on the partitioned DEM set according to the terrain undulation degree of the target area to obtain a mosaicked result DEM_P;
[0099] The extraction module 709 is configured to perform contour extraction on the target area based on the mosaicked result DEM_P.
[0100] In an exemplary embodiment, a computer device is provided. The computer device can be a server or a terminal, and its internal structure diagram can be as Figure 8 shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, abbreviated as I / O), and a communication interface. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store contour extraction data. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals through a network connection. When the computer program is executed by the processor, it implements a contour extraction method.
[0101] Those skilled in the art can understand, Figure 8The structure shown is only a block diagram of some structures related to the solution of this application, and does not constitute a limitation on the computer device to which the solution of this application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0102] In an exemplary embodiment, a computer device is further provided, including a memory and a processor. A computer program is stored in the memory, and when the processor executes the computer program, the steps in the above method embodiments are implemented.
[0103] In an exemplary embodiment, a computer-readable storage medium is provided, storing a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0104] In an exemplary embodiment, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the steps in the above method embodiments are implemented.
[0105] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.
[0106] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, a database, or other media used in the embodiments provided in the present application can include at least one of non-volatile and volatile memories. Non-volatile memories can include read-only memory (ROM), magnetic tapes, floppy disks, flash memories, optical memories, high-density embedded non-volatile memories, resistive random access memories (ReRAM), magnetoresistive random access memories (MRAM), ferroelectric random access memories (FRAM), phase change memories (PCM), graphene memories, etc. Volatile memories can include random access memory (RAM) or external cache memories, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.
[0107] The databases involved in the embodiments provided in the present application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in the present application can be general-purpose processors, central processors, graphics processors, digital signal processors, programmable logics, data processing logics based on quantum computing, etc., without limitation.
[0108] In summary, the present application has the following technical effects:
[0109] (1) In response to the overexpression of micro-topography, the present application introduces the idea of processing the micro-topography of DEM data. According to the requirements and topographic characteristics, the data can be classified, and different filtering algorithms and parameters can be selected for each level of features. The micro-topography is first processed at the data source end, thereby eliminating the clutter of contour lines caused by it.
[0110] (2) When performing zonal filtering on the DEM according to different landforms and then merging the filtering results, due to different filtering parameters for each zone, there may be slight elevation mutations at the junctions of the zones, which will ultimately cause the problem of unnatural transitions in the contour lines extracted in this area. In response to this, a DEM stitching processing method based on morphological operations is proposed in this application, realizing the natural transition stitching of DEMs in different filtering zones, and thus solving the problem of unnatural transitions in the stitched contour lines in the DEM intersection area.
[0111] (3) The method of this application only involves the process of DEM micro-landform processing and does not involve the data conversion process of interpolating and extracting contour lines from raster data. Therefore, after the method of this application processes the DEM micro-landform, the advantages of relationship construction and algorithm research in various raster data contour extraction methods at home and abroad can also be adopted. That is, after using the technology of this application to process the DEM data source for micro-landforms, according to the landform characteristics, extraction requirements, etc., other mature raster interpolation extraction algorithms can be used to extract contour lines to form complementary advantages and enhance the extraction efficiency and effect of contour lines.
[0112] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0113] Specific examples are used in this article to elaborate on the principle and implementation manner of this application. The description of the above embodiments is only used to help understand the method of this application and its core idea; at the same time, for those of ordinary skill in the art, based on the idea of this application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to this application.
Claims
1. A contour extraction method, characterized in that, Including: Obtain the DEM data of the target area; Determine the gradient calculation window according to the spatial resolution of the DEM data and the contour interval of the contour to be extracted; Obtain the gradient matrix A according to the maximum gradient of each DEM data within the gradient calculation window; Determine the segmentation level n according to the distribution characteristics of the maximum gradients in the gradient matrix A; Based on the DEM data and the segmentation level n, establish a first matrix and a second matrix respectively; the first matrix includes n DEM data copies; The second matrix is a binary mask dilation matrix generated after binarization and dilation operations on each DEM data copy in the first matrix; For each DEM data copy in the first matrix, set different low-pass filtering parameters for filtering to generate a filtered DEM set; Perform a dot product operation on the filtered DEM set and the second matrix to generate a partitioned DEM set; Perform hierarchical mosaicking on the partitioned DEM set according to the terrain undulation degree of the target area to obtain the mosaicked result DEM_P; Extract the contour of the target area based on the mosaicked result DEM_P.
2. The contour extraction method according to claim 1, wherein After extracting the contour of the target area based on the mosaicked result DEM_P, it further includes: Adopt a partition detection method to verify the quality of the extracted contour; When it is detected that the contour quality at any partition does not meet the standard, adjust the low-pass filtering parameters of the partition for iterative optimization.
3. A contour extraction method according to claim 1, characterized in that, Determine the gradient calculation window according to the spatial resolution of the DEM data and the contour interval of the contour to be extracted, specifically including: According to the formula Determine the gradient calculation window; In the formula, I is the contour interval, R is the DEM grid interval, and γ is the terrain coefficient.
4. A contour extraction method according to claim 1, characterized in that Before obtaining the gradient matrix A according to the maximum gradient of each DEM data within the gradient calculation window, it further includes: Determine the maximum gradient of each DEM data, specifically including: According to the formula R k = mean(abs(A[i,j] - {A[i+d kx ,j+d ky |i,j = 1,2,…,α})); Among them, R k is the maximum gradient in the k direction, A[i, j] represents the cell value at the point (i, j), d kx is the distance in the x direction, d ky is the distance in the y direction, and α is the gradient window size.
5. A contour extraction method according to claim 1, characterized in that, For each DEM data copy in the first matrix, set different low-pass filtering parameters for filtering to generate a filtered DEM set, specifically including: Set the size of the low-pass filtering convolution kernel according to the gradient division of the geomorphic partition of the target area; the lower the gradient of the geomorphic partition, the larger the size of the low-pass filtering convolution kernel; the higher the gradient of the geomorphic partition, the smaller the size of the low-pass filtering convolution kernel; For each geomorphic partition, use the corresponding low-pass filtering convolution kernel to perform convolution operation on the DEM data copy to obtain the smoothed DEM data copy; Generate a filtered DEM set according to each smoothed DEM data copy.
6. The contour extraction method according to claim 5, characterized in that Perform hierarchical mosaicking on the partitioned DEM set according to the terrain undulation degree of the target area to obtain the mosaicked result DEM_P, specifically including: When performing hierarchical mosaicking on the overlapping areas in the partitioned DEM set, perform hierarchical mosaicking on the partitioned DEM set based on the high-value area filtering result; the high-value area filtering result is the filtering result of the area with high gradient in the geomorphic partition.
7. A contour extraction device, characterized in that, Including: A data acquisition module for obtaining the DEM data of the target area; A gradient calculation window calculation module for determining the gradient calculation window according to the spatial resolution of the DEM data and the contour interval of the contour to be extracted; A gradient matrix calculation module, configured to calculate the maximum gradient of each DEM data within the gradient calculation window to obtain a gradient matrix A; A segmentation level calculation module, configured to determine the segmentation level n according to the distribution characteristics of the maximum gradients in the gradient matrix A; A matrix establishment module, configured to respectively establish a first matrix and a second matrix based on the DEM data and the segmentation level n; the first matrix includes n DEM data copies; The second matrix is a binary mask dilation matrix generated after performing binaryization and dilation operations on each DEM data copy in the first matrix; A filtering module, configured to respectively set different low-pass filtering parameters for each DEM data copy in the first matrix for filtering processing to generate a filtered DEM set; A partitioned DEM set generation module, configured to perform a dot product operation on the filtered DEM set and the second matrix to generate a partitioned DEM set; A mosaicking module, configured to perform hierarchical mosaicking on the partitioned DEM set according to the terrain undulation degree of the target area to obtain a mosaicked result DEM_P; An extraction module, configured to perform contour extraction on the target area based on the mosaicked result DEM_P.
8. A computer device, comprising: A memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor executes the computer program to implement a contour extraction method according to any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements a contour extraction method according to any one of claims 1-6.
10. A computer program product comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements a contour extraction method according to any one of claims 1-6.