A method, device and medium for extracting contour lines based on building point cloud data
By calculating the normal vector and edge index of building point cloud data, combined with recursive search and non-maximum suppression technology, the problems of inaccurate and discontinuous building contour extraction in the existing technology are solved, and accurate building contour extraction and fitting are achieved.
Patent Information
- Application Number
- CN202410559844.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-07
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2044-05-07
AI Technical Summary
When extracting building contour lines, the edge point extraction is inaccurate due to the discreteness and disorder of point cloud data. The contour edge points are not neatly connected to lines, and the extracted contour lines are jagged due to noise, and interrupts and discontinuities are generated in larger point cloud holes.
By calculating the normal vector of building point cloud data, obtaining edge points on the building outline, and searching the closest point recursively for normal vector similarity calculation to determine edge points. Then, the edge index and gradient values of each point cloud are calculated, non-maximum suppression and filtering are performed, and the building profile is fitted based on the least squares method.
It effectively solves the problems of interruption and discontinuity of edge contour generation caused by large point cloud holes, and realizes accurate and automatic extraction of contour lines of building point cloud data, avoiding the problems of untidy and jagged contour lines.
Smart Images

Figure CN118429374B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of contour line extraction, and in particular relates to a contour line extraction method, equipment and medium based on building point cloud data. Background Art
[0002] Point cloud data refers to a set of vectors in a three-dimensional coordinate system, which is discrete and disordered. Point cloud edge extraction is of great significance to the informatization, vectorization and three-dimensional modeling of scanned objects. Existing point cloud edge extraction uses convex hull detection, normal vector and curvature edge extraction, longitude and latitude scanning and other methods.
[0003] Due to the limitations of the device's field of view and occlusion when acquiring point cloud data, there are point cloud holes, which causes interruptions and discontinuities in larger point cloud holes when extracting contour lines using existing point cloud edge extraction methods.
[0004] At the same time, due to the discreteness and disorder of point cloud data, the existing point cloud edge extraction method has the problems of inaccurate edge point extraction and uneven contour edge points after connecting into lines. At the same time, affected by point cloud noise, noise points may be extracted as contour edge points, resulting in the extracted building contour line being jagged. Summary of the invention
[0005] In order to solve the problems in existing methods of extracting building edge lines, such as interruption and discontinuity of contour lines in larger point cloud holes, inaccurate extraction of contour edge points, uneven connection after line connection, and jagged extracted building contour lines, the present invention provides a contour line extraction method, device and medium based on building point cloud data.
[0006] The purpose of the present invention is achieved through the following technical solutions:
[0007] A first aspect of the present invention provides a method for extracting contour lines based on building point cloud data, comprising the following steps:
[0008] Acquire building point cloud data to obtain a first point cloud data set;
[0009] Calculating the normal vector of the building point cloud data in the first point cloud data set so that the normal direction is upward, that is, the normal vector value is positive;
[0010] Acquire an edge point on a building outline, wherein the edge point is a point cloud in the first point cloud data set;
[0011] Taking the edge point obtained as the starting point, searching for the nearest points in all directions and performing normal vector similarity calculation to determine the next nearest edge point, and then taking the next edge point as the starting point to continue searching for other edge points in a recursive manner to obtain roughly extracted edge points of the building outline, i.e., the second point cloud data set;
[0012] Searching for points within a distance threshold range of each point cloud in the first point cloud data set, determining a center point, and calculating an edge index of each point cloud;
[0013] Performing gradient calculation on each point cloud in the first point cloud data set and the point cloud with the largest edge index among the point clouds within the distance threshold range thereof, to obtain a gradient value of each point cloud;
[0014] Calculate the direction vector of each point cloud in the first point cloud data set and each point cloud within the distance threshold range, retain the point whose similarity between the gradient of the current point and the direction vector of each point cloud within the distance threshold range from the current point to the current point exceeds the threshold as the maximum point, if the edge index of the current point is less than the edge index of any maximum point, set the edge index of the current point to 0, complete non-maximum suppression, delete redundant point clouds, and obtain the third point cloud data set;
[0015] Taking the intersection of the third point cloud data set and the second point cloud data set, completing filtering of the roughly extracted building outline edge points, and obtaining a fourth point cloud data set;
[0016] The building outline edge point cloud in the fourth point cloud data set is fitted based on the least squares method to obtain the building outline.
[0017] The second aspect of the present invention provides a contour line extraction device based on building point cloud data, comprising a memory and a controller that are communicatively connected in sequence, wherein a computer program is stored in the memory, and the controller is used to read the computer program and execute a contour line extraction method based on building point cloud data described in the first aspect.
[0018] A third aspect of the present invention provides a computer-readable storage medium having instructions stored thereon. When the instructions are run on a computer, a contour line extraction method based on building point cloud data described in the first aspect is executed.
[0019] Compared with the prior art, the present invention has at least the following advantages and beneficial effects:
[0020] 1. The method of the present invention can effectively solve the problem of interruption and discontinuity of edge contour line generation caused by large holes in point clouds;
[0021] 2. The method of the present invention can effectively solve the problem of inaccurate edge point extraction caused by the discreteness and disorder of point cloud data, the problem of uneven contour edge points after being connected into lines, and the problem of local jagged building contour lines extracted due to noise, thereby realizing accurate and automatic extraction of contour lines of building point cloud data. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0023] Figure 1 is a flow chart of the contour extraction method of the present invention;
[0024] Figure 2 This is a schematic diagram of building point cloud data;
[0025] Figure 3 for Figure 2 The normal vector value of the building point cloud data is the positive normal vector calculation result diagram;
[0026] Figure 4 An example of the edge starting point obtained;
[0027] Figure 5 This is an example of point cloud data on a building outline obtained by rough extraction;
[0028] Figure 6 This is an example of an edge point that is incorrectly extracted due to noise;
[0029] Figure 7 This is an example of an edge point cloud obtained by using the maximum value suppression of the present invention;
[0030] Figure 8 This is an example of an edge point cloud obtained without using the maximum value suppression of the present invention;
[0031] Fig. 9 This is an example of edge points before filtering;
[0032] Fig.10 This is an example of edge points after filtering;
[0033] Fig.11 This is the result of fitting and vectorizing an edge line. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0035] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0036] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.
[0037] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0038] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inside", "outside", etc. indicate positions or positional relationships based on the positions or positional relationships shown in the accompanying drawings, or the positions or positional relationships in which the product of the invention is usually placed when in use, or the positions or positional relationships commonly understood by those skilled in the art, which are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance.
[0039] In the description of the present invention, it is also necessary to explain that, unless otherwise clearly specified and limited, the terms "set", "install", "connect", and "connect" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0040] The first aspect of the present invention discloses a method for extracting contour lines based on building point cloud data. The method can be, but is not limited to, performed by a contour line extraction device based on building point cloud data. The contour line extraction device based on building point cloud data can be software, or a combination of software and hardware. The contour line extraction device based on building point cloud data can be integrated in smart mobile terminals, tablets, computers and other smart devices. Specifically, Figure 1 As shown, the contour extraction method based on building point cloud data includes the following steps S01 to S09. It should be noted that the step identification in this scheme is only for the convenience of explaining the method, and does not constitute a sequence limitation. The sequence of each step is based on its language description and the sequence of each signal.
[0041] Step S01: Obtain building point cloud data to obtain a first point cloud data set.
[0042] In this step, the building point cloud data can be directly obtained, such as by uploading the building point cloud to the cloud or directly obtaining it in other ways; or the building point cloud data can be segmented from the point cloud data to obtain the building point cloud data.
[0043] For example, Figure 2 Take the building point cloud data in as an example.
[0044] Step S02: Calculate the normal vector of the building point cloud data in the first point cloud data set so that the normal direction is upward, that is, the normal vector value is positive.
[0045] In this step, the normal vector of the building point cloud data is calculated so that the normal vector points upward, that is, the Z value of the normal direction of each point is positive, and the calculated normal vector is stored in the corresponding array. Figure 2 The building point cloud data shown in is processed to obtain Figure 3 Results shown.
[0046] Step S03: Acquire an edge point on the outline of a building, where the edge point is a point cloud in the first point cloud data set.
[0047] In this step, the edge points on the building outline can be manually selected or automatically selected and obtained.
[0048] Step S04: Taking the acquired edge point as the starting point, searching for the nearest points in all directions and performing normal vector similarity calculation to determine the next nearest edge point, and then taking the next edge point as the starting point to continue searching for other edge points in a recursive manner to obtain roughly extracted edge points of the building outline, i.e., the second point cloud data set.
[0049] Specifically, this step realizes the rough extraction of the building outline, including steps A1 to A4.
[0050] A1, taking the obtained edge point as the starting point;
[0051] A2. Based on KDTree, search for the nearest point in all directions and calculate the similarity between the nearest point and the normal vector of the starting point.
[0052] A3. In response to the similarity being greater than the similarity threshold, the nearest point is determined as an edge point and stored in the second point cloud data set. In this step, the preferred range of setting the similarity threshold is 0.9-1.
[0053] A4. Execute steps A2 and A3 with the nearest edge point as the next edge starting point until no point cloud meeting the requirements is found.
[0054] KDTree, or K-dimensional tree, is a high-dimensional index tree data structure that is often used for nearest neighbor search and approximate nearest neighbor search in large-scale high-dimensional data spaces.
[0055] In this step, the edge points that meet the requirements are continuously expanded outwards through recursion until no edge points that meet the requirements are detected, and the search is stopped to obtain the second point cloud data set, that is, the initial point set of the building outline edge. The edge points obtained are Figure 4 As an example, the red point cloud shown in the figure has point cloud data on the same building outline as the point cloud in the second point cloud dataset. Figure 5 As shown in red.
[0056] During the search process, by continuously expanding the search range, the two endpoints of a contour line can be searched, which can effectively solve the problem of interrupted and discontinuous generation of edge contour lines caused by large holes in the point cloud.
[0057] Affected by the noise of the point cloud data, when searching for the edge points of the building outline in step S04, there will be points that have a high similarity with the normal vector of the selected edge point, but the point position is not on the building outline, such as Figure 6 For the point cloud in the red box, this problem is solved through steps S05 to S08.
[0058] Step S05: search for points within a distance threshold range of each point cloud in the first point cloud data set, determine a center point, and calculate an edge index of each point cloud.
[0059] Specifically, the edge index is calculated by first calculating the center point of each point cloud in the first point cloud data set and all point clouds whose distances are within the distance threshold; then calculating the distance L1 from each point cloud in the first point cloud data set to the corresponding center point and the distance L2 from each point cloud in the first point cloud data set to the point cloud farthest from it within the distance threshold; finally, calculating L1 / L2 to obtain the edge index of each point cloud.
[0060] This scheme uses the edge index to measure the characteristics of the edge area in the point cloud data. The larger the edge index of the point cloud, the greater the possibility that the point is an edge.
[0061] In this step, the preferred range for setting the distance threshold is 0.2 meters to 0.3 meters.
[0062] Step S06: performing gradient calculation on each point cloud in the first point cloud data set and the point cloud with the largest edge index among the point clouds within the distance threshold range thereof, to obtain a gradient value of each point cloud.
[0063] The gradient is a vector that represents the rate of change of a function at a certain point. In step S05, all point clouds within the distance threshold range around each point cloud are determined, and among these point clouds, the point cloud with the largest edge index is found, and the gradient value of the point is obtained by using each point cloud and its corresponding point cloud with the largest edge index to perform gradient calculation.
[0064] This scheme uses the gradient value to measure the distance and direction of the point cloud change in space.
[0065] Step S07, calculate the direction vector of each point cloud in the first point cloud data set and each point cloud within the distance threshold range thereof, retain the point whose similarity between the gradient of the current point and the direction vector of each point cloud within the distance threshold range thereof exceeds the threshold, as the maximum point, if the edge index of the current point is less than the edge index of any maximum point, set the edge index of the current point to 0, complete non-maximum suppression, delete redundant point clouds, and obtain the third point cloud data set.
[0066] In step S05, all point clouds within the distance threshold range around each point cloud have been determined. When deleting redundant point clouds, first calculate the direction vector between each point cloud and all point clouds within the distance threshold range, and then calculate the similarity between the gradient value of each point cloud and the direction vector of each point cloud within the distance threshold range. When the similarity is greater than the similarity threshold, it is retained, and these values are regarded as maximum values. The point numbers of these points are recorded, that is, point clouds with similarities greater than or equal to the similarity threshold are screened out, and point clouds with similarities less than the similarity threshold are deleted. Compare the edge index of the point cloud with the maximum edge index of the point cloud screened out in the previous step. In response to the edge index of the point cloud being less than the maximum edge index of the screened point cloud, set the edge index of the point cloud to 0, complete non-maximum suppression, delete redundant point clouds, and obtain the third point cloud data set, whose edge point clouds with maximum suppression and without maximum suppression are respectively as follows. Figure 7 , 8 shown.
[0067] This step uses non-maximum suppression to eliminate redundant point clouds. By searching for local maxima and suppressing non-maximum values, points whose edge index meets the threshold but are not true edges can be filtered out.
[0068] In this step, the preferred range for setting the similarity threshold is 0.8-0.9.
[0069] Step S08: taking the intersection of the third point cloud data set and the second point cloud data set, completing filtering of the roughly extracted building outline edge points, and obtaining a fourth point cloud data set.
[0070] By taking the intersection of the edge points identified in the above steps S05 to S07 and the second point cloud data set, filtering of the roughly extracted edge points can be completed, which can effectively solve the problem of inaccurate edge point extraction due to the discreteness and disorder of the point cloud data, the problem of uneven contour edge points after connecting into lines, and the problem of local jagged building contour lines extracted due to noise. The comparison diagram is shown in FIG. Fig. 9 , 10 As shown, the edge points before and after filtering are shown.
[0071] Through the above steps S05 to S08, the filtering of the coarsely extracted edge points can be completed, which can effectively solve the problems of inaccurate edge point extraction due to the discreteness and disorder of the point cloud data, the unevenness of the contour edge points after connecting into lines, and the local jagged problem of the building contour line extracted due to noise.
[0072] Step S09: fitting the building outline edge point cloud in the fourth point cloud data set based on the least squares method to obtain the building outline.
[0073] Since the search range is reasonably expanded in the rough extraction of edge points, the points at both ends of a contour can be searched. Combined with the least squares fitting method, the problem of contour line interruption in larger point cloud holes can be effectively solved.
[0074] The result of fitting and vectorizing an edge line is as follows Fig.11 As shown, Fig.11 The blue line is the result of fitting vectorization, and the red part is the contour point.
[0075] The second aspect of the present invention provides a contour extraction device based on building point cloud data, including a memory and a controller that are sequentially connected in communication, the memory stores a computer program, and the controller is used to read the computer program and execute a contour extraction method based on building point cloud data described in the first aspect and any possible thereof. For example, the memory may include, but is not limited to, a random access memory (RAM), a read-only memory (ROM), a flash memory (Flash Memory), a first-input first output (FIFO) and / or a first-input last output (FILO), etc.; the controller may not be limited to a microcontroller of the STM32F105 series. In addition, the computer device may also include, but is not limited to, a power supply unit, a display screen and other necessary components.
[0076] A third aspect of the present invention provides a computer-readable storage medium having instructions stored thereon. When the instructions are run on a computer, a contour line extraction method based on building point cloud data described in the first aspect is executed.
[0077] Although the present invention has been described in detail with reference to the aforementioned embodiments, it is still possible for those skilled in the art to modify the technical solutions described in the aforementioned embodiments, or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A contour extraction method based on building point cloud data, characterized in that: The following steps are involved: Acquire building point cloud data to obtain a first point cloud data set; Calculating the normal vector of the building point cloud data in the first point cloud data set so that the normal direction is upward, that is, the normal vector value is positive; Acquire an edge point on a building outline, wherein the edge point is a point cloud in the first point cloud data set; Taking the edge point obtained as the starting point, searching for the nearest points in all directions and performing normal vector similarity calculation to determine the next nearest edge point, and then taking the next edge point as the starting point to continue searching for other edge points in a recursive manner to obtain roughly extracted edge points of the building outline, i.e., the second point cloud data set; Searching for points within a distance threshold range of each point cloud in the first point cloud data set, determining a center point, and calculating an edge index of each point cloud; Performing gradient calculation on each point cloud in the first point cloud data set and the point cloud with the largest edge index among the point clouds within the distance threshold range thereof, to obtain a gradient value of each point cloud; Calculate the direction vector of each point cloud in the first point cloud data set and each point cloud within the distance threshold range, retain the point whose similarity between the gradient of the current point and the direction vector of each point cloud within the distance threshold range from the current point to the current point exceeds the threshold as the maximum point, if the edge index of the current point is less than the edge index of any maximum point, set the edge index of the current point to 0, complete non-maximum suppression, delete redundant point clouds, and obtain the third point cloud data set; Taking the intersection of the third point cloud data set and the second point cloud data set, completing filtering of the roughly extracted building outline edge points, and obtaining a fourth point cloud data set; Fitting the building outline edge point cloud in the fourth point cloud data set based on the least squares method to obtain the building outline; The step of searching for points within a distance threshold range of each point cloud in the first point cloud data set, determining a center point, and calculating an edge index of each point cloud includes: Calculate the center point of each point cloud in the first point cloud data set and all point clouds whose distances are within a distance threshold range; Calculate the distance L1 from each point cloud in the first point cloud data set to the corresponding center point; Calculate the distance L2 between each point cloud in the first point cloud data set and the point cloud farthest from it within the distance threshold range; Calculate L1 / L2 to get the edge index of each point cloud.
2. A contour line extraction method based on building point cloud data according to claim 1, characterized in that: The method uses the acquired edge point as a starting point, searches for the nearest points in all directions and calculates the normal vector similarity, determines the next nearest edge point, and then uses the next edge point as a starting point to continue searching for other edge points in a recursive manner, including: A1, taking the obtained edge point as the starting point; A2. Based on KDTree, search for the nearest point in all directions and calculate the similarity between the nearest point and the normal vector of the starting point. A3. In response to the similarity being greater than the similarity threshold, determining the nearest point as an edge point and storing it in the second point cloud data set; A4. Execute steps A2 and A3 with the nearest edge point as the next edge starting point until no point cloud meeting the requirements is found.
3. The contour line extraction method based on building point cloud data according to claim 1 is characterized in that: The step of performing gradient calculation on each point cloud in the first point cloud data set and the point cloud with the largest edge index among the point clouds within the distance threshold range thereof comprises: Determine the point cloud with the largest edge index among all point clouds within the distance threshold around each point cloud; Use each point cloud and its corresponding point cloud with the largest edge index to calculate the gradient.
4. A contour extraction device based on building point cloud data, comprising a memory and a controller which are sequentially connected in communication, wherein a computer program is stored in the memory, characterized in that: The controller is used to read the computer program and execute the contour line extraction method based on building point cloud data as described in any one of claims 1-3.
5. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed on a computer, a contour line extraction method based on building point cloud data as described in any one of claims 1 to 3 is executed.
Citation Information
Patent Citations
Pose matching method of plane object and electronic equipment
CN115994946A
Curb recognition based on laser point cloud
WO2023050638A1