A method, apparatus, electronic device, and storage medium for contour line extraction
By connecting and simplifying the sample points of the three-dimensional model, obtaining contour lines and performing fitting correction, the problem of low efficiency in obtaining contour lines of the three-dimensional model in the prior art is solved, and more efficient and accurate contour lines are achieved.
Patent Information
- Application Number
- CN202010103311.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-02-19
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2040-02-19
AI Technical Summary
In the prior art, the efficiency of obtaining three-dimensional model contour lines is low, and it requires manual precise selection of points, and the model is rotated many times to achieve the effect of accurate acquisition.
By obtaining multiple sample points of the three-dimensional model, connecting these points in turn to obtain contour lines, simplifying operations are performed to obtain vector data, and fit and correct the vector data to obtain contour lines of the three-dimensional model.
It effectively improves the efficiency of obtaining three-dimensional model contour lines, reduces the need for manual operations and the number of times of rotation of the model, and improves the accuracy of vector data.
Smart Images

Figure CN113284238B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of three-dimensional data processing and geographic information systems. Specifically, it relates to a method, apparatus, electronic device, and storage medium for extracting contour lines. Background Art
[0002] A three-dimensional model refers to a three-dimensional polygon representation of an object, usually displayed on a computer or other video device; the object displayed can be an entity in the real world or something fictional, and can range from as small as an atom to as large as a very large size. Of course, anything that exists in the physical nature can be represented by a three-dimensional model; the contour line of a three-dimensional model refers to the outline of the object in the model. Specifically, for example, if the three-dimensional model is a house, then the eaves and corner lines of the house, etc. can be understood as the contour lines of the three-dimensional model.
[0003] Currently, the main way to extract the contour lines of a three-dimensional model is to manually select and collect each corner point of the three-dimensional model at specific locations, and then connect the selected corner points to obtain a contour shape, and determine this contour shape as the contour line of the three-dimensional model. This method requires manual precise point selection on the edges of the model. Taking the three-dimensional model as a house as an example, each edge of the house needs to be collected once. For a single house, at least 4 collection points are required, and at least 3 rotations of the model are needed to complete the operation to achieve the effect of precise collection. Therefore, the method of using manual point selection to collect the contour lines of a three-dimensional model has relatively low efficiency. Summary of the Invention
[0004] The purpose of the embodiments of this application is to provide a method, apparatus, electronic device, and storage medium for extracting contour lines, which is used to improve the problem of relatively low efficiency in obtaining the contour lines of a three-dimensional model.
[0005] The embodiments of this application provide a method for extracting contour lines, including: obtaining multiple sample points of a three-dimensional model; sequentially connecting the multiple sample points to obtain a contour polyline, where the contour polyline represents the line connecting the sample points; performing a simplification operation on the contour polyline to obtain simplified vector data, where the vector data represents the key points in the contour line of the three-dimensional model; performing fitting correction on the vector data to obtain the contour line of the three-dimensional model. In the above implementation process, by sequentially connecting multiple sample points of the three-dimensional model obtained, a contour polyline is obtained, and a simplification operation is performed on the contour polyline to obtain simplified vector data; fitting correction is performed on the vector data to obtain the contour line of the three-dimensional model; thus effectively improving the problem of relatively low efficiency in obtaining the contour lines of a three-dimensional model.
[0006] Optionally, in the embodiments of the present application, obtaining a plurality of sample points of the three-dimensional model includes: sampling the obtained three-dimensional model to obtain a plurality of sampling points; clustering the plurality of sampling points to obtain a plurality of sample points. In the above implementation process, by sampling the obtained three-dimensional model to obtain a plurality of sampling points; clustering the plurality of sampling points to obtain a plurality of sample points; thereby effectively improving the feature expression ability of the sample points of the target object.
[0007] Optionally, in the embodiments of the present application, the simplification operation on the contour polyline includes: determining non-key points according to the contour polyline and a preset threshold; deleting the non-key points from the sample points included in the contour polyline. In the above implementation process, by determining non-key points according to the contour polyline and a preset threshold; deleting the non-key points from the sample points included in the contour polyline; thereby effectively improving the speed of obtaining vector data.
[0008] Optionally, in the embodiments of the present application, the non-key points include: collinear points and / or acute angle points screened according to a preset threshold; where the collinear points represent that two vectors connected by the sample points are collinear, and the acute angle points represent that the included angle formed by two line segments connected by the sample points is an acute angle.
[0009] Optionally, in the embodiments of the present application, the fitting correction of the vector data includes: using the least squares method to perform fitting correction on the vector data according to the non-key points. In the above implementation process, by using the least squares method to perform fitting correction on the vector data according to the non-key points; thereby effectively reducing the influence of the original error when obtaining the sampling points.
[0010] Optionally, in the embodiments of the present application, before obtaining a plurality of sample points of the three-dimensional model, it further includes: receiving a plurality of sample points sent by the terminal device; after performing fitting correction on the vector data to obtain the contour line of the three-dimensional model, it further includes: sending the contour line of the three-dimensional model to the terminal device. In the above implementation process, by receiving a plurality of sample points sent by the terminal device; after performing fitting correction on the vector data to obtain the contour line of the three-dimensional model, the electronic device sends the contour line of the three-dimensional model to the terminal device; thereby effectively improving the speed at which the terminal device obtains the contour line of the three-dimensional model.
[0011] Optionally, in the embodiments of the present application, before obtaining a plurality of sample points of the three-dimensional model, it further includes: obtaining the three-dimensional model; after performing fitting correction on the vector data to obtain the contour line of the three-dimensional model, it further includes: displaying the contour line of the three-dimensional model on the three-dimensional model. In the above implementation process, by obtaining the three-dimensional model; after performing fitting correction on the vector data to obtain the contour line of the three-dimensional model, the contour line of the three-dimensional model can also be displayed on the three-dimensional model, thereby effectively improving the speed of displaying the contour line of the three-dimensional model on the three-dimensional model.
[0012] The embodiment of the present application also provides a contour line extraction device, including: a sample point acquisition module for acquiring a plurality of sample points of a three-dimensional model; a sample point connection module for sequentially connecting the plurality of sample points to obtain a contour polyline, where the contour polyline represents the line connecting the sample points to each other; a sample point simplification module for performing a simplification operation on the contour polyline to obtain simplified vector data, where the vector data represents key points in the contour line of the three-dimensional model; and a contour line correction module for performing fitting correction on the vector data to obtain the contour line of the three-dimensional model. In the above implementation process, by sequentially connecting the plurality of sample points of the obtained three-dimensional model, a contour polyline is obtained, and a simplification operation is performed on the contour polyline to obtain vector data; fitting correction is performed on the vector data to obtain the contour line of the three-dimensional model; thereby effectively improving the problem of relatively low efficiency in obtaining the contour line of the three-dimensional model.
[0013] Optionally, in the embodiment of the present application, the sample point acquisition module includes: a sampling point acquisition module for sampling the obtained three-dimensional model to obtain a plurality of sampling points; and a sampling point clustering module for clustering the plurality of sampling points to obtain a plurality of sample points.
[0014] Optionally, in the embodiment of the present application, the sample point simplification module includes: a non-key point determination module for determining non-key points according to the contour polyline and a preset threshold; and a non-key point deletion module for deleting non-key points from the sample points included in the contour polyline.
[0015] Optionally, in the embodiment of the present application, the contour line correction module includes: a data fitting correction module for performing fitting correction on the vector data using the least squares method according to the non-key points.
[0016] Optionally, in the embodiment of the present application, the contour line extraction device further includes: a sample point receiving module for receiving a plurality of sample points sent by a terminal device; and a contour line sending module for sending the contour line of the three-dimensional model to the terminal device.
[0017] Optionally, in the embodiment of the present application, the contour line extraction device further includes: a model acquisition module for acquiring a three-dimensional model; and a contour line display module for displaying the contour line of the three-dimensional model on the three-dimensional model.
[0018] The embodiment of the present application also provides an electronic device, including: a processor and a memory, where the memory stores machine-readable instructions executable by the processor, and when the machine-readable instructions are executed by the processor, the method described above is executed.
[0019] The embodiment of the present application also provides a storage medium, on which a computer program is stored, and when the computer program is run by a processor, the method described above is executed. Description of the Drawings
[0020] To more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings required to be used in the embodiments of the present application. It should be understood that the following drawings only show some embodiments of the present application, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.
[0021] Figure 1 Flow schematic diagram of the contour line extraction method provided by the embodiments of the present application shown;
[0022] Figure 2 Schematic diagram of the canopy operation provided by the embodiments of the present application shown;
[0023] Figure 3 Flow schematic diagram of the hierarchical clustering algorithm adopting the canopy idea provided by the embodiments of the present application shown;
[0024] Figure 4 Schematic diagram of determining non-key points provided by the embodiments of the present application shown;
[0025] Figure 5 Flow schematic diagram of the interaction between the electronic device and the terminal device provided by the embodiments of the present application shown;
[0026] Figure 6 Flow schematic diagram of directly displaying the contour line on the electronic device provided by the embodiments of the present application shown;
[0027] Figure 7 Schematic diagram of displaying the contour line of the three-dimensional model provided by the embodiments of the present application shown;
[0028] Figure 8 Schematic diagram of the contour line extraction device provided by the embodiments of the present application shown;
[0029] Figure 9 Schematic diagram of the structure of the electronic device provided by the embodiments of the present application shown. Detailed implementation manners
[0030] The following will clearly and completely describe the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application.
[0031] Before introducing the contour line extraction method provided by the embodiments of the present application, some concepts involved in the embodiments of the present application will be introduced first. The concepts involved in the embodiments of the present application are as follows:
[0032] A database (DB) refers to a collection of electronically stored data or electronic files. In short, it can be regarded as an electronic filing cabinet, and users can perform operations such as adding, intercepting, updating, and deleting data in the files. Here, the database is a data set stored together in a certain way, shared by multiple users, with the smallest possible redundancy, and independent of application programs.
[0033] The Delaunay triangulation is a collection of a series of connected and non-overlapping triangles, and the circumcircles of these triangles do not contain any other points in this surface area. The advantages of the Delaunay triangulation are good structure, simple data structure, small data redundancy, high storage efficiency. The Delaunay triangulation is consistent with irregular ground features, can represent linear features and overlay the boundaries of regions of any shape, and can adapt to data with various distribution densities, etc.
[0034] A server refers to a device that provides computing services through a network. Servers include, for example, x86 servers and non-x86 servers. Non-x86 servers include mainframes, minicomputers, and UNIX servers. Of course, in the specific implementation process, the above servers can specifically select mainframes or minicomputers. Here, a minicomputer refers to a closed and dedicated device that provides computing services using a reduced instruction set computing (RISC), million instructions per second (MIPS), and other dedicated processors, and mainly supports the UNIX operating system. Here, a mainframe, also known as a large mainframe, refers to a device that provides computing services using a dedicated processor instruction set, operating system, and application software.
[0035] It should be noted that the contour line extraction method provided in the embodiments of the present application can be executed by an electronic device. Here, the electronic device refers to a device terminal with the function of executing a computer program or the above-mentioned server. Device terminals include, for example, smartphones, personal computers (PCs), tablets, personal digital assistants (PDAs), mobile Internet devices (MIDs), network switches, or network routers, etc.
[0036] Please refer to Figure 1 the flow schematic diagram of the contour line extraction method provided in the embodiments of the present application shown; the contour line extraction method may include the following steps:
[0037] Step S110: Obtain multiple sample points of the three-dimensional model.
[0038] A sample point refers to a coordinate point or digital point obtained by collecting a three-dimensional model according to certain rules and methods. Specifically, for example, if the three-dimensional model is a cube or a cuboid, and the vertices of the three-dimensional model are collected as sample points, then the eight vertices of the cube or the eight vertices of the cuboid here can be understood as the sample points of the above three-dimensional model. The sample points here can be obtained by collecting according to a preset density, so the sample points here can also be understood as dense sample points, and the preset density can be set according to specific circumstances, such as: 1 millimeter, 1 centimeter or 1 decimeter, etc.
[0039] It can be understood that the above three-dimensional model is a Delaunay triangulation composed of triangular patches. Here, the triangular patch refers to a triangle obtained after the three-dimensional model is Delaunay triangulated. Delaunay triangulation, also known as Delaunay triangulation, means that in the fields of mathematics and computational geometry, the Delaunay triangulation of a point set P on a plane is a triangulation DT(P) such that no point in P is strictly inside the circumcircle of any triangle in DT(P). Therefore, the above triangular patches can be simply understood as composed of multiple triangles with certain rules.
[0040] The implementation method of obtaining multiple sample points of the three-dimensional model in the above step S110 may include the following steps:
[0041] Step S111: Sample the obtained three-dimensional model to obtain multiple sampling points.
[0042] A sampling point refers to a coordinate point or digital point obtained by sampling a three-dimensional model. The sampling points here can be obtained by sampling according to a preset interval, so the sampling points here can also be understood as dense sampling points, and the preset interval can be set according to specific circumstances, such as: 1 millimeter, 1 centimeter or 1 decimeter, etc.
[0043] There are many ways to sample the obtained three-dimensional model above: methods such as plane intersection method and line segment intersection method. For the convenience of understanding and explanation, here, the grid sampling composed of horizontal line segments is taken as an example for explanation. The sampling method includes at least the following two methods:
[0044] The first is to use plane intersection test sampling; here, the plane intersection test sampling means constructing a horizontal test plane and then using this horizontal test plane to perform an intersection operation with the above three-dimensional model, that is, calculating the intersection points of the horizontal test plane and the three-dimensional model. The intersection points obtained by using this sampling method are located on the side lines of the triangle. If the span of the triangle is relatively large, that is, the side length of the triangle is relatively long, then the sampling points obtained by using this method are fewer than other methods, so the calculation speed using this method is relatively fast.
[0045] The second method uses line segment intersection testing for sampling; the line segment intersection testing for sampling here refers to constructing at least one line segment and then performing an intersection operation between at least one line segment and the above-mentioned three-dimensional model, that is, calculating the intersection points between at least one line segment and the three-dimensional model. It can be understood that the at least one line segment here can be one line segment or multiple line segments. To improve the calculation speed, only one line segment can be used; of course, to improve the sampling accuracy, multiple line segments can also be used; among them, the multiple line segments here can have various forms. For example, these multiple line segments can form a grid, and the grid can include multiple small cells. The shapes of the small cells include but are not limited to: triangular or quadrilateral and other polygonal shapes. When calculating the intersection points between the grid and the three-dimensional model, the spacing of the grid can be set to adjust the density of sampling the three-dimensional model, or it can also be understood as adjusting the area size of the small cells to adjust the density of sampling the three-dimensional model, so as to improve the sampling accuracy of the three-dimensional model.
[0046] Step S112: Cluster multiple sampling points to obtain multiple sample points.
[0047] Please refer to Figure 2 the schematic diagram of the canopy operation provided by the embodiment of the present application shown; it can be understood that after clustering multiple sampling points, sample points belonging to the target object can be obtained. Specifically, for example, when the three-dimensional model is three houses, these three houses include: the first house, the second house, and the third house. When sampling these three houses, the obtained sample points may be the sample points of these three houses. If only the sample points of the second house are needed, then a targeted clustering operation can be performed on these sample points to obtain the sample points of the second house. The above-mentioned implementation method of clustering multiple sampling points, for example: using the hierarchical clustering algorithm to cluster multiple sampling points. Here, the hierarchical clustering algorithm uses the canopy operation to increase the two-layer clustering radius. The two-layer clustering radius here includes: a small radius and a large radius; among them, the small radius is used as the distance threshold for judging the same category, and the large radius is used to select candidate data points of the same category. That is to say, the cluster points close to the center within the small radius are the clustering centers of the current cluster. The cluster points other than the clustering centers within the small radius can be determined as the same-category cluster points, and the cluster points outside the small radius and within the large radius can be determined as candidate cluster points, and the cluster points outside the large radius can be determined as non-candidate cluster points; therefore, using the large radius here can exclude a large number of non-candidate data, greatly improving the efficiency of the clustering algorithm.
[0048] In the above implementation process, by sampling the obtained three-dimensional model, multiple sampling points are obtained; by clustering multiple sampling points, multiple sample points are obtained; thus effectively improving the feature expression ability of the sample points of the target object.
[0049] Please refer to Figure 3Schematic flowchart of the hierarchical clustering algorithm using the canopy idea provided by the embodiments of the present application; First, input multiple sample points, and each sample point can be regarded as a cluster, so multiple clusters are obtained; Select one of the multiple clusters and denote it as C, then select a member cluster point from cluster C to perform the canopy operation. If it is determined to be a same-cluster point by the canopy operation, then this same-cluster point needs to be merged, that is, make this same-cluster point become a member cluster point of cluster C. Until all clusters have no changes, the operation of the hierarchical clustering algorithm is completed. If there are changes in the clusters, then cluster C needs to be assigned to the next cluster, that is, select the next cluster point from the unmerged cluster points among the multiple clusters as cluster C, and then perform the above step of selecting a member cluster point from cluster C to perform the canopy operation until all clusters have no changes, and the operation of the hierarchical clustering algorithm is completed.
[0050] After step S110, step S120 is executed: The electronic device sequentially connects multiple sample points to obtain a contour polyline.
[0051] The above polyline can be understood as the line connecting the above multiple sample points, and the contour polyline can also be understood as the vector line of the 3D model; After obtaining multiple sample points of the 3D model, the multiple sample points are sequentially connected into a polyline to obtain a contour polyline. The order of connecting the above multiple sample points is, for example: The multiple sample points include: the first sample point and the second sample point; Then specifically in the implementation process, it can be that the first sample point connects the second sample point, or it can be that the second sample point connects the first sample point; Therefore, the order of connecting the multiple sample points here should not be understood as a limitation to the embodiments of the present application.
[0052] After step S120, step S130 is executed: Perform a simplification operation on the contour polyline to obtain the simplified vector data.
[0053] Vector data refers to the data of the key points in the contour line representing the 3D model; The key points here can be understood as the points representing the key part contours in the contour line of the 3D model, for example: the cluster points corresponding to the clustering centers obtained by the above hierarchical clustering algorithm. It can be understood that in the specific implementation process, the vector data here can also be called refined vector data.
[0054] There are many implementation methods for the above simplification operation on the contour polyline, and there are also many algorithms that can be used, such as: the perpendicular distance method, the Li-Openshaw algorithm or the Douglas-Peucker algorithm; Among them, using the perpendicular distance method to perform the simplification operation on the contour polyline can effectively improve the accuracy of controlling the cluster points. For the convenience of understanding and explanation, the process of using the perpendicular distance method to perform the simplification operation on the contour polyline is introduced below, and this process can include the following steps:
[0055] Step S131: Determine non-key points according to the contour polyline and a preset threshold.
[0056] The preset threshold refers to the threshold for screening non-key points, and the preset threshold here can be set according to specific circumstances. For example, it can be set to 3, 5, 8, etc.
[0057] Non-key points refer to clusters of points that are difficult to represent key parts in the contour line of a 3D model. The non-key points here can include: collinear points and / or acute-angle points screened according to the preset threshold. Among them, collinear points represent that two vectors connected by sample points are collinear, and acute-angle points represent that the included angle formed by two line segments connected by sample points is an acute angle.
[0058] Please refer to Figure 4 The schematic diagram of determining non-key points provided by the embodiment of the present application shown in the figure; the above implementation manner of determining non-key points according to the contour polyline and the preset threshold is, for example: calculate the distance value from the target point to the polyline formed by the front and back points and the angle value formed by the line connecting the front and back points point by point from multiple sample points, and use the perpendicular distance and the angle to determine non-key points at the same time.
[0059] The above method for determining collinear points is specifically, for example: the target point is point D, and the front and back points are point C and point E respectively. Then the distance value from point D to the polyline formed by point C and point E is the first distance, and the angle value formed by the lines connecting point D to point C and point E respectively is the first angle. If the first distance is less than the first preset threshold and the first angle is greater than the second preset threshold, then it is determined that point D is a collinear point. It can be understood that in the specific implementation process, the first preset threshold and the second preset threshold can be set according to specific circumstances. The first preset threshold can be set to 1 mm or 2 mm, for example, and the second preset threshold can be set to 178 degrees or 175 degrees, etc.
[0060] The above method for determining acute angles is specifically, for example: the target point is point B, and the front and back points are point C and point A respectively. Then the distance value from point B to the polyline formed by point C and point A is the second distance, and the angle value formed by the lines connecting point B to point C and point A respectively is the second angle. If the second distance is greater than or equal to the first preset threshold and the second angle is less than or equal to the second preset threshold, then it is determined that point D is an acute-angle point. As described above, the first preset threshold and the second preset threshold here can be set according to specific circumstances.
[0061] Step S132: Delete non-key points from the sample points included in the contour polyline.
[0062] The above implementation of deleting non-key points from the sample points included in the contour polyline is as follows: As can be seen from the above, non-key points include: collinear points and / or acute-angle points screened according to a preset threshold; collinear points or / and acute-angle points can be removed from multiple sample points to obtain sample points after removing non-key points, or the obtained collinear points or / and acute-angle points can be stored in a relational database; the relational database here refers to a database that organizes data using a relational model. The relational database stores data in the form of rows and columns for easy understanding by users. This series of rows and columns in the relational database is called a table. Common relational databases include, for example, Mysql, PostgreSQL, Oracle, and SQLSever, etc. In the above implementation process, non-key points are determined according to the contour polyline and the preset threshold; non-key points are deleted from the sample points included in the contour polyline; thereby effectively improving the speed of obtaining vector data.
[0063] After step S130, step S140 is executed: fitting and correcting the vector data to obtain the contour line of the three-dimensional model.
[0064] It can be understood that in the acquisition of geographical three-dimensional model data, the above three-dimensional model data is generally calculated and synthesized from the image data obtained by oblique photography. There may be unevenness on the same wall surface of the three-dimensional model. In the process of obtaining sampling points above, the data of the sampling points is calculated based on the three-dimensional model. Therefore, the original error of the sampling points will affect the finally obtained contour line; in order to reduce the influence of the original error of the sampling points, the vector data can be fitted and corrected.
[0065] The above implementation of fitting and correcting the vector data is as follows: using the least squares method to fit and correct the vector data according to non-key points; the least squares method here, also known as the method of least squares, is a mathematical optimization method; the least squares method finds the best function match for the data by minimizing the sum of the squares of the errors; the unknown data can be easily obtained using the least squares method, and the sum of the squares of the errors between the obtained data and the actual data is minimized. In the above implementation process, the vector data is fitted and corrected according to non-key points using the least squares method; thereby effectively reducing the influence of the original error when obtaining sampling points.
[0066] Specific examples of the above embodiments are as follows: When performing fitting and correction on vector data, the distance from the sampling points that have been clustered originally can be calculated to the simplified line segment, and the non-key points within the preset distance are used as the points for fitting operations; specifically, for example, the collinear points and / or acute angle points within 0.2 meters from the straight line are used as the points for fitting operations, and the fitting method can be implemented using the least squares method described above. Each simplified line segment is corrected once, and then the intersection points of adjacent two straight lines are calculated, and the intersection points are used to replace the original nodes. It can be understood that after performing fitting and correction on the vector data using the above method steps, the contour lines of the three-dimensional model are made more accurate. Therefore, in the specific implementation process, the contour lines of the obtained three-dimensional model can also be referred to as accurate contour lines.
[0067] In the above implementation process, by sequentially connecting multiple sample points of the obtained three-dimensional model, a contour polyline is obtained, and a simplification operation is performed on the contour polyline to obtain the simplified vector data; the vector data is subjected to fitting and correction to obtain the contour lines of the three-dimensional model; thereby effectively improving the problem of relatively low efficiency in obtaining the contour lines of the three-dimensional model.
[0068] Please refer to Figure 5 the schematic flowchart of the interaction between the electronic device and the terminal device provided by the embodiment of the present application shown; Optionally, the above electronic device can also interact with the terminal device, then the above contour line extraction method can further include the following steps:
[0069] Step S210: The terminal device obtains and sends multiple sample points of the three-dimensional model.
[0070] The implementation manner of the terminal device obtaining multiple sample points of the three-dimensional model in the above step S210 can include the following steps, for example:
[0071] Step S211: The terminal device obtains the three-dimensional model.
[0072] The implementation manner of the above terminal device obtaining the three-dimensional model includes: the first way, obtaining the pre-stored three-dimensional model, obtaining the three-dimensional model from the file system, or obtaining the three-dimensional model from the database; the second way, receiving and obtaining the three-dimensional model from other terminal devices; the third way, using software such as a browser to obtain the three-dimensional model on the Internet, or using other application programs to access the Internet to obtain the three-dimensional model; the fourth way, using three-dimensional model construction software to construct the required three-dimensional model, specifically, for example: using 3dmax to convert the real building design into a three-dimensional model, etc.
[0073] Step S212: The terminal device obtains multiple sample points of the three-dimensional model.
[0074] Among them, the implementation principle and implementation manner of this step are similar or analogous to those of step S110. Therefore, the implementation manner and principle of this step will not be described here. If there are any unclear points, reference can be made to the description of step S110.
[0075] Step S213: The terminal device sends multiple sample points of the 3D model to the electronic device.
[0076] The implementation manner of the above step S213 is, for example: The terminal device sends multiple sample points of the 3D model to the electronic device through the Transmission Control Protocol (TCP); the TCP protocol here is also known as the network communication protocol, which is a connection-oriented, reliable, byte-stream-based transport layer communication protocol; in the Internet protocol suite, the TCP layer is the middle layer located above the IP layer and below the application layer; reliable, pipe-like connections are often required between the application layers of different hosts, but the IP layer does not provide such a stream mechanism, but provides unreliable packet switching.
[0077] Step S220: The electronic device receives multiple sample points sent by the terminal device.
[0078] The implementation manner of the above step S220 is, for example: The electronic device receives multiple sample points sent by the terminal device through the TCP protocol; or the electronic device receives multiple sample points sent by the terminal device through the Hyper Text Transfer Protocol (HTTP); the HTTP protocol here is a simple request-response protocol, and the HTTP protocol usually runs on top of the Transmission Control Protocol (TCP), and the HTTP protocol specifies what kind of messages the client may send to the server and what kind of responses it will get.
[0079] Step S230: The electronic device sequentially connects multiple sample points to obtain a contour polyline.
[0080] Among them, the implementation principle and implementation manner of this step are similar or analogous to those of step S120. Therefore, the implementation manner and principle of this step will not be described here. If there are any unclear points, reference can be made to the description of step S120.
[0081] Step S240: The electronic device performs a simplification operation on the contour polyline to obtain simplified vector data.
[0082] Among them, the implementation principle and implementation manner of this step are similar or analogous to those of step S130. Therefore, the implementation manner and implementation principle of this step will not be described here. If there are any unclear points, reference can be made to the description of step S130.
[0083] Step S250: The electronic device performs fitting correction on the vector data to obtain the contour line of the 3D model.
[0084] Among them, the implementation principle and implementation manner of this step are similar or analogous to those of step S140. Therefore, the implementation manner and implementation principle of this step will not be described here. If there are any unclear points, reference can be made to the description of step S140.
[0085] Step S260: The electronic device sends the contour line of the 3D model to the terminal device.
[0086] Among them, the implementation principle and implementation manner of this step are similar or analogous to those of step S210. The only difference is that in step S210, multiple sample points of the 3D model are sent, while in this step, the contour line of the 3D model is sent. Therefore, the implementation manner and implementation principle of this step will not be described here. If there are any unclear points, reference can be made to the description of step S210.
[0087] In the above implementation process, by receiving multiple sample points sent by the terminal device; after performing fitting correction on the vector data to obtain the contour line of the 3D model, the electronic device sends the contour line of the 3D model to the terminal device; thereby effectively improving the speed at which the terminal device obtains the contour line of the 3D model.
[0088] Please refer to Figure 6 the schematic flowchart of directly displaying the contour line on the electronic device provided by the embodiment of the present application shown; Optionally, the contour line of the 3D model on the above-mentioned electronic device can also be directly displayed. Then, the above contour line extraction method may further include the following steps:
[0089] Step S310: The electronic device obtains a 3D model.
[0090] Among them, the implementation principle and implementation manner of this step are similar or analogous to those of step S211. Therefore, the implementation manner and implementation principle of this step will not be described here. If there are any unclear points, reference can be made to the description of step S211.
[0091] Step S320: The electronic device obtains multiple sample points of the 3D model.
[0092] Among them, the implementation principle and implementation manner of this step are similar or analogous to those of step S110. Therefore, the implementation manner and implementation principle of this step will not be described here. If there are any unclear points, reference can be made to the description of step S110.
[0093] Step S330: The electronic device sequentially connects multiple sample points to obtain a contour polyline.
[0094] Among them, the implementation principle and implementation manner of this step are similar or analogous to those of step S120. Therefore, the implementation manner and implementation principle of this step will not be described here. If there are any unclear points, reference can be made to the description of step S120.
[0095] Step S340: The electronic device performs a simplification operation on the contour polyline to obtain the simplified vector data.
[0096] Among them, the implementation principle and implementation manner of this step are similar or analogous to those of step S130. Therefore, the implementation manner and implementation principle of this step will not be described here. If there are any unclear points, reference can be made to the description of step S130.
[0097] Step S350: The electronic device performs fitting correction on the vector data to obtain the contour line of the three-dimensional model.
[0098] Among them, the implementation principle and implementation manner of this step are similar or analogous to those of step S140. Therefore, the implementation manner and implementation principle of this step will not be described here. If there are any unclear points, reference can be made to the description of step S140.
[0099] Step S360: The electronic device displays the contour line of the three-dimensional model on the three-dimensional model.
[0100] Please refer to Figure 7Schematic diagram of displaying the contour line of a 3D model provided by an embodiment of the present application; For example, the implementation manner of the above-mentioned electronic device for displaying the contour line of a 3D model on the 3D model is as follows: The electronic device displays the contour line of the 3D model in the form of a Graphical User Interface (GUI). That is to say, when the user operates to extract the contour line, the contour line is directly displayed on the 3D model; Here, the GUI, also known as the graphical user interface, refers to the computer operation user interface displayed in a graphical manner; The GUI is a user interface that uses images and other graphical elements to simplify the process of interacting with the software and is also regarded as the "what you see is what you get" of the software. In the above implementation process, after obtaining the 3D model and performing fitting correction on the vector data to obtain the contour line of the 3D model, the contour line of the 3D model can also be displayed on the 3D model, thereby effectively improving the speed of displaying the contour line of the 3D model on the 3D model.
[0101] In the above implementation process, multiple sample points of the obtained 3D model are sequentially connected to obtain a contour polyline, and the contour polyline is simplified to obtain the simplified vector data; The vector data is subjected to fitting correction to obtain the contour line of the 3D model; Thus, the problem of relatively low efficiency in obtaining the contour line of the 3D model is effectively improved.
[0102] Please refer to Figure 8 Schematic diagram of the contour line extraction device provided by an embodiment of the present application; An embodiment of the present application provides a contour line extraction device 400, and the contour line extraction device 400 includes:
[0103] A sample point acquisition module 410, configured to acquire multiple sample points of the 3D model.
[0104] A sample point connection module 420, configured to sequentially connect multiple sample points to obtain a contour polyline, where the contour polyline represents a line connecting the sample points to each other.
[0105] A sample point simplification module 430, configured to simplify the contour polyline to obtain the simplified vector data, where the vector data represents key points in the contour line of the 3D model.
[0106] A contour line correction module 440, configured to perform fitting correction on the vector data to obtain the contour line of the 3D model.
[0107] Optionally, in an embodiment of the present application, the sample point acquisition module includes:
[0108] A sampling point acquisition module, configured to sample the obtained 3D model to obtain multiple sampling points.
[0109] A sampling point clustering module, configured to cluster multiple sampling points to obtain multiple sample points.
[0110] Optionally, in the embodiments of the present application, the sample point simplification module includes:
[0111] A non-key point determination module, configured to determine non-key points according to the contour polyline and a preset threshold.
[0112] A non-key point deletion module, configured to delete non-key points from the sample points included in the contour polyline.
[0113] Optionally, in the embodiments of the present application, the non-key points may include: collinear points and / or acute angle points screened according to a preset threshold; wherein, the collinear points represent that two vectors connected by the sample points are collinear, and the acute angle points represent that the included angle formed by two line segments connected by the sample points is an acute angle.
[0114] Optionally, in the embodiments of the present application, the contour line correction module includes:
[0115] A data fitting and correction module, configured to perform fitting and correction on the vector data according to the non-key points by using the least squares method.
[0116] Optionally, in the embodiments of the present application, the contour line extraction device further includes:
[0117] A sample point receiving module, configured to receive a plurality of sample points sent by a terminal device.
[0118] A contour line sending module, configured to send the contour line of a three-dimensional model to the terminal device.
[0119] Optionally, in the embodiments of the present application, the contour line extraction device further includes:
[0120] A model obtaining module, configured to obtain a three-dimensional model.
[0121] A contour line display module, configured to display the contour line of the three-dimensional model on the three-dimensional model.
[0122] It should be understood that this device corresponds to the above-described contour line extraction method embodiments, and can execute each step involved in the above method embodiments. The specific functions of this device can be referred to the descriptions above. To avoid repetition, the detailed descriptions are appropriately omitted here. This device includes at least one software function module that can be stored in a memory in the form of software or firmware or solidified in the operating system (OS) of the device.
[0123] Please refer to Figure 9Schematic structural diagram of the electronic device provided by the embodiment of the present application. An electronic device 500 provided by the embodiment of the present application includes: a processor 510 and a memory 520. The memory 520 stores machine-readable instructions executable by the processor 510. When the machine-readable instructions are executed by the processor 510, the above method is executed.
[0124] The embodiment of the present application also provides a storage medium 530. A computer program is stored on the storage medium 530. When the computer program is run by the processor 510, the above contour line extraction method is executed.
[0125] Among them, the storage medium 530 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (abbreviated as SRAM), electrically erasable programmable read-only memory (abbreviated as EEPROM), erasable programmable read-only memory (abbreviated as EPROM), programmable read-only memory (abbreviated as PROM), read-only memory (abbreviated as ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0126] In several embodiments provided by the embodiments of the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the drawings show the possible architectures, functions, and operations of devices, methods, and computer program products according to multiple embodiments of the present application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code. A module, a program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0127] In addition, in each embodiment of the present application, each functional module can be integrated together to form an independent part, or each module can exist alone, or two or more modules can be integrated to form an independent part.
[0128] In this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations.
[0129] The above description is only an optional implementation manner of the embodiments of the present application, but the protection scope of the embodiments of the present application is not limited thereto. Any person skilled in the art within the technical scope disclosed in the embodiments of the present application can easily think of changes or substitutions, which should all be covered within the protection scope of the embodiments of the present application.
Claims
1. A method for extracting a contour line, characterized in that, it includes: obtaining a plurality of sample points of a 3D model; successively connecting the plurality of sample points to obtain a contour polyline, the contour polyline representing a line connecting the sample points; performing a simplification operation on the contour polyline to obtain simplified vector data, the simplified vector data representing key points in the contour line of the 3D model; using the least squares method to perform fitting correction on the vector data to obtain the contour line of the 3D model; wherein, the obtaining of a plurality of sample points of the 3D model includes: sampling the obtained 3D model to obtain a plurality of sampling points; using a hierarchical clustering algorithm to cluster the plurality of sampling points to obtain a plurality of sample points; the hierarchical clustering algorithm operates using two clustering radii, and the two clustering radii include: a small radius and a large radius; the small radius is used as a distance threshold for judging the same category, and the large radius is used to select candidate data points of the same category.
2. The method according to claim 1, characterized in that, the performing of the simplification operation on the contour polyline includes: determining non-key points according to the contour polyline and a preset threshold; deleting the non-key points from the sample points included in the contour polyline.
3. The method according to claim 2, characterized in that, the non-key points include: collinear points and / or acute angle points screened out according to the preset threshold; wherein, the collinear points represent that two vectors connected by the sample points are collinear, and the acute angle points represent that the included angle formed by two line segments connected by the sample points is an acute angle.
4. The method according to claim 2, characterized in that, the performing of the fitting correction on the vector data includes: using the least squares method to perform fitting correction on the vector data according to the non-key points.
5. The method according to claim 1, characterized in that, before the obtaining of a plurality of sample points of the 3D model, it further includes: receiving the plurality of sample points sent by a terminal device; after the performing of the fitting correction on the vector data to obtain the contour line of the 3D model, it further includes: sending the contour line of the 3D model to the terminal device.
6. The method according to claim 1, characterized in that, before the obtaining of a plurality of sample points of the 3D model, it further includes: obtaining the 3D model; after the performing of the fitting correction on the vector data to obtain the contour line of the 3D model, it further includes: displaying the contour line of the 3D model on the 3D model.
7. A contour line extraction device, characterized in that, it includes: a sample point obtaining module for obtaining a plurality of sample points of a 3D model; a sample point connection module for successively connecting the plurality of sample points to obtain a contour polyline, the contour polyline representing a line connecting the sample points; a sample point simplification module for performing a simplification operation on the contour polyline to obtain simplified vector data, the simplified vector data representing key points in the contour line of the 3D model; a contour line correction module for using the least squares method to perform fitting correction on the vector data to obtain the contour line of the 3D model; Among them, obtaining multiple sample points of the three-dimensional model includes: sampling the obtained three-dimensional model to obtain multiple sampling points; using a hierarchical clustering algorithm to cluster the multiple sampling points to obtain multiple sample points; the hierarchical clustering algorithm operates using two clustering radii, and the two clustering radii include: a small radius and a large radius; the small radius is used as the distance threshold for judging the same category, and the large radius is used to select candidate data points of the same category.
8. An electronic device, Characterized in that, Comprising: A processor and a memory, the memory stores machine-readable instructions executable by the processor, and when the machine-readable instructions are executed by the processor, the method according to any one of claims 1 to 6 is executed.
9. A storage medium, Characterized in that, A computer program is stored on the storage medium, and when the computer program is run by a processor, the method according to any one of claims 1 to 6 is executed.
Citation Information
Patent Citations
Small-curvature thin-wall part boundary extraction method based on three-dimensional point cloud
CN110322464A
Lane line vectorization method and device and storage medium
CN110458083A