Contour drawing method and device, computer storage medium, and electronic device
By digitizing and interpolation processing of the permeasure points, connected contour lines are formed and boundary processing is performed, the problem of low accuracy of contour lines in the prior art is solved, and contour lines with higher accuracy is achieved.
Patent Information
- Application Number
- CN202111357021.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-16
- Publication Date
- 2025-03-04
- Estimated Expiration
- 2041-11-16
AI Technical Summary
In the prior art, although the homogeneous high points are smoothed, the resulting contour lines are still relatively low, making it difficult to meet the high-precision display needs.
By digitizing the target object, a collection of input data points is generated, and a triangle network is drawn on it, contour data points are found for interpolation processing, forming connected contour lines, and boundary processing is performed according to boundary relationships to improve the accuracy of contour lines.
Through this method, the accuracy of the contour lines is significantly improved, and the statistical results in areas such as terrain and precipitation can be displayed more accurately.
Smart Images

Figure CN114037779B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of video processing technology, and in particular to a method and device for drawing contour lines, a computer storage medium, and an electronic device. Background Art
[0002] In the fields of terrain mapping, precipitation, air pressure and temperature, in order to facilitate the further display of statistical results, it is generally necessary to set contour lines. In the process of contour lines, it is generally necessary to smooth the extracted contour points. However, in the prior art, even after smoothing, the accuracy of the obtained contour lines is low. Summary of the invention
[0003] The embodiments of the present application provide a method and device for drawing contour lines, a computer storage medium, and an electronic device to overcome or alleviate the above-mentioned technical problems existing in the prior art.
[0004] The technical solution adopted in this application is:
[0005] In a first aspect, a method for drawing contour lines is provided, comprising:
[0006] Digitally process the target object to obtain a set of input data points for contour drawing, and draw a triangle network on the set of input data points;
[0007] Finding the required first contour data point based on the triangle network drawn on the input data set;
[0008] Performing interpolation processing on the first contour data points found to obtain second contour data points, and all the second contour data points are connected to form a first contour line;
[0009] determining a boundary of the first contour line;
[0010] According to the boundary relationship between the first contour line and the input data point set, the first contour line is subjected to boundary processing to obtain a second contour line.
[0011] Optionally, in an embodiment of the present application, drawing a triangular network on the input data point set includes: drawing a Delaunay triangular network on the input data point set based on a Delaunay algorithm.
[0012] Optionally, in an embodiment of the present application, drawing a triangular network on the input data point set includes: drawing a Delaunay triangular network on the input data point set according to the plane coordinates and height data of each input data point in the input data set.
[0013] Optionally, in one embodiment of the present application, searching for the required first contour data point based on the triangular network drawn on the input data set includes: searching for the required first contour data point according to the vertex coordinates of each triangle in the triangular network and the corresponding height data.
[0014] Optionally, in an embodiment of the present application, before the interpolation processing is performed on the first contour data points found to obtain the second contour data points, the method further comprises: sorting the first contour data points found in ascending order of coordinate values to obtain a first contour data point sequence;
[0015] Correspondingly, performing interpolation processing on the first contour data points found to obtain second contour data points includes: performing interpolation processing on the first contour data point sequence to obtain second contour data points.
[0016] Optionally, in one embodiment of the present application, the first contour data points found are interpolated to obtain second contour data points, and all the second contour data points are connected to form a first contour line, including: determining the interpolation algorithm used in the interpolation processing according to the shape of the input data point set; and interpolating the first contour data points found according to the determined interpolation algorithm to obtain second contour data points.
[0017] Optionally, in one embodiment of the present application, if the shape of the input data point set is a rectangle, the interpolation algorithm used in the interpolation processing is a linear interpolation algorithm; if the shape of the input data point set is a sector, the interpolation algorithm used in the interpolation processing is a cubic-spline interpolation algorithm; if the shape of the input data point set is a circle, the interpolation algorithm used in the interpolation processing is a B-spline interpolation algorithm.
[0018] Optionally, in one embodiment of the present application, boundary processing is performed on the first contour line according to the boundary relationship between the first contour line and the input data point set to obtain a second contour line, including: if the boundary of the first contour line is outside the boundary between the input data point set or is on the boundary between the input data point set, then the boundary of the first contour line is opened; if the boundary of the first contour line is within the boundary between the input data point set, then the boundary of the first contour line is closed.
[0019] In a second aspect, a contour drawing device is provided, comprising:
[0020] Digitally process the target object to obtain a set of input data points for contour drawing, and draw a triangle network on the set of input data points;
[0021] Finding the required first contour data point based on the triangle network drawn on the input data set;
[0022] Performing interpolation processing on the first contour data points found to obtain second contour data points, and all the second contour data points are connected to form a first contour line;
[0023] determining a boundary of the first contour line;
[0024] According to the boundary relationship between the first contour line and the input data point set, the first contour line is subjected to boundary processing to obtain a second contour line.
[0025] In a third aspect, a computer storage medium is provided, on which a computer executable program is stored, and the computer executable program is executed to implement any method described in the embodiments of the present application.
[0026] In a fourth aspect, an electronic device is provided, comprising a memory and a processor, wherein the memory is used to store a computer executable program, and the processor is used to run the computer executable program to implement any method described in the embodiments of the present application.
[0027] In the technical solution of the embodiment of the present application, the target object is digitized to obtain a set of input data points for contour drawing, and a triangular network is drawn on the input data point set; based on the triangular network drawn on the input data set, the required first contour data points are found; the first contour data points found are interpolated to obtain second contour data points, and all the second contour data points are connected to form a first contour line; the boundary of the first contour line is determined; according to the boundary relationship between the first contour line and the input data point set, the first contour line is boundary processed to obtain a second contour line, thereby improving the accuracy of the contour line. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 A schematic diagram of a flow chart of a method for drawing contour lines according to an embodiment of the present application;
[0029] Figure 2A A schematic diagram of a flow chart of a method for drawing contour lines according to an embodiment of the present application;
[0030] Figure 2B is a schematic diagram of a shape of an exemplary input data point set;
[0031] Figure 2C A schematic diagram of a shape of another exemplary input data point set;
[0032] Figure 2Dis a schematic diagram of a shape of another exemplary input data point set;
[0033] Figure 3A It is a schematic diagram of a series of second contour data points obtained by using a linear interpolation algorithm;
[0034] Figure 3B It is a schematic diagram of a series of second contour data points obtained using the cubic-spline interpolation algorithm;
[0035] Figure 3C It is a schematic diagram of a series of second contour data points obtained using the B-spline interpolation algorithm;
[0036] Figure 4A The first contour line obtained by interpolation without sorting;
[0037] Figure 4B It is the first contour line obtained by interpolation after sorting.
[0038] Figure 5 This is a schematic diagram of the structure of a contour line drawing device according to an embodiment of the present application;
[0039] Figure 6 It is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0040] In order to make the technical problems, technical solutions and advantages to be solved by the present application clearer, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.
[0041] In the technical solution of the embodiment of the present application, the target object is digitized to obtain a set of input data points for contour drawing, and a triangular network is drawn on the input data point set; based on the triangular network drawn on the input data set, the required first contour data points are found; the first contour data points found are interpolated to obtain second contour data points, and all the second contour data points are connected to form a first contour line; the boundary of the first contour line is determined; according to the boundary relationship between the first contour line and the input data point set, the first contour line is boundary processed to obtain a second contour line, thereby improving the accuracy of the contour line.
[0042] Figure 1 Schematic diagram of a flow chart of a method for drawing contour lines according to an embodiment of the present application; Figure 1 As shown, it includes:
[0043] S101, digitally processing the target object to obtain a set of input data points for contour drawing, and drawing a triangle network on the set of input data points;
[0044] In this embodiment, the target object is an image of terrain rendering, precipitation, air pressure and temperature. The digitization is, for example, performing a binarization process on the image.
[0045] In this embodiment, the input point set is a set of data points (also referred to as input data points) extracted from the binarized image and capable of representing the features of the target image.
[0046] In this embodiment, the purpose of drawing the triangular network is to facilitate the subsequent query of the first contour data point. Here, the specific algorithm for drawing the triangular network is not particularly limited.
[0047] S102, searching for the required first contour data point based on the triangle network drawn on the input data set;
[0048] In this embodiment, after the triangular network is drawn, it is equivalent to forming a plurality of (greater than or equal to 2) superimposed triangles on the input data point set. Since each triangle has three vertices and three edges, based on these characteristics of the triangle, the first contour data points can be quickly found. Some of these first contour data points may be input data points, and some may be vertices of the triangle.
[0049] S103, interpolating the first contour data points found to obtain second contour data points, and connecting all the second contour data points to form a first contour line;
[0050] In this embodiment, the specific method of interpolation processing is not particularly limited, as long as the purpose of smoothing the first contour data points can be achieved, and the second contour data points are finally obtained, so as to form a more accurate first contour line.
[0051] S104, determining the boundary of the first contour line;
[0052] In this embodiment, the boundary of the first contour line can be determined by judging the relative position relationship between the first contour data point on the first contour line and the input data point set.
[0053] S105 . Perform boundary processing on the first contour line according to the boundary relationship between the first contour line and the input data point set to obtain a second contour line.
[0054] In this embodiment, the boundary relationship between the first contour line and the input data point set is specifically determined in terms of position, so as to implement boundary processing on the first contour line to obtain the second contour line, and use the second contour line as the output contour line.
[0055] Here, it should be noted that, in a specific implementation, it may be necessary to determine several contour lines of different heights. To this end, the above steps S101-S105 can be performed in a manner of determining only one second contour line each time, or, when resources are sufficient, multiple second contour lines can be determined at the same time and the above steps S101-S105 can be performed in parallel.
[0056] Figure 2A Schematic diagram of a flow chart of a method for drawing contour lines according to an embodiment of the present application; Figure 2A As shown, it includes:
[0057] S201, digitally processing the target object to obtain a set of input data points for contour drawing, and drawing a triangle network on the set of input data points;
[0058] In this embodiment, drawing a triangular network on the input data point set includes: drawing a Delaunay triangular network on the input data point set based on a Delaunay algorithm, thereby ensuring the accuracy and efficiency of triangular network drawing.
[0059] In this embodiment, drawing a triangular network on the input data point set includes: drawing a Delaunay triangular network on the input data point set according to the plane coordinates and height data of each input data point in the input data set, thereby ensuring that the determined triangular network has relatively accurate coordinates.
[0060] S202, searching for the required first contour data point based on the triangle network drawn on the input data set;
[0061] In this embodiment, the searching for the required first contour data point based on the triangle network drawn on the input data set includes: searching for the required first contour data point according to the vertex coordinates of each triangle in the triangle network and the corresponding height data, so as to ensure that the required first contour data point is quickly found. Here, the required first contour data point can be flexibly set according to the application scenario, such as a first contour data point with specific height information.
[0062] S203, sorting the first contour data points found in ascending order of coordinate values to obtain a first contour data point sequence;
[0063] In this embodiment, sorting the first contour data points is equivalent to sequentially screening the first contour data points, thereby ensuring that the second contour data points obtained after interpolation have a higher degree of smoothness.
[0064] S204, interpolating the first contour data point sequence to obtain second contour data points, and connecting all the second contour data points to form a first contour line.
[0065] In this embodiment, the first contour data points found are interpolated to obtain second contour data points, and all the second contour data points are connected to form a first contour line, including: determining the interpolation algorithm used in the interpolation processing according to the shape of the input data point set; and interpolating the first contour data points found according to the determined interpolation algorithm to obtain second contour data points.
[0066] In this embodiment, in order to match the shape of the input data point set and thereby determine the second contour data point with higher smoothness, the interpolation process is closely related to the shape of the input data point set.
[0067] Figure 2B is a schematic diagram of a shape of an exemplary input data point set; Figure 2C A schematic diagram of a shape of another exemplary input data point set; Figure 2D FIG. 4 is another exemplary shape diagram of a set of input data points; Figure 2B As shown, the shape of the input data point set is a rectangle; Figure 2C As shown, the shape of the input data point set is fan-shaped; Figure 2D As shown, the shape of the input data point set is a circle.
[0068] Furthermore, if the shape of the input data point set is a rectangle, the interpolation algorithm used in the interpolation processing is a linear interpolation algorithm; if the shape of the input data point set is a sector, the interpolation algorithm used in the interpolation processing is a cubic-spline interpolation algorithm; if the shape of the input data point set is a circle, the interpolation algorithm used in the interpolation processing is a B-spline interpolation algorithm.
[0069] Figure 3A It is a schematic diagram of a series of second contour data points obtained by using a linear interpolation algorithm; Figure 3B It is a schematic diagram of a series of second contour data points obtained using the cubic-spline interpolation algorithm; Figure 3C This is a schematic diagram of a series of second contour data points obtained using the B-spline interpolation algorithm; as shown in 3A, Figure 3A and Figure 3B The number of second-highest data points is similar, while Figure 3C The second highest data point shown has less data. Figure 3A The contour lines formed by the second contour data points are smoother.
[0070] Figure 4A The first contour line obtained by interpolation without sorting, Figure 4B is the first contour line obtained after sorting and interpolation. Figure 4A and Figure 4B From the above, we can see that the first contour line obtained by interpolation after sorting is smoother.
[0071] S205, determining the boundary of the first contour line;
[0072] In this embodiment, step S205 is described in the above Figure 1 Example.
[0073] S206: Perform boundary processing on the first contour line according to the boundary relationship between the first contour line and the input data point set to obtain a second contour line.
[0074] In this embodiment, according to the boundary relationship between the first contour line and the input data point set, the first contour line is subjected to boundary processing to obtain a second contour line, including: if the boundary of the first contour line is outside the boundary between the input data point sets or is on the boundary between the input data point sets, the boundary of the first contour line is subjected to opening processing; if the boundary of the first contour line is within the boundary between the input data point sets, the boundary of the first contour line is subjected to closing processing, so that a second contour line corresponding to the shape of different input data sets can be obtained through different boundary processing.
[0075] Figure 5 Schematic diagram of the structure of a contour drawing device according to an embodiment of the present application; Figure 5 As shown, it includes:
[0076] A segmentation unit 501 is used to perform digital processing on the target object to obtain a set of input data points for contour drawing, and draw a triangle network on the set of input data points;
[0077] A search unit 502, configured to search for a required first contour data point based on a triangle network drawn on the input data set;
[0078] A smoothing unit 503 is used to perform interpolation processing on the first contour data points found to obtain second contour data points, and all the second contour data points are connected to form a first contour line;
[0079] A boundary determination unit 504, configured to determine a boundary of the first contour line;
[0080] The boundary processing unit 505 is used to perform boundary processing on the first contour line according to the boundary relationship between the first contour line and the input data point set to obtain a second contour line.
[0081] Optionally, in an embodiment of the present application, drawing a triangular network on the input data point set includes: drawing a Delaunay triangular network on the input data point set based on a Delaunay algorithm.
[0082] Optionally, in an embodiment of the present application, the segmentation unit 501 is specifically used to draw a Delaunay triangle network on the input data point set according to the plane coordinates and height data of each input data point in the input data set.
[0083] Optionally, in an embodiment of the present application, the search unit 502 is specifically used to search for the required first contour data point according to the vertex coordinates of each triangle in the triangular network and the corresponding height data.
[0084] Optionally, in an embodiment of the present application, the search unit 502 is further configured to, before performing interpolation processing on the first contour data points to obtain the second contour data points, sort the first contour data points found in ascending order of coordinate values to obtain a first contour data point sequence;
[0085] Correspondingly, the smoothing unit 503 is specifically used to perform interpolation processing on the first contour data point sequence to obtain second contour data points.
[0086] Optionally, in one embodiment of the present application, the smoothing unit 503 is specifically used to determine the interpolation algorithm used in the interpolation processing according to the shape of the input data point set; according to the determined interpolation algorithm, the first contour data points found are interpolated to obtain second contour data points.
[0087] Optionally, in one embodiment of the present application, if the shape of the input data point set is a rectangle, the interpolation algorithm used in the interpolation processing is a linear interpolation algorithm; if the shape of the input data point set is a sector, the interpolation algorithm used in the interpolation processing is a cubic-spline interpolation algorithm; if the shape of the input data point set is a circle, the interpolation algorithm used in the interpolation processing is a B-spline interpolation algorithm.
[0088] Optionally, in one embodiment of the present application, the boundary processing unit 505 is used to open the boundary of the first contour line if the boundary of the first contour line is outside the boundary between the input data point sets or on the boundary between the input data point sets; and close the boundary of the first contour line if the boundary of the first contour line is within the boundary between the input data point sets.
[0089] The embodiments of the present application also provide a computer storage medium, on which a computer executable program is stored, and the computer executable program is executed to implement any method described in the embodiments of the present application.
[0090] Figure 6 Schematic diagram of the structure of the electronic device of the present application embodiment; Figure 6 As shown, the electronic device includes a memory 601 and a processor 602, the memory is used to store a computer executable program, and the processor is used to run the computer executable program to implement any method described in the embodiments of the present application.
[0091] The above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A method for drawing contour lines, characterized in that: include: Digitally process the target object to obtain a set of input data points for contour drawing, and draw a triangle network on the set of input data points; Finding the required first contour data point based on the triangle network drawn on the input data point set; Performing interpolation processing on the first contour data points found to obtain second contour data points, and all the second contour data points are connected to form a first contour line; determining a boundary of the first contour line; According to the boundary relationship between the first contour line and the input data point set, performing boundary processing on the first contour line to obtain a second contour line; Among them, according to the boundary relationship between the first contour line and the input data point set, the first contour line is subjected to boundary processing to obtain the second contour line, including: if the boundary of the first contour line is outside the boundary between the input data point sets or is located on the boundary between the input data point sets, the boundary of the first contour line is subjected to opening processing; if the boundary of the first contour line is within the boundary between the input data point sets, the boundary of the first contour line is subjected to closing processing.
2. The method according to claim 1, characterized in that The drawing of a triangular network on the input data point set includes: drawing a Delaunay triangular network on the input data point set based on a Delaunay algorithm.
3. The method according to claim 1, characterized in that The drawing of a triangular network on the input data point set comprises: drawing a Delaunay triangular network on the input data point set according to the plane coordinates and height data of each input data point in the input data point set.
4. The method according to claim 1, characterized in that: The method of searching for the required first contour data point based on the triangular network drawn on the input data point set includes: searching for the required first contour data point according to the vertex coordinates of each triangle in the triangular network and the corresponding height data.
5. The method according to claim 1, characterized in that Before the interpolation processing is performed on the first contour data points found to obtain the second contour data points, the method includes: sorting the first contour data points found in ascending order of coordinate values to obtain a first contour data point sequence; Correspondingly, performing interpolation processing on the first contour data points found to obtain second contour data points includes: performing interpolation processing on the first contour data point sequence to obtain second contour data points.
6. The method according to claim 1, characterized in that The interpolation processing is performed on the first contour data points found to obtain second contour data points, and all the second contour data points are connected to form a first contour line, including: determining the interpolation algorithm used in the interpolation processing according to the shape of the input data point set; and interpolating the first contour data points found according to the determined interpolation algorithm to obtain second contour data points.
7. The method according to claim 1, characterized in that If the shape of the input data point set is a rectangle, the interpolation algorithm used in the interpolation processing is a linear interpolation algorithm; if the shape of the input data point set is a sector, the interpolation algorithm used in the interpolation processing is a cubic-spline interpolation algorithm; if the shape of the input data point set is a circle, the interpolation algorithm used in the interpolation processing is a B-spline interpolation algorithm.
8. A contour drawing device, characterized in that: include: A subdivision unit, used for performing digital processing on the target object to obtain a set of input data points for contour drawing, and drawing a triangular network on the set of input data points; A search unit, configured to search for a required first contour data point based on a triangle network drawn on the input data point set; A smoothing unit, used for performing interpolation processing on the first contour data points found to obtain second contour data points, and all the second contour data points are connected to form a first contour line; a boundary determination unit, configured to determine a boundary of the first contour line; a boundary processing unit, configured to perform boundary processing on the first contour line according to the boundary relationship between the first contour line and the input data point set to obtain a second contour line, Among them, according to the boundary relationship between the first contour line and the input data point set, the first contour line is subjected to boundary processing to obtain the second contour line, including: if the boundary of the first contour line is outside the boundary between the input data point sets or is located on the boundary between the input data point sets, the boundary of the first contour line is subjected to opening processing; if the boundary of the first contour line is within the boundary between the input data point sets, the boundary of the first contour line is subjected to closing processing.
9. A computer storage medium, characterized in that The computer storage medium stores a computer executable program, and the computer executable program is run to implement any one of the methods of claims 1-7.
10. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory is used to store a computer executable program, and the processor is used to run the computer executable program to implement any one of the methods of claims 1-7.
Citation Information
Patent Citations
Data processing method, system and electronic device
CN109255008A
Method and device for preparing contour line data
JP2002203234A