Mesh boundary extraction method and system based on mesh unit boundary model
Through the extraction method based on the grid unit boundary model, grid data is processed row by row or column by row, the errors and resource consumption of grid boundary extraction in the existing technology are solved, and efficient and accurate boundary extraction is achieved, which is suitable for Analysis and visualization of large-scale grid data.
Patent Information
- Application Number
- CN202410295170.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-14
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-03-14
AI Technical Summary
The existing grid boundary extraction methods have problems such as error extraction and missed mention of high computing resources, especially when processing large-scale grid data, which affects the data visualization and analysis efficiency.
Using the extraction method based on the grid unit boundary model, the grid data is processed row by row or column by row to determine whether there are false value nodes and true value nodes in the grid unit. Combined with the characteristics of connectivity, closure and disjointness, the grid is extracted and Merge boundary lines to generate complete boundary lines, reducing memory requirements and computing resource consumption.
It improves the efficiency and accuracy of grid boundary extraction, saves memory space, ensures the continuity and integrity of boundary lines, and is suitable for the analysis and visualization of large-scale grid data.
Smart Images

Figure CN118297978B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of geophysics and image data processing, and in particular to a grid boundary extraction method and system based on a grid unit boundary model. Background Art
[0002] Grid data uses nodes to store spatial data. It is a standardized and special data structure that divides the spatial area into grid units according to the specified size. Each unit record is used to store information on various geographical elements such as elevation, geology, potential field, soil, hydrology, population, etc. Grid data is similar to image data in data structure and storage method. Grid data and image data can be interchanged in data processing methods. Its advantage is that its organizational form facilitates data processing, analysis and evaluation. At the same time, the contour lines drawn based on grid data can accurately describe the spatial continuous distribution phenomenon of its characteristics, especially in geophysical surveys, it can intuitively express the trend changes of potential fields. It has been widely used in the storage of digital terrain models, remote sensing graphics, geophysical potential field data, hydrological survey data, etc.
[0003] However, in the process of data acquisition, processing, correction or projection transformation, the shape and range of the entire area often change due to various reasons, resulting in certain areas of the grid data being filled with certain false values, which appear as common black or white edges in the image. The data area is not a complete rectangle, and invalid regional data affects the next step of analysis and visualization of the entire data, especially in the expression of contour results. Contour lines are the main mapping results, and the visualization results are relatively simple in the final mapping process. They are often supplemented by regional filling modes for superposition. In the process of contour area filling, its boundary is particularly important as the basis of regionalization, and it is also an important step and key node for regional filling. Therefore, it is very important to quickly and effectively obtain the boundary for the visualization expression, data processing and analysis of grid data.
[0004] The commonly used boundary extraction method is based on image data and uses the Moore algorithm, Sobel operator or Canny operator eight-direction method for tracking. In the above boundary extraction method, taking the eight-direction method boundary extraction as an example, the first step is to binarize the image data, and then use the binary image as the data source, find the first boundary point in the upper left corner as the starting point, track the boundary points according to the eight-direction method, connect the points through the Freeman chain code, and finally form a boundary line. However, in the eight-direction method boundary extraction method, if the effective range of the data is not extracted and utilized in a targeted manner, it is easy to extract the internal area incorrectly, and it is also easy to miss the complex boundaries. At the same time, due to the need to judge the search of all points, the data with a large comparison (more rows and columns) usually needs to set a relatively large memory to save the usability of the grid nodes, thereby affecting the tracking efficiency. Summary of the invention
[0005] In view of this, the purpose of the present invention is to solve the problems of erroneous extraction, missed extraction and high consumption of computing resources in the existing mesh boundary extraction. To this end, the present invention proposes a mesh boundary extraction method and system based on a mesh unit boundary model, aiming to improve the efficiency and accuracy of mesh boundary extraction by optimizing boundary recognition and tracking algorithms, while reducing the demand for computing resources.
[0006] To achieve the above object, the present invention provides the following technical solutions:
[0007] In a first aspect, the present invention provides a grid boundary extraction method based on a grid unit boundary model, comprising the following steps:
[0008] Step 1: Initialize grid data reading: set the initial grid data row or column, read the grid node data of the first row or column, and build the initial grid node structure.
[0009] Step 2, grid unit composition: read the grid node data of the next row or column row by row or column by column, and form a grid unit together with the adjacent previous row or column data.
[0010] Step 3, boundary judgment: according to the condition that there is at least one false value node and at least two true value nodes in the grid unit, it is judged whether there is a boundary in the grid unit.
[0011] Step 4: Boundary line merging: If there is a boundary, the grid unit boundary is extracted according to the grid node row and column numbers. Under the conditions of connectivity, closure and non-intersection, the boundary lines of the grid units are extracted and merged to generate complete boundary lines.
[0012] Step 5: Closing and storing grid boundaries: Repeat the above steps row by row or column by column until the entire grid data is processed, close all the boundary lines obtained, and store the final grid boundaries.
[0013] As a further solution of the present invention, the grid unit is a closed unit surrounded by grid rows and columns, and is composed of grid nodes at four corner points.
[0014] As a further solution of the present invention, when a grid unit has a boundary, the following conditions are met:
[0015] There is at least one false value node among the grid nodes of the four corner points;
[0016] At least two of the four corner grid nodes are true value nodes;
[0017] If only two grid nodes are true value nodes, then it cannot be a diagonal.
[0018] As a further solution of the present invention, after forming a grid unit together, it also includes obtaining the boundary index of the row or column grid unit row by row or column by column, and the boundary index includes the first and last coordinates and the stored row and column numbers; repeating the reading step to obtain the grid unit set of each row respectively.
[0019] As a further solution of the present invention, obtaining the boundary index of the row or column grid unit row by row or column by column also includes: applying the connectivity characteristics of the grid boundary to merge the boundary indexes with the same first or last coordinates to form a new grid boundary index.
[0020] As a further solution of the present invention, in the grid boundary extraction method based on the grid unit boundary model, after the last row and the penultimate row of data form the grid unit data set boundary extraction, the extraction of the entire grid boundary is terminated, and all boundary lines are closed to obtain the final grid boundary.
[0021] In a second aspect, the present invention further provides a grid boundary extraction system based on a grid unit boundary model, comprising:
[0022] Data reading module: used to initialize and read grid data, set the initial grid data row or column, read the grid node data of the first row or column, build the initial grid node structure, and provide basic data for subsequent processing.
[0023] Grid unit construction module: responsible for reading grid node data row by row or column by column, and together with the adjacent previous row or column data, forming a grid unit to provide a basic unit for boundary judgment.
[0024] Boundary judgment module: used to judge whether there is a boundary in the grid unit according to the condition that there is at least one false value node and at least two true value nodes in the grid unit.
[0025] Boundary line extraction and merging module: used to connect and extract the boundary lines of grid cells, and merge the extracted boundary lines to generate complete boundary lines under the conditions of connectivity, closure and non-intersection.
[0026] Closed storage module: used to close all extracted boundary lines, ensure the continuity and integrity of each boundary line, and store the final mesh boundary.
[0027] As a further solution of the present invention, the grid boundary extraction system based on the grid unit boundary model further includes:
[0028] Data access interface: connected to the data reading module, used to obtain basic grid data, including grid node information, as the input data source for boundary extraction;
[0029] Control logic module: used to coordinate the various modules of the grid boundary extraction system, and repeatedly execute the processing steps of the grid data row by row or column by column until the entire grid data is processed;
[0030] User interaction module: provides a user interface for allowing users to input grid data parameters, start processing and view processing results.
[0031] The present invention also includes a computer device, comprising: at least one processor, and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the grid boundary extraction method based on the grid unit boundary model.
[0032] The present invention also includes a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the grid boundary extraction method based on the grid unit boundary model.
[0033] Compared with the prior art, the mesh boundary extraction method and system based on the mesh unit boundary model of the present invention has the following beneficial effects:
[0034] The present invention avoids reading the entire grid data set at one time by processing data row by row (or column by column), reduces the demand for memory, and reduces the number of data accesses. Compared with the eight-direction boundary extraction, the grid boundary extraction method of the present invention only needs to judge four nodes each time, and its connectivity is guaranteed to be unique regardless of row or column, and there will be no intersection conditions. In addition, during operation, its memory storage space is only two rows or two columns of data, and it is not necessary to read the entire grid data at one time, saving storage space, improving operation efficiency, and significantly reducing memory usage compared to the storage space required for the entire grid data.
[0035] In summary, the grid boundary extraction method and system based on the grid unit boundary model of the present invention improves data processing efficiency, saves memory space, improves the accuracy of boundary extraction, facilitates data processing and analysis, has wide applicability, and contributes to the improvement of the level of domestic software technology.
[0036] These and other aspects of the present invention will be more clearly understood in the following description of the embodiments. It should be understood that the above general description and the following detailed description are only exemplary and explanatory and cannot limit the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or related technologies, the following briefly introduces the drawings required for use in the exemplary embodiments or related technical descriptions. The drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation to the present invention. In the drawings:
[0038] Figure 1 The present invention is a flowchart of a method for extracting mesh boundaries based on a mesh unit boundary model according to an embodiment of the present invention.
[0039] Figure 2 The eight-direction direction map extracted for the eight-direction method boundary.
[0040] Figure 3 This is the unit node association diagram extracted for the eight-direction boundary method.
[0041] Figure 4 Flowchart for eight-direction boundary extraction.
[0042] Figure 5 This is a schematic diagram of the boundary extraction results using the eight-direction method.
[0043] Figure 6 The present invention is a schematic diagram of node validity combination in a grid boundary extraction method based on a grid unit boundary model according to an embodiment of the present invention.
[0044] Figure 7 The row connection B in a grid boundary extraction method based on a grid unit boundary model according to an embodiment of the present invention i,j , B i,j+1 Schematic diagram of boundary line connection.
[0045] Figure 8 The column connection B in a grid boundary extraction method based on a grid unit boundary model according to an embodiment of the present invention i,j , B i+1,j+1 Schematic diagram of boundary line connection.
[0046] Fig. 9 The present invention is a flowchart of a method for extracting boundaries based on a grid unit boundary model according to an embodiment of the present invention.
[0047] Fig.10 The present invention is a schematic diagram of a grid boundary extraction method based on a grid unit boundary model in an embodiment of the present invention for performing row-by-row boundary extraction and contour line filling effects. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0049] In some of the processes described in the specification and claims of the present invention and the above-mentioned figures, multiple operations that appear in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear in this article or executed in parallel. The serial numbers of the operations, such as 101, 102, etc., are only used to distinguish different operations, and the serial numbers themselves do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed in sequence or in parallel. It should be noted that the descriptions of "first", "second", etc. in this article are used to distinguish different messages, devices, modules, etc., do not represent the order of precedence, and do not limit the "first" and "second" to be different types.
[0050] The following will be combined with the drawings in the exemplary embodiments of the present invention to clearly and completely describe the technical solutions in the exemplary embodiments of the present invention. Obviously, the exemplary embodiments described are only part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0051] Since the commonly used boundary extraction method is based on image data, Moore algorithm, Sobel operator or Canny operator eight-direction method are used for tracking, see Figures 2 to 4 When the eight-direction method is used for tracking, the first step is to binarize the image data, and then use the binarized image as the data source, find the first boundary point in the upper left corner as the starting point, track the boundary points according to the eight-direction method, connect the points through the Freeman chain code, and finally form a boundary line. The eight-direction direction map of the boundary extracted by the eight-direction method is shown in Figure 2 As shown, the unit node association diagram is as follows Figure 3 As shown in the figure, the eight-direction boundary extraction process is as follows Figure 4 shown.
[0052] See also Figures 2 to 4 As shown in the figure, first get the first point, then find the next point of the boundary in the counterclockwise direction according to the figure, and repeat the previous step with the next point as the starting point, that is, the next point of the chain code is converted with the previous point, and finally return to the starting position to close as a loop. Repeat this to obtain all the closed loops in the grid as all the boundaries until all points in the grid have completed the search. Figure 3 As shown, when the position is point (i, j), its eight adjacent points are the search range.
[0053] See also Figure 5 As shown, Figure 5 This is a schematic diagram of the boundary extraction results of the eight-direction method. If this mode does not make targeted extraction and utilization of the effective range of the data, it is easy to make erroneous extraction of internal areas and omission of complex boundaries. At the same time, due to the need to judge the search of all points, for data with large comparisons (many rows and columns), it is usually necessary to set a relatively large memory to save the usability of grid nodes, thereby affecting the tracking efficiency.
[0054] In view of this, the present invention provides a grid boundary extraction method and system based on a grid unit boundary model. Based on grid data and in combination with grid boundary characteristics, grid boundary extraction is realized by constructing a grid unit boundary model. The efficiency and accuracy of grid boundary extraction are improved by optimizing boundary recognition and tracking algorithms, while reducing the demand for computing resources. Actual data test results show that the boundary extraction method can meet actual production needs in terms of efficiency and effect.
[0055] The technical solution of the present invention is further described below in conjunction with specific embodiments:
[0056] See also Figure 1 , a grid boundary extraction method based on a grid unit boundary model provided by an embodiment of the present invention comprises the following steps:
[0057] Step S10, initializing grid data reading: setting the initial grid data row or column, reading the grid node data of the first row or the first column, and constructing the initial grid node structure.
[0058] Step S20, grid unit formation: read in the grid node data of the next row or column row by row or column by column, and form a grid unit together with the adjacent previous row or column data.
[0059] Step S30, boundary judgment: judging whether the grid unit has a boundary according to the condition that the grid unit has at least one false value node and at least two true value nodes.
[0060] Step S40, boundary line merging processing: if there is a boundary, then extract the grid unit boundary according to the grid node row and column numbers, and extract the boundary line of the grid unit and merge it under the conditions of connectivity, closure and non-intersection characteristics to generate a complete boundary line.
[0061] Step S50, grid boundary closing and storage: repeat the above steps row by row or column by column until the entire grid data is processed, close all the obtained boundary lines, and store the final grid boundary.
[0062] In the present invention, when mesh boundary extraction is performed, boundary extraction can provide basic support for contour regionalization, image boundary detection, and object extraction. The boundary can intuitively express the validity range of the data and provide data support for the spatialization of the data. Therefore, boundary extraction is a key and core technology. Based on the analysis of the mesh data structure, the characteristics of the boundary are summarized and summarized, which has the characteristics of connectivity, closure, and non-intersection.
[0063] Among them, connectivity means that the nodes on each boundary of the grid data must be connected. Connectivity is also the basis of eight-direction tracking, that is, the previous point and the next point are adjacent nodes on the grid, expressed by row and column numbers. Assuming that the current node is point (i, j), the next node must be between (i-1, j-1) and (i+1, j+1). At the boundary, they are directly adjacent along the grid boundary.
[0064] Closure means that any boundary line being tracked must be closed, which is represented in space by the coincidence of the starting point and the ending point. That is, if the starting point of the tracked line is (i, j), then the end point of the boundary line must also be (i, j).
[0065] Non-intersection refers to continuous and closed boundary lines. When closed as a region, the boundary region can have an inclusion relationship, and any two boundary lines do not intersect in space.
[0066] In this embodiment, the grid unit is a closed unit surrounded by grid rows and columns, and is composed of grid nodes at four corner points. The grid unit is organized as follows:
[0067]
[0068] Section B i,j A grid unit is composed of four nodes: the current node (i, j), the upper left node (i+1, j), the upper right node (i+1, j+1), and the lower right node (i, j+1). There are 15 possible combinations of the validity of the four nodes.
[0069] See also Figure 6 As shown, Figure 6 This is a schematic diagram of node validity combination, where the hollow represents the node false value and the solid represents the node true value. According to the eight-direction boundary extraction, if a node is a point on the boundary line, then the node must be true, and the eight nodes around it (such as Figure 3 For this purpose, the present invention refers to the eight-direction method boundary extraction principle and improves it to the grid unit boundary. If the grid unit has a boundary, the following conditions are met:
[0070] (1) There is at least one false value node among the grid nodes of the four corner points;
[0071] (2) At least two of the four corner grid nodes are true value nodes;
[0072] (3) If only two grid nodes are true value nodes, then it cannot be a diagonal.
[0073] The grid cell boundary model is based on the grid cell and applies the grid cell boundary conditions. It first determines whether the grid cell has a boundary, and then extracts the grid cell boundary according to the grid node row and column numbers. Figure 6 Among the 15 cases, there is no boundary under conditions 1, 2, 3, 4, 5, 9, 12, and 15, and there is only a boundary under conditions 6, 7, 8, 10, 11, 13, and 14, which satisfy the condition that the grid unit has a boundary. For example, under condition 14, the boundary line is (i, j)-(i, j+1)-(i+1, j+1).
[0074] In the present invention, mesh boundary extraction is to use mesh node data to construct its mesh unit boundary model, extract mesh unit boundaries, and use the connectivity, closure and non-intersection characteristics of mesh boundaries to connect and close unit boundaries to form mesh boundary lines, thereby realizing the extraction of the entire mesh boundary. Therefore, in the mesh boundary extraction method based on the mesh unit boundary model of the present invention, the process of mesh boundary extraction is:
[0075] (1) Read the data in the first row or column of the grid (incrementally from bottom to top);
[0076] (2) Read in the second row or second column of data, and form a grid unit row or column set with the first row or first column of data.
[0077] (3) Get the row or column grid cell B row by row or column by column i,j Boundary index (first and last coordinates, storage row and column numbers);
[0078] (4) Taking a row as an example, repeat steps 1 to 3 to obtain the grid cell set of each row.
[0079]
[0080] Assume B i To track the data set of grid cells in row i, C i All column data C1 to C of row i n , where n represents the column width of the grid data.
[0081] Among them, after collectively forming a grid unit, it also includes obtaining the boundary index of the row or column grid unit row by row or column by column, and the boundary index includes the first and last coordinates and the stored row and column numbers; repeating the reading steps to obtain the grid unit set of each row respectively.
[0082] like Figure 7 When the third step is completed, the connectivity characteristics of the mesh boundary are applied to merge the boundary indexes with the same first or last coordinates to form a new mesh boundary index. Figure 8 As shown, since we take the row as an example, we first connect it with the segment (i+1,j+1)-(i+1,j+2). If it is not connected, we connect it with the segment (i+1,j+1)-(i+2,j+1). In the current case, only these two cases can be merged. If we take the column as an example, the situation is just the opposite.
[0083] (5) After the last row and the second to last row of data form the grid unit data set boundary extraction, the extraction of the entire grid boundary is terminated, and all boundary lines are closed to obtain the final grid boundary.
[0084] Compared with the eight-direction boundary extraction method, the grid boundary extraction method based on the grid unit boundary model of the present invention only needs to judge four nodes each time, and its connectivity is guaranteed to be unique regardless of row or column, and there will be no intersection conditions. In addition, during the operation, its memory storage space is only two rows or two columns of data, and there is no need to read the entire grid data at one time, which saves storage space and improves operation efficiency.
[0085] In this embodiment, the grid data or image data is used as the basic data, combined with the data access interface, and the grid boundary extraction function is designed and implemented. By constructing a grid unit boundary model, the grid unit boundary is obtained by applying the model, the boundary is merged to form a grid boundary line in combination with connectivity, and the closed attribute is determined to complete the grid boundary extraction and store it until the last two rows of data are extracted to complete the boundary extraction of the entire grid data. The boundary extraction process is as follows: Fig. 9 shown.
[0086] When verifying the application effect of the grid boundary extraction method based on the grid unit boundary model of this embodiment, the efficiency of the boundary extraction method of the present invention is compared with the eight-direction method, and the extraction effect is analyzed by applying the grid contour filling result. On a notebook W520 (memory 4GB, Win7 32-bit operating system), three different grid boundaries (no false value, false value around, false value around and in the center) are used for performance testing. The comparison of boundary extraction efficiency of different methods is shown in Table 1.
[0087] Table 1 Comparison of boundary extraction efficiency of different methods
[0088]
[0089] It can be seen that the efficiency of the mesh boundary extraction of the present invention is much better than that of the eight-direction method. However, the efficiency improvement is not very obvious when the mesh data is larger and the number of boundaries is more. Figure 7 and Figure 3 The extraction results of the present invention are obviously more in line with the actual data. The boundary extraction method of the present invention is applied in the process of isoline regionalization of the 1409*1732 measured grid data, and the result can fully meet the actual requirements. The filled area has no intersection at all. The effect of line-by-line boundary extraction and isoline filling can be seen in Fig.10 shown.
[0090] The grid boundary extraction method based on the grid unit boundary model of the present invention is of great significance in data analysis, processing and interpretation. On the basis of analyzing the characteristics of the grid boundary, a row-by-row grid boundary extraction algorithm is designed by constructing a row-by-row boundary model, realizing the boundary extraction of grid data, reducing the access to grid node data, saving memory storage in the calculation process, improving the efficiency of boundary extraction, ensuring the correctness of the extracted boundary result, and the boundary extraction method can be widely used in the boundary extraction of other characteristics of grid data. The research results have been applied in actual production and meet the requirements of airborne geophysical data processing.
[0091] It should be understood that, although described in a certain order, these steps are not necessarily performed in sequence in the above order. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be performed in other orders. Moreover, a part of the steps of the present embodiment may include a plurality of steps or a plurality of stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these steps or stages is not necessarily performed in sequence, but can be performed in turn or alternately with at least a part of the steps or stages in other steps or other steps.
[0092] In one embodiment, a grid boundary extraction system based on a grid unit boundary model is also provided in an embodiment of the present invention, comprising:
[0093] Data reading module: used to initialize and read grid data, set the initial grid data row or column, read the grid node data of the first row or column, build the initial grid node structure, and provide basic data for subsequent processing.
[0094] Grid unit construction module: responsible for reading grid node data row by row or column by column, and together with the adjacent previous row or column data, forming a grid unit to provide a basic unit for boundary judgment.
[0095] Boundary judgment module: used to judge whether there is a boundary in the grid unit according to the condition that there is at least one false value node and at least two true value nodes in the grid unit.
[0096] Boundary line extraction and merging module: used to connect and extract the boundary lines of grid cells, and merge the extracted boundary lines to generate complete boundary lines under the conditions of connectivity, closure and non-intersection.
[0097] Closed storage module: used to close all extracted boundary lines, ensure the continuity and integrity of each boundary line, and store the final mesh boundary.
[0098] As a further solution of the present invention, the grid boundary extraction system based on the grid unit boundary model further includes:
[0099] Data access interface: connected to the data reading module, used to obtain basic grid data, including grid node information, as the input data source for boundary extraction;
[0100] Control logic module: used to coordinate the various modules of the grid boundary extraction system, and repeatedly execute the processing steps of the grid data row by row or column by column until the entire grid data is processed;
[0101] User interaction module: provides a user interface for allowing users to input grid data parameters, start processing and view processing results.
[0102] The grid boundary extraction system based on the grid cell boundary model of the present invention is used to execute the above-mentioned grid boundary extraction method based on the grid cell boundary model. Therefore, the operation process of the grid boundary extraction system based on the grid cell boundary model in this embodiment will not be described in detail. The grid boundary extraction system based on the grid cell boundary model of the present invention avoids reading the entire grid data set at one time by processing data row by row (or column by column), reduces the demand for memory, and reduces the number of data accesses; in the boundary extraction process, only four nodes of the grid cell need to be judged each time, instead of eight nodes in the traditional eight-direction method, which simplifies the calculation process and improves the operation efficiency.
[0103] In the extraction method and system of the present invention, the storage space is only two rows or two columns of data, which significantly reduces the memory usage compared to the storage space required for the entire grid data. Moreover, it is ensured that the extracted grid boundary has good connectivity and closure, that is, each boundary line is continuous and closed, which is very critical for subsequent analysis and visual expression. In the boundary extraction process, it is ensured that there is no intersection between the boundary lines, which is an important quality assurance for the visualization and post-processing of the grid data.
[0104] In summary, the grid boundary extraction method and system based on the grid unit boundary model of the present invention improves data processing efficiency, saves memory space, improves the accuracy of boundary extraction, facilitates data processing and analysis, has wide applicability, and contributes to the improvement of the level of domestic software technology.
[0105] In one embodiment, a computer device is also provided in an embodiment of the present invention, comprising at least one processor and a memory communicatively connected to the at least one processor, wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor performs the steps of the grid boundary extraction method based on the grid unit boundary model.
[0106] In one embodiment, the present invention further provides a computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the steps of the grid boundary extraction method based on the grid unit boundary model.
[0107] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be realized by instructing the relevant hardware through a computer program represented by computer instructions, and 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-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory.
[0108] Non-volatile memory may include read-only memory, magnetic tape, floppy disk, flash memory or optical storage, etc. Volatile memory may include random access memory or external cache memory. As an illustration and not limitation, RAM may be in various forms, such as static random access memory or dynamic random access memory, etc.
[0109] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A grid boundary extraction method based on a grid unit boundary model, characterized in that: The following steps are involved: Initialize grid data reading: set the initial grid data row or column, read the grid node data of the first row or first column, and build the initial grid node structure; Grid unit composition: read the grid node data of the next row or column row by row or column by column, and form a grid unit together with the adjacent previous row or column data; Boundary judgment: According to the condition that there is at least one false value node and at least two true value nodes in the grid unit, it is judged whether there is a boundary in the grid unit. According to the eight-direction boundary extraction, if a node is a point on the boundary line, then the node must be a true value node, and at the same time, there is at least one false value node in the eight nodes around it; Boundary line merging processing: If there is a boundary, the grid unit boundary is extracted according to the grid node row and column numbers. Under the conditions of connectivity, closure and non-intersection, the boundary lines of the grid units are extracted and merged to generate complete boundary lines; Mesh boundary closure and storage: Repeat the above steps row by row or column by column until the entire mesh data is processed, close all the boundary lines obtained, and store the final mesh boundary; Among them, when the grid cell has a boundary, the following conditions are met: There is at least one false value node among the grid nodes of the four corner points; At least two of the four corner grid nodes are true value nodes; If only two grid nodes are true value nodes, then it cannot be a diagonal.
2. The grid boundary extraction method based on the grid unit boundary model according to claim 1, characterized in that: The grid unit is a closed unit surrounded by grid rows and columns, and is composed of grid nodes at four corner points.
3. The grid boundary extraction method based on the grid unit boundary model according to claim 2, characterized in that: After forming a grid unit together, it also includes obtaining the boundary index of the row or column grid unit row by row or column by column, wherein the boundary index includes the first and last coordinates and the stored row and column numbers; repeating the reading step to obtain the grid unit set of each row respectively.
4. The grid boundary extraction method based on the grid unit boundary model according to claim 3, characterized in that: The boundary index of the grid cell in the row or column is obtained row by row or column by column, and further includes: applying the connectivity characteristics of the grid boundary to merge the boundary indexes with the same first or last coordinates to form a new grid boundary index.
5. The grid boundary extraction method based on the grid unit boundary model according to claim 4, characterized in that: In the grid boundary extraction method based on the grid unit boundary model, after the last row and the second to last row of data form the grid unit data set boundary extraction, the extraction of the entire grid boundary is terminated, and all boundary lines are closed to obtain the final grid boundary.
6. A grid boundary extraction system based on a grid unit boundary model, used to execute the grid boundary extraction method based on a grid unit boundary model according to any one of claims 1 to 5, characterized in that: The grid boundary extraction system based on the grid unit boundary model includes: Data reading module: used to initialize and read grid data, set the initial grid data row or column, read the grid node data of the first row or column, and build the initial grid node structure; Grid unit construction module: responsible for reading grid node data row by row or column by column, and forming a grid unit together with the adjacent previous row or column data; Boundary judgment module: used to judge whether there is a boundary of the grid unit according to the condition that there is at least one false value node and at least two true value nodes in the grid unit; Boundary line extraction and merging module: used to connect and extract the boundary lines of grid cells, and merge the extracted boundary lines to generate complete boundary lines under the conditions of connectivity, closure and non-intersection; Closed storage module: used to close all extracted boundary lines and store the final mesh boundaries.
7. The grid boundary extraction system based on the grid unit boundary model according to claim 6, characterized in that: Also includes: Data access interface: connected to the data reading module, used to obtain basic grid data, including grid node information, as the input data source for boundary extraction; Control logic module: used to coordinate the various modules of the grid boundary extraction system, and repeatedly execute the processing steps of the grid data row by row or column by column until the entire grid data is processed; User interaction module: provides a user interface for allowing users to input grid data parameters, start processing and view processing results.
8. A computer device comprising: At least one processor, and a memory communicatively connected to the at least one processor, characterized in that the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor executes the grid boundary extraction method based on the grid unit boundary model as described in any one of claims 1-5.
9. A computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to enable the computer to execute the grid boundary extraction method based on the grid unit boundary model as described in any one of claims 1 to 5.
