Town point cloud data building generation method
By constructing a discrete line segment data set and performing polygonal contour extraction and contour structure fitting, the problem of building model inaccuracy caused by noise interference is solved, and high-accurate urban building modeling is achieved.
Patent Information
- Application Number
- CN202510384553.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-28
- Publication Date
- 2025-08-19
AI Technical Summary
In traditional urban building modeling methods, the fitting results are biased due to noise interference factors, which affects the accuracy of the building model.
Discrete line segment data sets are constructed based on the original point cloud data, simplified data is constructed through local directions, and polygonal contour extraction and contour structure fitting are used to obtain building contour data and restore building shapes.
It improves the accuracy of building profile data, can accurately characterize the contour structure of each building, and provides key data support for the construction of three-dimensional architectural models in the map of the geographic information system.
Smart Images

Figure CN120510504A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of point cloud data processing, and in particular to a method for generating buildings from urban point cloud data. Background Art
[0002] With the development of 3D GIS (Geographic Information System) technology, people are no longer satisfied with the presentation of 2D map data, and the demand for 3D map modeling is increasing. In urban areas, accurate 3D modeling of buildings has become a key requirement for the application of 3D GIS technology.
[0003] However, traditional urban building modeling methods often do not conform to expectations due to the presence of a large amount of noise in real urban environments, such as cars, trees, streetlights, and possible obstructions. These interference factors can lead to deviations in the fitting results and affect the accuracy of the building model. Summary of the Invention
[0004] Based on this, it is necessary to provide a method for generating urban point cloud data buildings that can solve the above technical problems.
[0005] In a first aspect, the present application provides a method for generating buildings from urban point cloud data. The method comprises:
[0006] Based on the pre-acquired original point cloud data, multiple local direction construction processes are performed to obtain a discrete line segment dataset; each discrete line segment in the discrete line segment dataset is used to characterize the data direction characteristics of the local area;
[0007] Polygonal contour extraction and contour structure fitting processing are performed based on the discrete line segment data set to obtain multiple building contour data; each building contour data is used to characterize the contour structure of each building;
[0008] The building shape is restored according to the outline data of each building to obtain the target polygonal building data; the target polygonal building data is used to construct a three-dimensional building model in the geographic information system map.
[0009] In a second aspect, the present application further provides a device for generating urban point cloud data buildings, the device comprising:
[0010] The local direction construction module is used to perform multiple local direction construction processes based on the pre-acquired original point cloud data to obtain a discrete line segment dataset; each discrete line segment in the discrete line segment dataset is used to characterize the data direction characteristics of the local area;
[0011] The contour data determination module is used to perform polygon contour extraction and contour structure fitting processing based on the discrete line segment data set to obtain multiple building contour data; each building contour data is used to characterize the contour structure of each building;
[0012] The building restoration module is used to restore the building shape according to the building outline data to obtain the target polygon building data; the target polygon building data is used to construct a three-dimensional building model in the geographic information system map.
[0013] In a third aspect, the present application further provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements any one of the methods in the first aspect when executing the computer program.
[0014] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, which implements any one of the methods in the first aspect when the computer program is executed by a processor.
[0015] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, which implements any one of the methods in the first aspect when executed by a processor.
[0016] The aforementioned method for generating buildings from urban point cloud data constructs a discrete line segment dataset based on the original point cloud data. This method uses localized directional construction to simplify the data, reducing data processing and improving processing efficiency. By using the discrete line segment dataset for polygonal contour extraction and contour structure fitting, building contour data can be accurately extracted from complex point cloud data. This allows the acquired building contour data to accurately represent the contour structure of each building, providing high accuracy for identifying and constructing urban building contours. Building shape restoration processing is performed based on the building contour data to generate target polygonal building data. This transforms abstract contour data into concrete polygonal building shapes, providing critical data support for constructing three-dimensional building models within geographic information system maps. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 A diagram showing an application environment of a town point cloud data construction method according to an embodiment;
[0018] Figure 2 1 is a flow chart of a method for building town point cloud data in one embodiment;
[0019] Figure 3 Schematic diagram of a process for obtaining a discrete line segment dataset in one embodiment;
[0020] Figure 4 is a schematic diagram of discrete line segment data in one embodiment;
[0021] Figure 5A schematic diagram of a process for obtaining multiple building outline data in one embodiment;
[0022] Figure 6 A schematic diagram of a process for obtaining edge data in one embodiment;
[0023] Figure 7 A schematic diagram of a process for obtaining a plurality of building outline data according to adjacent line segments in one embodiment;
[0024] Figure 8 A schematic diagram of a process for performing building shape restoration processing in one embodiment;
[0025] Figure 9 is a schematic diagram of the outline of a target polygon in one embodiment;
[0026] Figure 10 Schematic diagram of a process for obtaining two first fitting boundaries in one embodiment;
[0027] Figure 11 1 is a flow chart of a process for determining a vertex at a junction in one embodiment;
[0028] Figure 12 A schematic diagram of 3D point cloud data after data stratification in one embodiment;
[0029] Figure 13 A schematic diagram of 2D point cloud data after data stratification in one embodiment;
[0030] Figure 14 is a schematic diagram of a vertex at a junction in one embodiment;
[0031] Figure 15 This is a structural block diagram of a town point cloud data construction device in one embodiment;
[0032] Figure 16 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0033] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0034] The method for generating urban point cloud data buildings provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 01 communicates with the server 02 through the network. The data storage system can store the data that the server 02 needs to process. The data storage system can be integrated on the server 02, or it can be placed on the cloud or other network servers. The terminal performs multiple local direction construction processes based on the pre-acquired original point cloud data to obtain a discrete line segment data set that characterizes the data direction characteristics of the local area; performs contour structure fitting processing based on the discrete line segment data set and the predetermined intersection vertices to obtain multiple building contour data; performs building shape restoration processing based on each building contour data to obtain target polygon building data. Among them, the terminal 01 can be but is not limited to various personal computers, laptops, smart phones and tablets. The server 02 can be implemented with an independent server or a server cluster consisting of multiple servers.
[0035] In an exemplary embodiment, Figure 2 As shown, this application provides a method for generating urban point cloud data buildings, which is applied to Figure 1 The following steps are used as an example to illustrate the terminal in the figure:
[0036] S101, performing multiple local direction construction processes based on the pre-acquired original point cloud data to obtain a discrete line segment dataset.
[0037] The original point cloud data is a collection of massive 3D spatial points in urban areas, containing rich geographic information. Each discrete line segment in the discrete line segment dataset is used to characterize the data directional characteristics of the local area.
[0038] In an embodiment of the present application, the terminal obtains the pre-collected original point cloud data, and first determines the intersection vertices of each building boundary in the original point cloud data according to a pre-set algorithm and conditions. These conditions may include the distribution characteristics and quantity changes of point cloud data at different heights within a certain neighborhood. The coordinate system of the vertex at the intersection is converted into two-dimensional xy data based on the local coordinate system of the terminal. Subsequently, the terminal randomly selects a vertex from the point cloud data as the starting point, demarcates a circular area with a radius of 0.5 meters with the vertex as the center, and extracts all point cloud data within the area. The point cloud data are fitted with a straight line using the least squares method to obtain a straight line that can represent the direction of the data in the local area, and record it as a line segment in the discrete line segment data set. Then, the terminal repeats the above steps, continuously randomly selecting new vertices until all point cloud data are processed, and finally generates a discrete line segment data set.
[0039] S102: polygonal contour extraction and contour structure fitting are performed based on the discrete line segment data set to obtain a plurality of building contour data, wherein each building contour data is used to represent the contour structure of each building.
[0040] In the embodiment of the present application, based on the generated discrete line segment data set, the terminal starts to perform polygon contour extraction and contour structure fitting. Collinearity is defined: the angle difference and minimum distance of two line segment data are within the defined range. The target vector set is initialized to be empty. The target vector set divides the discrete line segment data set into multiple groups. Any line segment data in each group is collinear with at least one other line segment data in the group. Traverse all discrete line segment sets and add the line segment data to the target vector set one by one. Each time, a discrete line segment is taken as a, and a is compared with all groups in the target vector set. When a is collinear with a line segment in a group, a is added to the group; when a is collinear with a line segment in multiple groups, these groups are merged and a is added; when a is not collinear with the data in any group; a is added to the target vector set as a new group. Target initial vectors that only contain 1-2 data (mostly corner noise data) are excluded. Next, the starting and ending points of each set of line segments are placed into the corresponding vector data starting and ending points. The line segments are refitted using the least squares method. These refitted line segments are traversed. If the distance between any two fitted line segments is less than a threshold, the fitted line segments are considered adjacent. When there are four or more consecutive fitted line segments that are adjacent to each other and adjacent at both ends, it can be determined that these data constitute the building outline. If there are more than four building data, noise may have caused the fitted line segments to split. In this case, the angular relationship between the fitted line segments must be determined. The vector sets corresponding to the fitted line segments with an angle within 45 degrees are merged and refitted until the number of building data is four. Ultimately, multiple building outline data are obtained, each of which accurately describes the outline structure of the corresponding building.
[0041] S103: Perform building shape restoration processing based on each building outline data to obtain target polygonal building data.
[0042] The target polygonal building data is the data obtained by performing building shape restoration processing on the building outline data. The target polygonal building data is used to construct a three-dimensional building model in a geographic information system map.
[0043] In an embodiment of the present application, the terminal restores the building shape for each building outline data. The longest, nearly parallel fitting line segment is selected from the four fitted lines, the angle difference between the two sets of fitting line segments is calculated, and the difference is evenly divided into 5-20 times. The evenly divided angles (i.e., different slopes) are traversed, and the optimal line segment is refitted at each slope using the corresponding two sets of linear vector data start and end points, and the error is calculated. The slope with the smallest error is selected as the optimal fitting slope, and the two corresponding refitted fitting line segments are the optimal fitting boundaries of the data set. A vertical fitting line segment is then constructed based on the slope, and the other two sets of linear vector data start and end points are refitted. Finally, four adjacent and perpendicular fitting line segments are obtained, and their intersection is calculated to achieve optimal restoration of the rectangular building. The above operations are performed on all building outline data to generate corresponding rectangular data, and then the target polygonal building data is obtained.
[0044] The aforementioned method for generating buildings from urban point cloud data constructs a discrete line segment dataset based on the original point cloud data. This method uses localized directional construction to simplify the data, reducing data processing and improving processing efficiency. By using the discrete line segment dataset for polygonal contour extraction and contour structure fitting, building contour data can be accurately extracted from complex point cloud data. This allows the acquired building contour data to accurately represent the contour structure of each building, providing high accuracy for identifying and constructing urban building contours. Building shape restoration processing is performed based on the building contour data to generate target polygonal building data. This transforms abstract contour data into concrete polygonal building shapes, providing critical data support for constructing three-dimensional building models within geographic information system maps.
[0045] In an exemplary embodiment, based on the above embodiment, see Figure 3 The embodiment of the present application involves constructing multiple local directions based on pre-acquired original point cloud data, and the process of obtaining a discrete line segment dataset includes the following steps:
[0046] S201 , performing coordinate dimension conversion and boundary data extraction processing on the original point cloud data to obtain target dimension data.
[0047] In GIS systems, subsequent processing is based on point cloud data with plane coordinates xy and height z. During acquisition, there may be global angular deviations between the data and the actual coordinates. Subsequent calculations based on two-dimensional coordinates perpendicular to the ground are more convenient. This requires rotating the coordinates to make the point cloud dataset parallel to the actual coordinates (i.e., parallel to the ground).
[0048] Therefore, it's necessary to capture the entire ground data within a certain height range. Using the primary normal vectors within this range, the angle between the ground point data and the actual ground is calculated. This angle is then used to rotate the global point cloud data so that the captured data is parallel to the ground data in the actual scene. Of course, the actual situation may not be ideal. Due to uneven ground and the data containing a lot of noise (such as cars, trees, and streetlights), manual calibration of the captured ground data may be required in some cases to ensure that it is parallel to the ground data in the actual scene.
[0049] The process of extracting boundary data involves first splitting the bottom and upper-level point cloud data. Due to the nature of point cloud data acquisition, the bottom surface data of buildings is obscured at the bottom height, preventing valid point cloud data from being extracted. This results in missing point cloud data within the bottom height range. Generally, the bottom surface data is collected within a height range of 3-5 meters horizontally, including some wall data for subsequent boundary data extraction (fusing the upper and lower data). This data is projected onto the same horizontal plane. For each vertex in the upper and lower-level data, the data within a certain horizontal distance are traversed, and the proportion of high- and low-level data within a certain distance (0.1-0.5 meters, depending on the actual point cloud density) is compared. If the high-level density is between 20% and 90% (this can be adjusted based on the actual building height and boundary height), and the number of high- and low-level vertices is at least 3-8 (5 is recommended, depending on the actual point cloud density), the vertex is considered a boundary vertex.
[0050] S202: Perform multiple sampling and selection processing on the target dimension data according to a preset range to obtain local point cloud data.
[0051] In this embodiment, due to the lack of data correlation, we can express the data by constructing local directions. Subsequently, point cloud data within a certain range can be replaced by local direction line data. All coordinates are treated as 2D xy data. A vertex is randomly selected, and local point cloud data within a small range (e.g., 0.1-1.5 meters) around it is extracted.
[0052] S203 , performing multiple straight line fitting and multiple direction vector generation processes based on the multiple local point cloud data to obtain a discrete line segment dataset.
[0053] In the embodiment of the present application, for each selected local point cloud data, the terminal will use the least squares method to perform straight line fitting, and then, based on the selected range and center point, the vector of the direction information will cover the range of this set of data. When traversing the data, the next selected vertex is outside the selected range (half of the previously set small range, i.e., the radius of the circle) (in order to improve efficiency, it is recommended to use Manhattan distance, i.e., the absolute xy distance difference), and traverse one by one until all vertices are covered by at least one set of data. Figure 4As shown, a discrete line segment data set (the direction of each set of data) is finally formed.
[0054] The embodiments of the present application convert raw point cloud data into target dimension data more suitable for processing through coordinate dimension conversion, reducing data complexity and improving the efficiency of subsequent data selection and analysis. For example, converting three-dimensional data into two-dimensional data can avoid processing unnecessary height information and speed up calculations.
[0055] In an exemplary embodiment, based on the above embodiment, see Figure 5 The embodiment of the present application relates to a process of extracting polygon outlines and fitting outline structures based on a discrete line segment dataset to obtain a plurality of building outline data, including the following steps:
[0056] S301 : When relevant parameters meet preset division conditions, the discrete line segment data are divided into corresponding target linear vector sets.
[0057] Initialize the target vector set to be empty. The target vector set divides the discrete line segment dataset into multiple groups, where any line segment data in each group is collinear with at least one other line segment data in the group. Traverse all discrete line segment sets and add each line segment data to the target vector set. Each time, take a discrete line segment a and compare it with all groups in the target vector set. If a is collinear with a line segment in a group, add it to that group. If a is collinear with a line segment in multiple groups, merge those groups and add a. If a is not collinear with any data in any group, add a to the target vector set as a new group.
[0058] In this embodiment, a preset angle range and a preset distance threshold are first set. A determination is then made as to whether the maximum angle calculated above is within the preset angle range and whether the shortest distance is less than the preset distance threshold. If both conditions are met, the discrete line segment is added to the target linear vector set.
[0059] Continuously select and add qualified discrete line segments to the target linear vector set until the range of the target linear vector set no longer increases. At this point, this stable vector set is added to the result set. At the same time, considering that some corner data may be noise, characterized by inability to extend on both sides, if the target linear vector set only contains one or two data points, these data points are not added to the result set to eliminate noise interference.
[0060] Repeat the entire process for the remaining projection subsets and linear vectors. This loop ensures that all data is processed, resulting in the acquisition of all linear vectors representing building edges. Finally, all starting and ending points of each set of lines are independently placed in the corresponding set of vector data starting and ending points, preparing for subsequent refitting of the lines.
[0061] S302: Perform fitting processing and contour edge reorganization processing based on the target linear vector set to obtain building contour data.
[0062] In this embodiment of the present application, the terminal uses the least squares method to perform fitting processing on each target linear vector set. Based on the set of vector data start and end points of each set of lines in the set, a new straight line is fitted, where the start and end points of this line are the two farthest projection points from the vertices of the set of vector data to the fitted line.
[0063] After completing the fitting, the terminal begins the contour edge reassembly process. It traverses all refitted lines and determines whether the lines are adjacent by determining whether the distance between them is less than a set threshold. When data is found where there are four or more consecutive lines that are adjacent to each other and the first and last lines are adjacent, the terminal determines that these line data can generate the building outline. For cases containing more than five groups of data, due to the possibility of noise, some fitted lines are split into two parts. The terminal further determines the angular relationship between the fitted lines. If the angle between the lines is within 45 degrees (close to parallel), the terminal merges the two sets of linear vectors corresponding to the two lines and refits the lines. This operation is repeated until the number of building data sets reaches four.
[0064] The embodiment of the present application uses the above-mentioned multi-step processing to comprehensively consider the various relationships between linear vectors, and can more accurately extract the contour edges of buildings from discrete line segment data sets, reduce the impact of noise and abnormal data, and improve the accuracy of building contour data.
[0065] In an exemplary embodiment, based on the above embodiment, see Figure 6 The target linear vector set in the embodiment of the present application includes multiple target linear vectors. The embodiment of the present application involves performing contour edge reorganization processing based on the target linear vector set to obtain edge data, including the following steps:
[0066] S401 , using a straight line fitting algorithm to perform fitting processing on multiple target linear vectors in a target linear vector set to obtain multiple fitting line segments.
[0067] The linear fitting algorithm may adopt the least square method, etc. The purpose of the algorithm is to find a straight line that best represents the distribution trend of the target linear vector so that the error between the target linear vector and the fitting straight line is minimized.
[0068] In an embodiment of the present application, after obtaining a set of target linear vectors, the terminal selects the least squares method as the straight line fitting algorithm. For each target linear vector in the set, the terminal regards it as a directed line segment with a start point and an end point and extracts its endpoint coordinates. The terminal then aggregates the endpoint coordinates of all target linear vectors and uses the least squares method to calculate the straight line equation that best fits these points. Based on the straight line equation and the span of these points on the equation, the start point and end point of the fitted line segment are determined, thereby obtaining a fitted line segment. This process is repeated, processing all target linear vectors in the target linear vector set, and ultimately obtaining multiple fitted line segments.
[0069] S402 : Performing contour edge reorganization processing according to the plurality of fitting line segments and a preset distance judgment condition and an adjacent line segment quantity judgment condition to obtain the building contour data.
[0070] In this embodiment of the present application, the terminal obtains a pre-set distance judgment condition and then begins to traverse multiple fitted line segments, calculating the distance between each pair of fitted line segments. If the distance between two fitted line segments is less than a threshold, the terminal determines that the two fitted line segments are adjacent. If the terminal finds four or more consecutive sets of fitted line segment data in which each pair of straight lines is adjacent, the leading and trailing straight lines are also adjacent, and the data is closed, the terminal determines that these line segment data constitute the outline of a building.
[0071] The embodiment of the present application uses a straight-line fitting algorithm and distance-based judgment conditions to accurately screen and combine line segments representing building edges from a complex set of target linear vectors, construct precise edge data, and effectively improve the accuracy of building contour edge extraction.
[0072] In an exemplary embodiment, based on the above embodiment, see Figure 7 The embodiment of the present application relates to a process of performing contour edge reorganization processing based on a plurality of fitting line segments and a pre-set distance judgment condition to obtain the building contour data, comprising the following steps:
[0073] S501: When the distance between two fitted line segments is less than a distance threshold, determine that the two fitted line segments are adjacent line segments.
[0074] In this embodiment of the present application, after obtaining all fitted line segments, the terminal creates an empty adjacent line segment list. For each fitted line segment, the terminal traverses the remaining fitted line segments and calculates the distance between the first and last endpoints of the two fitted line segments, taking the minimum value as the distance metric for the two segments. If the distance is less than a pre-set distance threshold, the terminal adds the two fitted line segments to the adjacent line segment fitted line segment list.
[0075] S502: When there are four or more consecutive adjacent fitting line segments and the first and last data line segments are adjacent to form a closed loop, a plurality of building outline data are obtained according to the adjacent fitting line segments.
[0076] In an embodiment of the present application, the terminal selects an unprocessed pair of adjacent fitted line segments from the list of adjacent fitted line segments as the starting point. Based on this pair of adjacent line segments, it continuously searches for other line segments adjacent to one of the line segments and connects them in sequence. During the connection process, the terminal records the already connected line segments to avoid repeated connections. When there are data of four or more consecutive fitted line segments that are adjacent to each other and the head and tail straight lines are adjacent, the terminal determines that these four fitted line segments will generate the outline of the building. When no new adjacent line segments can be found, it is checked whether the connected line segments form a closed outline. If a closed outline is formed, the terminal calculates the perimeter, area and other data of the outline, and compares it with the outline data threshold. If the outline data threshold requirements are met, this closed outline is saved as a building outline data. Repeat the above steps until all adjacent line segments have been processed.
[0077] This embodiment of the present application uses a distance threshold to accurately determine adjacent line segments, effectively screening out truly spatially adjacent fitted line segments and avoiding incorrect connections, thereby constructing a structure that more closely matches the actual building outline. Combined with the outline data threshold, this further ensures that the generated building outline data conforms to the characteristics of the actual building outline, reducing unreasonable outlines caused by noise or abnormal data.
[0078] In an exemplary embodiment, based on the above embodiment, the method of the embodiment of the present application also includes: when there are more than five groups of fitting line segments in the building outline data, comparing the angles of each two fitting line segments, and when the angles meet the preset angles, merging and re-fitting the target linear vector sets corresponding to the two fitting line segments to replace the original fitting line segments, until the number of fitting line segments in the building outline data is four; wherein the fitting line segments in the four building outline data are the key contour line segment groups of the building polygon.
[0079] In this embodiment of the present application, the terminal first counts the number of identified adjacent line segments. If the building outline data contains more than five sets of data, noise may have caused some fitted lines to be split into two. The terminal then determines the angular relationship between the fitted lines, processes the nearly parallel segments (within 45 degrees), merges the two sets of linear vectors corresponding to the two lines, and refits the line. This operation is repeated until the number of building data sets reaches four. This operation is repeated for all data sets with more than four, ultimately resulting in multiple sets of building outline structure fitting data, each set containing four pairs of adjacent straight lines, with the first and last straight lines adjacent.
[0080] The embodiment of the present application simplifies the redundant fitting line segments into four key contour line segment groups through merging and refitting operations, making the building outline more concise and clear. At the same time, the refitting process can eliminate some errors and noise, improving the accuracy of the building outline.
[0081] In an exemplary embodiment, based on the above embodiment, see Figure 8 The embodiment of the present application relates to a process of performing building shape restoration processing based on each building outline data to obtain target polygonal building data, including the following steps:
[0082] S601 , performing straight line fitting processing on each key contour line segment group to obtain key contour line segment group fitting segments representing direction and length.
[0083] Among them, two fitting line segments in the key contour line segment group are approximately parallel; and the other two fitting line segments are approximately perpendicular to the two approximately parallel fitting line segments.
[0084] In an embodiment of the present application, after the terminal obtains each group of key contour line segments, it uses the least squares method to fit the point cloud projection data corresponding to the line segments in the line segment group. For each fitted line segment, the coordinates of the point cloud data of the intersection area corresponding to the fitted line segment are used as input data, and the parameters of the fitted line, i.e., the slope and intercept, are determined by minimizing the sum of the squares of the perpendicular distances from these points to the fitted line. After the calculation is completed, four fitted lines are obtained, of which two groups of fitted lines have similar slopes, and the two groups of lines can be considered to be approximately parallel; the slopes of the other two groups of fitted lines are approximately perpendicular to the two groups of lines that are approximately parallel, which can be judged by multiplying the slopes by -1. At the same time, based on the coordinates of the endpoints on the fitted line, the length of each line is calculated, thereby obtaining the fitted line segments of the key contour line segment group that characterize the direction and length.
[0085] S602 : Perform contour line segment refitting processing on the two longer fitting line segments in the key contour line segment group that are approximately parallel to the optimized fitting slope to obtain two first fitting boundaries.
[0086] In an embodiment of the present application, the terminal determines the optimized fitting slope and performs angle averaging (5-20 equal divisions can be set according to actual needs) on this set of approximately parallel fitting segments, that is, the angle difference between the two fitting segments is calculated and averaged to obtain multiple potential optimal slopes. For each potential optimal slope, the two optimal intercepts of the two groups of vertex fittings corresponding to the two fitting segments under the slope are calculated, that is, the two intercept values when the sum of the distance error values from the two groups of corresponding vertices to the two fitting segments is minimized under the slope. The potential optimal slopes are traversed to find the slope with the smallest total error and the corresponding two optimal intercepts to obtain the two first fitting boundaries.
[0087] In another embodiment of the present application, during the iterative optimization process, an iterative algorithm (such as gradient descent) can also be used to optimize the initial fitting results. In each iteration, the fitting parameters are adjusted based on the constraints and an error function (such as mean square error), and the value of the error function is gradually reduced until a stopping condition is met (such as the error being less than a threshold or the maximum number of iterations being reached).
[0088] S603 : performing contour line segment refitting processing on the other two fitting line segments in the key contour line segment group perpendicular to the optimized fitting slope to obtain two second fitting boundaries.
[0089] In this embodiment of the present application, the terminal calculates a slope perpendicular to the optimized fitting slope. The least squares method is also used to fit the other two fitting segments in the key contour segment group, with the direction perpendicular to the optimized slope as the target direction. During the fitting process, the points within the segment group are projected onto a line perpendicular to the optimized slope. The projected points are then fitted using the least squares method to obtain two second fitting boundaries.
[0090] S604: Perform polygon construction processing according to the first fitting boundary and the second fitting boundary to obtain target polygon building data.
[0091] In the embodiment of the present application, after obtaining two first fitting boundaries and two second fitting boundaries, the terminal calculates the intersection points between them. The two first fitting boundaries intersect with the two second fitting boundaries in pairs, resulting in four intersection points. The terminal connects these four intersection points in sequence to form a closed quadrilateral, which is the target polygonal building data. The quadrilateral is as follows: Figure 9 shown.
[0092] By determining an optimized fitting slope and performing a refit, the present embodiment can more accurately capture building edge features and reduce the impact of errors in the original contour segments. The determination of the first and second fitting boundaries and the polygon construction process ensure that the resulting target polygon building data more accurately reflects the actual shape of the building, improving the quality of the 3D building model in the GIS map.
[0093] In an exemplary embodiment, based on the above embodiment, see Figure 10 The embodiment of the present application relates to a process of re-fitting two longer fitting segments in a key contour segment group that is approximately parallel to an optimized fitting slope to obtain two first fitting boundaries, including the following steps:
[0094] S701 , performing angle splitting processing on two longer fitting line segments in a key contour line segment group that is approximately parallel to the optimized fitting slope to obtain different slopes.
[0095] In an embodiment of the present application, the terminal determines the optimized fitting slope and performs angle averaging (5-20 equal divisions can be set according to actual needs) on this set of approximately parallel fitting line segments, that is, the angle difference between the two fitting line segments is calculated and evenly divided to obtain multiple potential optimal slopes.
[0096] S702 : For the different slopes, calculate the optimal intercepts of the two fitting line segments and the error between the current slope and the optimized fitting slope, and determine the slope with the minimum error and the corresponding optimal intercept.
[0097] In this embodiment, for each potential optimal slope, the two optimal intercepts for fitting the two groups of vertices corresponding to the two fitted line segments under that slope are calculated. These intercepts are the two intercept values that minimize the sum of the distance errors between the two groups of corresponding vertices and the two fitted line segments under that slope. The potential optimal slopes are then iterated over to find the slope with the smallest sum of errors and the corresponding two optimal intercepts.
[0098] S703 : Determine two first fitting boundaries according to the slope with the minimum error and the corresponding optimal intercept.
[0099] In the embodiment of the present application, after obtaining the error values and the corresponding optimal intercepts for all different slopes, the terminal finds the slope and the corresponding optimal intercept with the minimum error from these results. Based on this set of optimal slopes and intercepts, the terminal determines two first fitting boundaries.
[0100] The embodiment of the present application, through angle splitting and error calculation, can find the slope with the smallest error with the optimized fitting slope among many possible slopes, thereby determining a more accurate optimal intercept, so that the final first fitting boundary is more consistent with the actual building outline, thereby improving the fitting accuracy.
[0101] In an exemplary embodiment, based on the above embodiment, see Figure 11 The boundary data extraction process of the embodiment of the present application includes the following steps:
[0102] S801, performing layered processing on the original point cloud data to obtain high-layer point cloud data and low-layer point cloud data.
[0103] In the embodiment of the present application, the terminal splits the bottom surface and high-level point cloud data. Due to the characteristics of point cloud data acquisition, the bottom surface data of the building is blocked at the bottom surface height and it is impossible to extract valid point cloud data, resulting in the lack of point cloud data inside the building within the bottom surface height range. Generally, the bottom surface data is taken from the overall data within the height range of 3-5 meters below the horizontal level, including some height wall data for subsequent boundary data extraction, such as Figure 12 and 13 As shown, the 2D and 3D point cloud data after data layering, the white one is the high-level point cloud.
[0104] S802 , performing plane projection processing on the high-level point cloud data and the low-level point cloud data respectively to obtain projected high-level point cloud data and projected low-level point cloud data.
[0105] In this embodiment of the present application, for the obtained high-level point cloud data, the terminal selects a horizontal plane as the projection plane. For each point in the high-level point cloud data, the terminal converts its three-dimensional coordinates (x, y, z) into two-dimensional coordinates (x, y), ignoring the z coordinate value. This completes the planar projection processing of the high-level point cloud data, obtaining the projected high-level point cloud data. The same method is used to process the low-level point cloud data, converting its three-dimensional coordinates into two-dimensional coordinates to obtain the projected low-level point cloud data.
[0106] S803 , performing vertex traversal processing on the projected high-level point cloud data and the projected point cloud data respectively to obtain high-level and low-level vertex data.
[0107] Among them, the high- and low-level vertex data include the proportion of high-level vertices, the proportion of bottom-level vertices, and the total number of high- and low-level vertices.
[0108] In this embodiment of the present application, the terminal first performs a vertex traversal on the projected high-level point cloud data. With each vertex as the center, a horizontal distance threshold is set, for example, 0.5 meters. The number of high-level point cloud data vertices and the total number of vertices within this range (including vertices after the projection of high-level and low-level point cloud data) are counted, and the proportion of high-level vertices is calculated. Similarly, the projected low-level point cloud data is traversed, and the proportion of bottom-level vertices and the total number of high- and low-level vertices within a certain range of each vertex are counted. These statistical data are then integrated into high- and low-level vertex data.
[0109] S804: performing vertex determination processing according to the boundary judgment condition and the high- and low-level vertex data to obtain the boundary vertex.
[0110] Among them, the intersection judgment conditions include the vertex horizontal distance threshold, the high-level vertex ratio threshold, the high-level vertex number range, and the low-level vertex number range.
[0111] In the embodiment of the present application, the terminal projects the data onto the same horizontal plane, such as Figure 14 As shown, for each vertex, we traverse the high and low layer data, check the data within a certain horizontal distance, and compare the proportion of high and low layer data within a certain distance around it. If the high layer density is between 20% and 90% and the number of high and low layer vertices is at least 3-8, then the vertex is considered to be a junction vertex.
[0112] The embodiment of the present application can accurately determine the vertices at the intersection of the boundaries of different height parts of a building by layering, projecting, traversing and judging the original point cloud data, providing key basic data for subsequent building contour structure fitting and shape restoration based on these vertices, thereby improving the accuracy of building model construction.
[0113] It should be understood that, although the steps in the flowcharts of the above embodiments are shown in sequence as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the flowcharts of the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily to be performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of steps or stages in other steps.
[0114] Based on the same inventive concept, the present application also provides an apparatus for generating buildings from urban point cloud data, for implementing the aforementioned method for generating buildings from urban point cloud data. The solution provided by this apparatus is similar to the solution described in the aforementioned method. Therefore, the specific limitations of one or more embodiments of the apparatus for generating buildings from urban point cloud data provided below can be found in the aforementioned definition of the method for generating buildings from urban point cloud data, and will not be further elaborated here.
[0115] In one embodiment, Figure 15 As shown, a town point cloud data building generation device 900 is provided, comprising:
[0116] The local direction construction module 901 is used to perform multiple local direction construction processes based on the pre-acquired original point cloud data to obtain a discrete line segment dataset; each discrete line segment in the discrete line segment dataset is used to represent the data direction characteristics of the local area;
[0117] The outline data determination module 902 is used to perform polygon outline extraction and outline structure fitting processing based on the discrete line segment data set to obtain a plurality of building outline data; each building outline data is used to represent the outline structure of each building;
[0118] The building restoration module 903 is used to restore the building shape according to the building outline data to obtain target polygonal building data; the target polygonal building data is used to construct a three-dimensional building model in the geographic information system map.
[0119] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 16 As shown. The computer device includes a processor, memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, memory, and input / output interface are connected via a system bus, and the communication interface, display unit, and input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and external devices. The communication interface of the computer device is used to communicate with external terminals via wired or wireless means, and the wireless means can be achieved via Wi-Fi, mobile cellular networks, NFC (near-field communication), or other technologies. When executed by the processor, the computer program implements a method for building urban point cloud data. The display unit of the computer device is used to produce a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device casing, or an external keyboard, touchpad or mouse.
[0120] Those skilled in the art will understand that Figure 16 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0121] In one embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory including instructions. The instructions are executable by a processor of an electronic device to perform the above method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, or optical data storage device.
[0122] In one embodiment, a computer program product is also provided. When executed by a processor, the computer program can implement the above method. The computer program product includes one or more computer instructions. When these computer instructions are loaded and executed on a computer, part or all of the above method can be implemented in whole or in part according to the process or function of the embodiment of the present application.
[0123] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions.
[0124] Those skilled in the art will appreciate that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. In particular, any reference to memory, database, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The databases involved in the various embodiments provided herein may include at least one of a relational database and a non-relational database. Non-relational databases may include, but are not limited to, distributed databases based on blockchains. The processors involved in the various embodiments provided herein may be, but are not limited to, general-purpose processors, central processing units (CPUs), graphics processing units (GPUs), digital signal processors (DSPs), programmable logic devices (PLDs), data processing logic devices based on quantum computing, and the like.
[0125] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0126] The above embodiments merely illustrate several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art may make various modifications and improvements without departing from the spirit of the present invention, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.
Claims
1. A method for generating buildings from urban point cloud data, characterized in that: The method comprises: Based on the pre-acquired original point cloud data, multiple local direction construction processes are performed to obtain a discrete line segment dataset; each discrete line segment in the discrete line segment dataset is used to characterize the data direction characteristics of the local area; Performing polygonal contour extraction and contour structure fitting processing on the discrete line segment data set to obtain a plurality of building contour data; each of the building contour data is used to characterize the contour structure of each building; Building shape restoration processing is performed on each of the building outline data to obtain target polygonal building data; the target polygonal building data is used to construct a three-dimensional building model in a geographic information system map.
2. The method according to claim 1, characterized in that The process of performing multiple local direction construction processes based on the pre-acquired original point cloud data to obtain a discrete line segment dataset includes: Performing coordinate dimension conversion and boundary data extraction processing on the original point cloud data to obtain target dimension data; Performing multiple sampling and selection processing on the target dimension data according to a preset range to obtain multiple local point cloud data; Multiple straight line fitting and multiple direction vector generation processes are performed on the plurality of local point cloud data to obtain the discrete line segment data set.
3. The method according to claim 1, characterized in that The polygon outline extraction and outline structure fitting processing are performed based on the discrete line segment data set to obtain a plurality of building outline data, including: When the relevant parameters meet the preset division conditions, the discrete line segment data is divided into the corresponding target linear vector set; Fitting processing and contour edge reorganization processing are performed based on the target linear vector set to obtain the building contour data.
4. The method according to claim 3, characterized in that The target linear vector set includes a plurality of target linear vectors; and the fitting process and the contour edge reorganization process based on the target linear vector set to obtain the building contour data include: Using a straight line fitting algorithm to perform fitting processing on a plurality of target linear vectors in the target linear vector set to obtain a plurality of fitting line segments; The building outline data is obtained by performing contour edge reorganization processing based on the plurality of fitting line segments and the pre-set distance judgment condition and the adjacent line segment quantity judgment condition.
5. The method according to claim 4, characterized in that The step of performing contour edge reorganization processing based on the plurality of fitting line segments and a preset distance judgment condition to obtain the building contour data includes: When the distance between the two fitted line segments is less than a distance threshold, determining that the two fitted line segments are adjacent line segments; In the case where there are four or more consecutive adjacent fitting line segments and the first and last data line segments are adjacent to form a closed loop, a plurality of building outline data are obtained according to each of the adjacent line segments.
6. The method according to claim 5, characterized in that The method further comprises: When there are more than five groups of fitting line segments in the building outline data, the angles of every two fitting line segments are compared, and when the angles meet the preset angles, the target linear vector sets corresponding to the two fitting line segments are merged and refitted to replace the original fitting line segments, until the number of fitting line segments in the building outline data is four; wherein the four fitting line segments in the building outline data are the key outline segment groups of the building polygon.
7. The method according to claim 6, characterized in that The process of performing building shape restoration processing according to each of the building outline data to obtain target polygonal building data includes: Perform straight line fitting processing on each key contour segment group to obtain key contour segment group fitting segments representing direction and length; wherein two fitting segments in the key contour segment group are approximately parallel; and the other two fitting segments are approximately perpendicular to the two approximately parallel fitting segments; Performing contour line segment refitting processing on two longer fitting line segments in the key contour line segment group that are approximately parallel to the optimized fitting slope to obtain two first fitting boundaries; Performing contour line segment refitting processing on the other two fitting line segments in the key contour line segment group perpendicular to the optimized fitting slope to obtain two second fitting boundaries; Polygon construction processing is performed according to the first fitting boundary and the second fitting boundary to obtain the target polygon building data.
8. The method according to claim 7, characterized in that The step of performing contour segment refitting on the two longer fitting segments in the key contour segment group approximately parallel to the optimized fitting slope to obtain two first fitting boundaries includes: Perform angle splitting on the two longer fitting line segments in the key contour line segment group that are approximately parallel to the optimized fitting slope to obtain different slopes; For the different slopes, calculating the optimal intercepts of the two fitting line segments and the error value between the current slope and the optimized fitting slope, and determining the slope with the minimum error and the corresponding optimal intercept; The two first fitting boundaries are determined according to the slope with the minimum error and the corresponding optimal intercept.
9. The method according to claim 2, characterized in that The boundary data extraction process includes: Performing layered processing on the original point cloud data to obtain high-layer point cloud data and low-layer point cloud data; Performing plane projection processing on the high-level point cloud data and the low-level point cloud data respectively to obtain projected high-level point cloud data and projected low-level point cloud data; Performing vertex traversal processing on the projected high-level point cloud data and the projected point cloud data respectively to obtain high-level and low-level vertex data; the high-level and low-level vertex data includes a high-level vertex ratio, a bottom-level vertex ratio, and a total number of high-level and low-level vertices; Vertex determination processing is performed according to the junction judgment conditions and high and low layer vertex data to obtain the junction vertex; the junction judgment conditions include vertex horizontal distance threshold, high layer vertex ratio threshold, high layer vertex number range and low layer vertex number range.
10. A device for generating urban point cloud data buildings, characterized in that: The device comprises: A local direction construction module is used to perform multiple local direction construction processes based on the pre-acquired original point cloud data to obtain a discrete line segment dataset; each discrete line segment in the discrete line segment dataset is used to characterize the data direction characteristics of the local area; A contour data determination module is used to perform polygon contour extraction and contour structure fitting processing based on the discrete line segment data set to obtain a plurality of building contour data; each of the building contour data is used to characterize the contour structure of each building; The building restoration module is used to restore the building shape according to the building outline data to obtain target polygonal building data; the target polygonal building data is used to construct a three-dimensional building model in a geographic information system map.