Hole elimination method and system for grid-to-vector surface

Through boundary tracing and hole elimination algorithms, the Kruskal and BFS algorithms are used to identify and eliminate holes, solving the hole problem in raster-to-vector conversion in existing technologies and generating high-quality continuous vector surface data suitable for geographic information systems and remote sensing image analysis.

CN120807814APending Publication Date: 2025-10-17TUZHIZHI (BEIJING) TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510828400.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-19
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

The existing technology has the problem of holes in the process of converting raster to vector surface, and is affected by the resolution of raster data and the interpolation method, making it difficult to accurately describe surface geographical phenomena.

Method used

Boundary tracking and hole elimination algorithms are used to identify and eliminate holes through the Kruskal algorithm and BFS algorithm, combined with dynamic threshold adjustment to form a continuous vector surface.

Benefits of technology

It achieves high-precision vector surface data generation, overcomes the void problem, improves processing efficiency, and adapts to different precision requirements. The generated vector surface data is of high quality and suitable for geographic information systems and remote sensing image analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120807814A_ABST
    Figure CN120807814A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of geographic information grid processing, in particular to a grid-to-vector surface void elimination method and system, and the method comprises the following steps: analyzing grid data, and carrying out the binarization of the grid data into a legal value and an illegal value; boundary tracking: for each legal grid, if illegal values exist in the upper, lower, left and right directions, marking the illegal values as boundary points; void identification: for each closed area, selecting any point on the boundary, calculating an internal point in the normal direction of the point, and if the point is located in the closed area, determining that the point is a void; void elimination: adopting a Kruskal algorithm to calculate a shortest connection relationship between voids, and distinguishing boundary voids from internal voids; and iteration processing: repeating the steps 2-4 until no holes exist, and outputting the continuous vector face.According to the grid-to-vector-plane hole elimination method and system, the holes in the area can be identified and eliminated, continuous and complete vector plane data are finally obtained, and the requirement for the continuous area in practical application is met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of geographic information raster processing technology, and in particular to a raster-to-vector surface hole elimination method and system. Background Art

[0002] In the prior art, when extracting a region from a grid, two methods, namely, contour line extraction and grid neighborhood connection, are usually used to obtain a vector surface.

[0003] The algorithm principle of the contour line extraction algorithm is as follows: 1. First, the raster data is layered according to a certain interval (such as 1m, 5m), that is, the data is divided into several levels according to the data size; 2. Then, for each layer of data, an interpolation method (such as inverse distance weighted method, Kriging interpolation method, etc.) is used to calculate the position of the contour line; 3. Finally, the contour lines of each layer are connected to form a complete contour line.

[0004] This algorithm is simple to understand and easy to implement. It can quickly extract the contour lines in the raster and convert them into vector data. However, this is affected by the resolution of the raster data. If the data resolution is low, the extraction accuracy will be even lower. In addition, the extraction results are also affected by the interpolation method, which will average out some small areas with large fluctuations. At the same time, the contour lines are composed of line segments and cannot describe the surface geographic scene well.

[0005] The algorithm for grid region tracking is as follows: 1. First, find the edge points of a feature set by scanning line by line. 2. Then, track along the edge of the planar feature until the entire region boundary (including the outer edge and any inner edges) is completely tracked (i.e., closed). 3. During the tracking process, the tracked grid positions Ik and Jk (k = 1, 2, ..., n) are converted to vector coordinates Xk and Yk according to equation (5-4) and recorded. Vectorized regions are marked so that they can be excluded when searching for other unvectorized regions.

[0006] This algorithm quickly and efficiently extracts each pixel in the grid, forming a high-precision surface. However, this algorithm will generate many scattered surfaces, and the formed vector surfaces have holes, which does not meet the requirements of practical applications.

[0007] Therefore, in view of the above situation, there is an urgent need to develop a raster-to-vector surface hole elimination method and system to overcome the shortcomings in current practical applications. Summary of the Invention

[0008] The object of the present invention is to provide a method and system for removing holes in raster-to-vector surfaces, so as to solve the problems raised in the above-mentioned background technology.

[0009] To achieve the above object, the present invention provides the following technical solutions:

[0010] A method for removing holes in raster-to-vector surfaces, comprising the following steps:

[0011] Step 1: parse the raster data and convert it into two values: legal and illegal.

[0012] Step 2: Boundary tracking: For each legal grid, if there are illegal values ​​in the four directions of up, down, left, and right, it is marked as a boundary point; based on the 8-directional neighbor relationship, the boundary points are tracked in a counterclockwise direction until a closed area is formed;

[0013] Step 3: Hole identification: For each closed area, select any point on the boundary and calculate the internal point in the normal direction. If the internal point is within the closed area, it is considered a hole.

[0014] Step 4: Hole elimination: Use the Kruskal algorithm to calculate the shortest connection between holes and distinguish between boundary holes and internal holes; use the BFS algorithm to connect the shortest path between internal holes and boundary holes and the region boundary, and modify the grid values ​​along the path to illegal values;

[0015] Step 5: Iterative processing: Repeat steps 2 to 4 until there are no holes and output a continuous vector surface.

[0016] As a further solution of the present invention: in step 2, it also includes: calculating the normal direction of the boundary point, and the normal direction is obtained by summing and normalizing the legal value vectors of the four neighborhoods.

[0017] As a further solution of the present invention: in step 4, it also includes: if there are adjacent boundary points with opposite normal directions in the closed area and the distance is less than a set threshold, then the corresponding grid value is modified to an illegal value.

[0018] As a further solution of the present invention: the set threshold is dynamically adjusted by the user according to accuracy requirements.

[0019] As a further solution of the present invention: in step 4, the BFS algorithm preferentially selects the path with the smallest grid value change.

[0020] A raster-to-vector surface hole removal system, comprising:

[0021] Data preprocessing module, used to parse raster data and binarize it into legal and illegal values;

[0022] A face tracking module, configured to execute step 2 of claim 1, comprising: a boundary point marking unit, configured to determine illegal values ​​based on four directions; a closed region generating unit, configured to track counterclockwise based on an eight-direction neighbor relationship;

[0023] A hole elimination module, used to execute steps 3 and 4 of claim 1, comprising: a hole identification unit, which judges based on internal points in the normal direction; a Kruskal algorithm unit, which calculates the shortest connection relationship between holes; a BFS algorithm unit, which connects the shortest paths and modifies the grid values; and a vector generation module, which outputs a continuous vector surface.

[0024] As a further solution of the present invention: the face tracking module also includes a normal calculation unit, which is used to sum and normalize the legal value vectors of the four neighborhoods of the boundary point.

[0025] As a further solution of the present invention: the hole elimination module further includes a threshold judgment unit, which is used to dynamically adjust the minimum distance threshold according to user configuration.

[0026] Compared with the prior art, the present invention has the following beneficial effects:

[0027] 1. It can effectively solve the problem of vector surface holes existing in existing technologies. By combining the surface tracking algorithm with the hole elimination technology, it can further identify and eliminate the holes in the initial closed area on the basis of forming an initial closed area, and finally obtain continuous and complete vector surface data, meeting the requirements for continuous areas in practical applications.

[0028] 2. Compared with the traditional contour line extraction method, the present invention is not limited by the resolution of raster data and the interpolation method, avoids the problem of averaging small-scale and large-scale areas, and can more accurately describe planar geographical phenomena;

[0029] 3. Compared with the conventional grid surface tracking method, this invention overcomes the defects of generating scattered surfaces and containing holes. It realizes automatic identification and elimination of holes through dynamic threshold judgment and specific algorithm combination (Kruskal+BFS), greatly improving processing efficiency and application value.

[0030] 4. This technology can flexibly adjust processing parameters according to the user's different requirements for accuracy. By setting control conditions such as the minimum distance threshold, it can achieve void processing with different accuracy levels, and has good adaptability and practicality.

[0031] 5. The vector surface data finally generated has high quality and good continuity, and can be directly applied to fields such as geographic information systems and remote sensing image analysis, providing more reliable basic data support for related applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 Schematic diagram of the flow of a method for removing holes in raster-to-vector surfaces according to an embodiment of the present invention. DETAILED DESCRIPTION

[0033] The following will provide a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of them. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0034] The specific implementation of the present invention is described in detail below with reference to specific embodiments.

[0035] See also Figure 1 , an embodiment of the present invention provides a method for removing holes in a raster-to-vector surface, comprising the following steps:

[0036] Step 1: parse the raster data and convert it into two values: legal and illegal.

[0037] Step 2: Boundary tracking: For each legal grid, if there are illegal values ​​in the four directions of up, down, left, and right, it is marked as a boundary point; based on the 8-directional neighbor relationship, the boundary points are tracked in a counterclockwise direction until a closed area is formed;

[0038] Step 3: Hole identification: For each closed area, select any point on the boundary and calculate the internal point in the normal direction. If the internal point is within the closed area, it is considered a hole.

[0039] Step 4: Hole elimination: Use the Kruskal algorithm to calculate the shortest connection between holes and distinguish between boundary holes and internal holes. Use the BFS algorithm (breadth-first search algorithm) to find the shortest path connecting internal holes and boundary holes with the region boundary, and modify the grid values ​​along the path to illegal values.

[0040] Step 5, iterative processing: Repeat steps 2 to 4 until there are no holes and output a continuous vector surface.

[0041] In step 2, it also includes: calculating the normal direction of the boundary point, where the normal direction is obtained by summing and normalizing the legal value vectors of the four neighborhoods.

[0042] In step 4, it also includes: if there are adjacent boundary points with opposite normal directions in the closed area and the distance is less than a set threshold, then modifying the corresponding grid value to an illegal value.

[0043] The set threshold is dynamically adjusted by the user according to accuracy requirements.

[0044] In step 4, the BFS algorithm preferentially selects the path with the smallest grid value change.

[0045] A raster-to-vector surface hole removal system, comprising:

[0046] Data preprocessing module, used to parse raster data and binarize it into legal and illegal values;

[0047] A face tracking module, configured to execute step 2 of claim 1, comprising: a boundary point marking unit, configured to determine illegal values ​​based on four directions; a closed region generating unit, configured to track counterclockwise based on an eight-direction neighbor relationship;

[0048] A hole elimination module, used to execute steps 3 and 4 of claim 1, comprising: a hole identification unit, which judges based on internal points in the normal direction; a Kruskal algorithm unit, which calculates the shortest connection relationship between holes; a BFS algorithm unit, which connects the shortest paths and modifies the grid values; and a vector generation module, which outputs a continuous vector surface.

[0049] The face tracking module also includes a normal calculation unit for summing and normalizing the legal value vectors of the four neighborhoods of the boundary point.

[0050] The hole elimination module further includes a threshold determination unit configured to dynamically adjust the minimum distance threshold according to user configuration.

[0051] The present invention's raster-to-vector surface hole removal method and system can eliminate holes in vector m-surfaces extracted from raster data, according to the user's varying accuracy requirements, ultimately obtaining a continuous vector surface and fulfilling the raster-to-vector surface conversion requirement. The technical principle is to utilize surface hole removal technology based on the results of a surface tracking algorithm to obtain more continuous surface regions that meet the requirements.

[0052] Example 1: Hole elimination method for raster-to-vector surface conversion;

[0053] S1. Prepare data: parse raster classification data, obtain grid matrix, and binarize all raster values.

[0054] S2, face tracking method:

[0055] 1) For each legal grid, if at least one of the four directions (up, down, left, and right) is illegal, it is considered a boundary point and the result is recorded. At the same time, the normal line calculated by normalizing the sum of the vectors of the four neighboring points (with legal values) in the four directions of the point is calculated and the result is recorded.

[0056] 2) Divide the grid's neighbor relationship into 8 directions. Starting from the starting point, determine whether the cell value in the next direction under the normal is a boundary according to the counterclockwise principle. If not, continue searching counterclockwise until the next boundary point is found. This boundary point is set as the starting point, and the search for neighboring boundary points is repeated until a duplicate boundary point is found, thus forming a closed region.

[0057] 3) Repeat step 2) until all boundary points are processed and multiple closed areas are formed.

[0058] S3. Eliminate areas that do not meet the threshold: For each closed region, calculate the distance between each boundary point within the region and any other boundary point within the region. If any distance is less than the minimum width and the normals are in opposite directions, set the value of the line connecting the two boundary points to an invalid value. After all closed regions are processed, if any region has been modified, perform the face tracking operation again.

[0059] S4. Mark holes: For each closed area, select any point on the boundary and calculate whether the coordinates of the point's normal vector are inside the closure. If so, the closed area is judged to be a grid hole and the result is recorded.

[0060] S5. Face region hole elimination: Use face region hole elimination technology to cut the non-hole closed area to form a continuous area. The specific steps are as follows:

[0061] 1) Use the Kruskal algorithm to find the shortest connection between any two holes (the Kruskal algorithm is used to calculate the shortest connection between multiple points in a plane);

[0062] 2) In the results of the Kruskal algorithm, holes that are connected to only one other hole are considered boundary holes, and holes that are connected to at least two holes are considered internal holes. The results are recorded;

[0063] 3) Use the BFS algorithm to connect all internal holes and set the values ​​along the lines to illegal values;

[0064] 4) Use the BFS algorithm to find the shortest path between each boundary hole and the nearest point on the boundary, mark the values ​​along the path as illegal, and return to the face tracking method to continue execution;

[0065] 5) Finally, the area that meets the conditions is obtained.

[0066] S6. Convert the boundary into a spatial polygon to generate the final result.

[0067] It should be noted that, in the present invention, it should be understood that although this specification is described in terms of implementation methods, not every implementation method contains only one independent technical solution. This narrative method of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment can also be appropriately combined to form other implementation methods that can be understood by those skilled in the art.

Claims

1. A method for removing holes in raster-to-vector surfaces, characterized in that: The following steps are involved: Step 1: parse the raster data and convert it into two values: legal and illegal. Step 2: Boundary tracking: For each legal grid, if there are illegal values ​​in the four directions of up, down, left, and right, it is marked as a boundary point; based on the 8-directional neighbor relationship, the boundary points are tracked in a counterclockwise direction until a closed area is formed; Step 3: Hole identification: For each closed area, select any point on the boundary and calculate the internal point in the normal direction. If the internal point is within the closed area, it is considered a hole. Step 4: Hole elimination: Use the Kruskal algorithm to calculate the shortest connection between holes and distinguish between boundary holes and internal holes; use the BFS algorithm to connect the shortest path between internal holes and boundary holes and the region boundary, and modify the grid values ​​along the path to illegal values; Step 5: Iterative processing: Repeat steps 2 to 4 until there are no holes and output a continuous vector surface.

2. The method for removing holes in a raster-to-vector surface according to claim 1, characterized in that: In step 2, it also includes: calculating the normal direction of the boundary point, where the normal direction is obtained by summing and normalizing the legal value vectors of the four neighborhoods.

3. The method for removing holes in a raster-to-vector surface according to claim 1, wherein: In step 4, it also includes: if there are adjacent boundary points with opposite normal directions in the closed area and the distance is less than a set threshold, then modifying the corresponding grid value to an illegal value.

4. The method for removing holes in a raster-to-vector surface according to claim 3, wherein: The set threshold is dynamically adjusted by the user according to accuracy requirements.

5. The method for removing holes in a raster-to-vector surface according to claim 1, wherein: In step 4, the BFS algorithm preferentially selects the path with the smallest grid value change.

6. A raster-to-vector surface hole removal system, characterized in that: include: Data preprocessing module, used to parse raster data and binarize it into legal and illegal values; A face tracking module, configured to execute step 2 of claim 1, comprising: a boundary point marking unit, configured to determine illegal values ​​based on four directions; a closed region generating unit, configured to track counterclockwise based on an eight-direction neighbor relationship; A hole elimination module, used to execute steps 3 and 4 of claim 1, comprising: a hole identification unit, which judges based on internal points in the normal direction; a Kruskal algorithm unit, which calculates the shortest connection relationship between holes; a BFS algorithm unit, which connects the shortest paths and modifies the grid values; and a vector generation module, which outputs a continuous vector surface.

7. The hole removal system for raster-to-vector surface conversion according to claim 6, characterized in that: The face tracking module also includes a normal calculation unit for summing and normalizing the legal value vectors of the four neighborhoods of the boundary point.

8. The hole elimination system for raster-to-vector surface conversion according to claim 6, characterized in that: The hole elimination module further includes a threshold determination unit configured to dynamically adjust the minimum distance threshold according to user configuration.

Citation Information

Patent Citations

  • Raster vectorization system based on hierarchical boundary-topology search model

    CN103838829A

  • Interferent elimination and hole filling method for DEM image

    CN115423974A

  • Optimizing method for image transfigure border side tracking

    CN1584932A

  • Method for segmenting and denoising triangle mesh

    WO2022057250A1