Building feature line extraction method based on 3D point cloud
Through the building feature line extraction method based on three-dimensional point clouds, combined with the improved RANSAC algorithm and adaptive alpha shape algorithm and other technical means, the problems of low efficiency and insufficient accuracy of building feature line extraction in the existing technology are solved, and efficient and accurate feature line extraction is achieved, which is suitable for high-precision three-dimensional modeling requirements.
Patent Information
- Application Number
- CN202410821067.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-06-24
AI Technical Summary
The prior art has problems such as low efficiency, poor noise robustness and insufficient accuracy in building feature line extraction, which is difficult to meet the requirements of high-precision three-dimensional modeling.
The building feature line extraction method based on three-dimensional point clouds is adopted, including point cloud data acquisition, preprocessing, elevation detection, outlier point removal, point cloud projection, boundary extraction, clustering, straight line segment extraction, intersection calculation and accuracy verification. The extraction efficiency and accuracy are improved through the improved RANSAC algorithm, adaptive alpha shape algorithm, density peak clustering algorithm and gradient descent algorithm.
It realizes efficient and accurate building feature lines extraction, significantly improves extraction efficiency and accuracy, and is suitable for high-precision three-dimensional modeling requirements in smart city construction, and smooths the feature lines through curve fitting algorithm to ensure the smoothness and accuracy of the feature lines.
Smart Images

Figure CN118608552B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of building feature analysis, and in particular to a method for extracting building feature lines based on three-dimensional point clouds. Background Art
[0002] With the continuous advancement of smart city construction, digital twin technology has become one of its core technical means. Digital twin cities aim to accurately model and simulate real cities through digital means, thereby improving urban management and operational efficiency. In this process, as an important part of the city, the reconstruction of the three-dimensional model and the extraction of feature lines of buildings have always been a hot and difficult issue in research. High-precision building feature line extraction is crucial for the construction of a city information model (CIM). It can not only improve the accuracy of urban planning and design, but also play an important role in building maintenance, disaster response, etc.
[0003] In the field of building feature line extraction, the existing technologies mainly use methods such as Hough transform algorithm, region growing method and deep learning method. However, these methods have some limitations. For example, the Hough transform algorithm is inefficient when processing large-scale point cloud data, the region growing method is sensitive to the selection of initial points and is easily affected by noise, and although the deep learning method performs well in specific scenarios, it has large training data requirements and high computing resource requirements. In addition, these methods generally have poor robustness to noisy data and insufficient accuracy, making it difficult to meet the requirements of high-precision 3D modeling.
[0004] In view of the above problems, it is particularly important to propose a building feature line extraction method based on three-dimensional point cloud. Summary of the invention
[0005] Based on the above purpose, the present invention provides a method for extracting building feature lines based on three-dimensional point clouds.
[0006] The method for extracting building feature lines based on three-dimensional point clouds includes the following steps:
[0007] S1, point cloud data acquisition: use a 3D laser scanner to obtain point cloud data of the building;
[0008] S2, point cloud preprocessing: preprocessing the collected point cloud data, including deleting isolated points and noise points;
[0009] S3, building facade detection: using the improved RANSAC algorithm to detect the building facade and determine the fitting plane;
[0010] S4, outlier removal: remove outliers from the facade point cloud based on multi-scale statistical analysis method;
[0011] S5, point cloud projection: project the denoised point cloud data onto the fitting plane to ensure the accuracy of feature line extraction;
[0012] S6, boundary extraction: use the adaptive alpha shape algorithm to extract the boundary of the facade point cloud;
[0013] S7, boundary clustering: the density peak clustering algorithm is used to separate the boundary point cloud into multiple clusters;
[0014] S8, straight line segment extraction: use the improved RANSAC algorithm to extract the straight line segments of the boundary point cloud from each cluster;
[0015] S9, intersection calculation: by extending adjacent straight line segments to obtain their intersection points, the overall characteristic line of the building facade is obtained;
[0016] S10, precision check: perform precision check on the extracted feature lines.
[0017] Furthermore, the S3 specifically includes:
[0018] S31, initial parameter setting: setting the initial parameters of the RANSAC algorithm, including the number of iterations N, the inlier threshold d and the fitting accuracy ∈;
[0019] S32, dynamic sampling strategy: dynamically adjust the number of sample points under different sampling scales to improve the adaptability of the algorithm to building facades of different scales;
[0020] S33, preliminary elevation detection: In each iteration, s points are randomly selected as sample point sets to calculate candidate plane parameters;
[0021] S34, interior point evaluation: Using the parameters of the candidate plane, calculate the distance from all points to the plane, defined as: Among them, d i is the distance from point i to the plane, (x i ,y i ,z i ) are the coordinates of the point, (a, b, c, d) are the parameters of the plane;
[0022] S35, interior point selection: If d i ≤∈, then point i is an interior point, count the number of interior points, and select the candidate plane with the largest number of interior points;
[0023] S36, plane fitting optimization: Use the least squares method to fit the selected internal point set to optimize the plane parameters so that they meet the following formula:
[0024] Among them, (x i ,y i ,z i) are the coordinates of the interior points, and n is the number of interior points;
[0025] S37, adaptive adjustment: After each iteration, the number of sampling points and the number of iterations are adjusted according to the ratio of the inner points. The formula is: N = log(1-p) / log(1-(1-∈) s ), where p is the expected confidence, ∈ is the proportion of internal points, and s is the number of sampling points.
[0026] Furthermore, the S4 specifically includes:
[0027] S41, Neighborhood definition: Define a neighborhood for each point in the point cloud dataset in It is point p i The center is r and the radius is k The set of all points in the sphere of , where k is the multi-scale parameter;
[0028] S42, distance calculation: For each point p i , calculate the distance d to all points in the neighborhood ij :d ij =‖p i -p j ‖, where ‖·‖ represents the Euclidean distance,
[0029] S43, multi-scale average distance: Calculate the average distance of each point at different scales, expressed as:
[0030] in, is the number of points in the neighborhood, k represents the kth scale;
[0031] S44, outlier detection: The multi-scale average distance of all points follows a Gaussian distribution, and the global average distance μ is calculated. k and standard deviation σ k ;
[0032] S45, outlier identification: Identify points in the point cloud dataset whose multi-scale average distance exceeds the threshold as outliers, that is, threshold = μ k +t·σ k , where t is the set standard deviation multiple;
[0033] S46, outlier removal: delete all points identified as outliers to obtain a point cloud data set after the outliers are removed.
[0034] Furthermore, the S5 specifically includes:
[0035] S51, determining the fitting plane parameters: obtaining the parameter equation of the fitting plane by the RANSAC algorithm, which is in the form of: a·x+b·y+c·z+d=0, where a, b, c and d are the parameters of the fitting plane;
[0036] S52, point cloud plane distance calculation: For each point P(x s ,y s ,z s ), calculate its vertical distance d to the fitting plane Pi , the calculation method is the same as the above calculation of the distance from all points to the plane:
[0037] S53, projection point calculation: For each point P(x s ,y s ,z s ) is projected onto the fitting plane to obtain the projection point P′(x s ′,y s ′,z s ′), the calculation is expressed as:
[0038]
[0039] x s ′=x s -a·t;
[0040] y s ′=y s -b·t;
[0041] z s ′=z s -c·t;
[0042] S54, Projection point cloud integration: All points P(x s ,y s ,z s )'s projection point P'(x s ′,y s ′,z s ′) to form a projected point cloud dataset, and perform accuracy verification on the projected point cloud dataset to ensure that the error in the projection process is within a preset range to ensure the accuracy of feature line extraction.
[0043] Furthermore, the boundary extraction in S6 specifically includes:
[0044] S61, setting initial parameters of the alphashape algorithm, including an initial radius α0;
[0045] S62, Neighborhood definition: Define a neighborhood for each point in the point cloud dataset in, It is point p i The set of all points in a sphere with a center and a radius of α0;
[0046] S63, neighborhood density calculation: Calculate the density of points in the neighborhood of each point:
[0047] in, is the number of points in the neighborhood;
[0048] S64, adaptive radius adjustment: adjust the alpha radius α of each point according to the density of the point cloud data i , the formula is: Among them, max is the maximum density in the point cloud dataset;
[0049] S65, using adaptively adjusted radius α i Construct alphashape and set the radius α i The ball rolls on the point cloud dataset to form a boundary;
[0050] S66, boundary extraction: record the boundary points formed by rolling the alphashape and extract the boundary of the facade point cloud.
[0051] Furthermore, after the boundary extraction, the method further includes boundary optimization, wherein the boundary optimization optimizes the extracted boundary through a gradient descent algorithm to improve the boundary accuracy.
[0052] Furthermore, the boundary clustering in S7 specifically includes:
[0053] S71, calculate the Euclidean distances between all points in the boundary point cloud to form a distance matrix D = {d ij}, where d ij Indicates point P i and point P j The distance between
[0054] S72, density calculation: for each point P i Calculate its local density ρ i , the local density is defined as point P i The number of points within the distance threshold δ is expressed as:
[0055] S73, distance peak calculation: calculate each point P i The minimum distance δ to a point with higher local density i , expressed as: For the point with the highest local density, set δ i =max j (d ij );
[0056] S74, selecting the point with the highest local density ρ and distance peak δ as the cluster center;
[0057] S75, assign other points to the cluster where the nearest cluster center is located. Each point is assigned according to its distance and density from the cluster center. The formula is:
[0058] Cluster(P i ) = argmin C (d iC ), where C represents the cluster center, d iC For point P i The distance to the cluster center;
[0059] S76, cluster optimization: optimize the initially allocated clusters, adjust the affiliation of the points, maximize the density of each cluster, and output the finally allocated clusters as multiple clusters of the boundary point cloud.
[0060] Furthermore, the S8 specifically includes:
[0061] S81, process the boundary point cloud of each cluster separately, and divide the point cloud data set into multiple clusters {C T}, where T represents the number of the cluster;
[0062] S82, sample point selection: In each cluster, randomly select s points as the sample point set and calculate the candidate line parameters;
[0063] S83, candidate straight line fitting: according to the sample point set, the candidate straight line is fitted using the least square method, and the parameter equation of the candidate straight line is calculated, which is expressed as: y=mx+b, where m is the slope of the straight line and b is the intercept of the straight line;
[0064] S84, interior point evaluation: Using the parameters of the candidate line, calculate the perpendicular distance d from each point to the line line , the formula is: If d line (P i )≤∈, then point P i is the inlier point, count the number of inliers;
[0065] S85, interior point selection: select the candidate straight line with the largest number of interior points as the best straight line of the current cluster;
[0066] S86, Line Fitting Optimization: Use the least squares method to fit the selected internal point set to optimize the line parameters. The formula is:
[0067] Among them, (x i ,y i) are the coordinates of the interior points, and n is the number of interior points;
[0068] S87, straight line segment extraction: extract the optimized straight line segment, extend the adjacent straight line segments to their intersection points, and form a complete boundary straight line segment;
[0069] S88, adaptive adjustment: After each iteration, the number of sampling points and the number of iterations are adjusted according to the ratio of inliers. The formula is:
[0070] N = log(1-p) / log(1-(1-∈) s ), where p is the expected confidence, ∈ is the proportion of internal points, and s is the number of sampling points;
[0071] S89, verify the accuracy of the extracted straight line segment to ensure that it meets the requirements of building boundary detection, and adjust the RANSAC parameters for iterative optimization as needed.
[0072] Furthermore, the S9 specifically includes:
[0073] S91, straight line segment fitting: Use the improved RANSAC algorithm to fit several straight line segments for the boundary point cloud data in each cluster, denoted as L i , where L i The parametric equation is:
[0074] y=m i x+b i , where m i is the slope of the ith straight line segment, b i is the intercept of the i-th straight line segment;
[0075] S92, each fitted straight line segment L i The extended straight line segment is recorded as L i ′;
[0076] S93, calculate the adjacent extended straight line segment L i ′ and L i+1 ′, the intersection coordinates (x ij ,y ij ), by solving the following system of equations: m i x ij +b i =m i+1 x ij +b i+1 , and we get:
[0077]
[0078] y ij =m i x ij +b i;
[0079] S94, intersection filtering: filtering all calculated intersections to remove abnormal intersections that do not conform to the building outline;
[0080] S95, feature line construction: connect the filtered intersection points in sequence to construct the overall feature line of the building facade;
[0081] S96, optimize the constructed feature line to ensure its smoothness and accuracy, and use the curve fitting algorithm to smooth the feature line. The smoothing process is as follows:
[0082] Initialize the intersection point set: All the intersection points (x ij ,y ij ) are arranged in order to form an intersection set;
[0083] Select the curve fitting method: Select a curve fitting algorithm that is suitable for the building contour, such as B-spline curve fitting or polynomial fitting;
[0084] Curve fitting parameter setting: according to the selected fitting method, set relevant parameters, such as the number of nodes of the B-spline curve or the order of the polynomial;
[0085] Construct a fitting curve model: construct a fitting curve model using the selected curve fitting method;
[0086] Calculate the fitting curve: Calculate the parameters of the curve fitting model according to the intersection point set to obtain the fitting curve;
[0087] Curve smoothing: Smooth the fitted curve to remove noise and sharp turning points on the curve;
[0088] Verify the fit between the smooth curve after fitting and the actual building outline, and adjust the fitting parameters as needed to ensure the accuracy and smoothness of the characteristic line.
[0089] Furthermore, the S10 specifically includes:
[0090] Compare the extracted feature lines with the original point cloud data, and calculate the distance from each feature line point to its corresponding original point cloud point;
[0091] Calculate error indicators: Calculate the error indicators between feature lines and original point cloud data, including average error, root mean square error and maximum error;
[0092] Error analysis: Analyze the calculated error indicators to determine whether the accuracy of the characteristic line meets the requirements.
[0093] Beneficial effects of the present invention:
[0094] The present invention combines the improved RANSAC algorithm, the adaptive alpha shape algorithm, the density peak clustering algorithm and the gradient descent algorithm to propose an efficient and accurate method for extracting building feature lines. Through multi-scale sampling, dynamic parameter adjustment and multi-stage optimization, the adaptability and accuracy of the algorithm to building facades of different sizes are improved. In particular, the adaptive alpha shape algorithm and the density peak clustering algorithm are used to effectively deal with the noise and outliers in the point cloud data, ensuring the integrity and accuracy of the feature line extraction. This method can quickly and accurately extract the contour feature lines of the building from the three-dimensional point cloud data, significantly improving the extraction efficiency and accuracy, and is suitable for the high-precision three-dimensional modeling requirements in the construction of smart cities.
[0095] After the feature line extraction is completed, the present invention uses a curve fitting algorithm to smooth the feature line, ensuring the smoothness and accuracy of the feature line, removing the noise and sharp turning points on the curve, and ensuring the continuity and smoothness of the feature line. This method significantly improves the quality of the feature line, making the extracted feature line more consistent with the outline of the actual building, improving the accuracy and aesthetics of the three-dimensional model, and providing a solid foundation for high-precision building modeling.
[0096] The present invention ensures that the extracted feature lines have high accuracy and reliability through detailed precision verification steps. By comparing the feature lines with the original point cloud data, the error indicators (including average error, root mean square error and maximum error) are calculated, and combined with manual verification and error distribution diagrams, the accuracy and error distribution of the feature lines are comprehensively evaluated. BRIEF DESCRIPTION OF THE DRAWINGS
[0097] In order to more clearly illustrate the technical solutions in the present invention or 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 in the following description are only for the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0098] Figure 1 Schematic diagram of the extraction method according to an embodiment of the present invention. DETAILED DESCRIPTION
[0099] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with specific embodiments.
[0100] like Figure 1 As shown, the building feature line extraction method based on three-dimensional point cloud includes the following steps:
[0101] S1, point cloud data acquisition: Use a 3D laser scanner to obtain point cloud data of the building, including:
[0102] Choose a 3D laser scanner with high precision and high resolution to ensure that the collected point cloud data has sufficient details and accuracy;
[0103] According to the height, area and structural characteristics of the building, set the scanning parameters of the scanner, including scanning resolution, scanning range and scanning angle;
[0104] Select multiple scanning locations to ensure coverage of the entire building facade and minimize occlusions and blind spots;
[0105] At each scanning position, scan according to the set scanning parameters to obtain point cloud data of the building;
[0106] Integrate and calibrate the point cloud data obtained from multiple scanning positions, store the integrated and calibrated point cloud data in a storage device, and back it up to prevent data loss;
[0107] S2, point cloud preprocessing: preprocess the collected point cloud data, including deleting isolated points and noise points, specifically including:
[0108] Use open source point cloud processing software to perform preliminary processing on the collected point cloud data;
[0109] Crop out relatively complete part of the point cloud data;
[0110] Delete isolated points and noise points to ensure the integrity and purity of point cloud data;
[0111] S3, building facade detection: using the improved RANSAC algorithm to detect the building facade and determine the fitting plane;
[0112] S4, outlier removal: remove outliers from the facade point cloud based on multi-scale statistical analysis method;
[0113] S5, point cloud projection: project the denoised point cloud data onto the fitting plane to ensure the accuracy of feature line extraction;
[0114] S6, boundary extraction: use the adaptive alpha shape algorithm to extract the boundary of the facade point cloud;
[0115] S7, boundary clustering: the density peak clustering algorithm is used to separate the boundary point cloud into multiple clusters;
[0116] S8, straight line segment extraction: use the improved RANSAC algorithm to extract the straight line segments of the boundary point cloud from each cluster;
[0117] S9, intersection calculation: by extending adjacent straight line segments to obtain their intersection points, the overall characteristic line of the building facade is obtained;
[0118] S10, precision check: perform precision check on the extracted feature lines.
[0119] S3 specifically includes:
[0120] S31, initial parameter setting: setting the initial parameters of the RANSAC algorithm, including the number of iterations N, the inlier threshold d and the fitting accuracy ∈;
[0121] S32, dynamic sampling strategy: dynamically adjust the number of sample points under different sampling scales to improve the adaptability of the algorithm to building facades of different scales;
[0122] S33, preliminary elevation detection: In each iteration, s points are randomly selected as sample point sets to calculate candidate plane parameters;
[0123] S34, interior point evaluation: Using the parameters of the candidate plane, calculate the distance from all points to the plane, defined as: Among them, d i is the distance from point i to the plane, (x i ,y i ,z i ) are the coordinates of the point, (a, b, c, d) are the parameters of the plane;
[0124] S35, interior point selection: If d i ≤∈, then point i is an interior point, count the number of interior points, and select the candidate plane with the largest number of interior points;
[0125] S36, plane fitting optimization: Use the least squares method to fit the selected internal point set to optimize the plane parameters so that they meet the following formula:
[0126] Among them, (x i ,y i ,z i ) are the coordinates of the interior points, and n is the number of interior points;
[0127] S37, adaptive adjustment: After each iteration, the number of sampling points and the number of iterations are adjusted according to the ratio of the inner points. The formula is: N = log(1-p) / log(1-(1-∈) s ), where p is the expected confidence, ∈ is the ratio of internal points, and s is the number of sampling points. The accuracy of the fitted plane is verified to ensure that it meets the requirements of building facade detection, and the RANSAC parameters are adjusted for iterative optimization as needed.
[0128] S4 specifically includes:
[0129] S41, Neighborhood definition: Define a neighborhood for each point in the point cloud dataset in It is point p i The center is r and the radius is k The set of all points in the sphere of , where k is the multi-scale parameter;
[0130] S42, distance calculation: For each point p i , calculate the distance d to all points in the neighborhood ij :d ij =‖p i -p j ‖, where ‖·‖ represents the Euclidean distance,
[0131] S43, multi-scale average distance: Calculate the average distance of each point at different scales, expressed as:
[0132] in, is the number of points in the neighborhood, k represents the kth scale;
[0133] S44, outlier detection: The multi-scale average distance of all points follows a Gaussian distribution, and the global average distance μ is calculated. k and standard deviation σ k , expressed as:
[0134] Where n is the total number of points in the point cloud dataset;
[0135] S45, outlier identification: Identify points in the point cloud dataset whose multi-scale average distance exceeds the threshold as outliers, that is, threshold = μ k +t·σ k , where t is the set standard deviation multiple;
[0136] S46, outlier removal: delete all points identified as outliers to obtain a point cloud data set after the outliers are removed.
[0137] The outliers in the point cloud data are effectively removed by multi-scale statistical analysis. The multi-scale neighborhood definition and distance calculation ensure the comprehensiveness and accuracy of outlier detection. By calculating the multi-scale average distance and assuming that it obeys Gaussian distribution, outliers can be accurately identified. Setting a reasonable threshold ensures the effectiveness of outlier removal. This method can effectively improve the purity and integrity of point cloud data and provide a high-quality data foundation for subsequent feature line extraction.
[0138] S5 specifically includes:
[0139] S51, determining the fitting plane parameters: obtaining the parameter equation of the fitting plane by the RANSAC algorithm, which is in the form of: a·x+b·y+c·z+d=0, where a, b, c and d are the parameters of the fitting plane;
[0140] S52, point cloud plane distance calculation: For each point P(x s ,y s ,z s ), calculate its vertical distance d to the fitting plane Pi , the calculation method is the same as the above calculation of the distance from all points to the plane:
[0141] S53, projection point calculation: For each point P(x s ,y s ,z s ) is projected onto the fitting plane to obtain the projection point P′(x s ′,y s ′,z s ′), the calculation is expressed as:
[0142]
[0143] x s ′=x s -a·t;
[0144] y s ′=y s -b·t;
[0145] z s ′=z s -c·t;
[0146] S54, Projection point cloud integration: All points P(x s ,y s ,z s )'s projection point P'(x s ′,y s ′,z s ′) to form a projected point cloud dataset, and perform accuracy verification on the projected point cloud dataset to ensure that the error in the projection process is within a preset range to ensure the accuracy of feature line extraction.
[0147] Boundary extraction in S6 specifically includes:
[0148] S61, setting initial parameters of the alphashape algorithm, including an initial radius α0;
[0149] S62, Neighborhood definition: Define a neighborhood for each point in the point cloud dataset in, It is point p i The set of all points in a sphere with a center and a radius of α0;
[0150] S63, neighborhood density calculation: Calculate the density of points in the neighborhood of each point:
[0151] in, is the number of points in the neighborhood;
[0152] S64, adaptive radius adjustment: adjust the alpha radius α of each point according to the density of the point cloud data i , the formula is: Among them, max is the maximum density in the point cloud dataset;
[0153] S65, using adaptively adjusted radius α i Construct alphashape and set the radius α i The ball rolls on the point cloud dataset to form a boundary;
[0154] S66, boundary extraction: record the boundary points formed by rolling the alphashape and extract the boundary of the facade point cloud.
[0155] After boundary extraction, boundary optimization is also included. Boundary optimization optimizes the extracted boundary through the gradient descent algorithm to improve boundary accuracy. Specifically, it includes:
[0156] Initial set of boundary points: Initialize the boundary point set {P i}, where P i =(x i ,y i ,z i );
[0157] Energy function definition: Define the energy function E of the boundary point set, which is used to measure the smoothness and accuracy of the boundary point set. The formula is: in, It's point P i The neighborhood point set of , λ is the regularization parameter, is the initial boundary point;
[0158] Calculate the gradient: Calculate the energy function E relative to the boundary point set {P i The gradient of The formula is:
[0159]
[0160] Gradient descent iteration: Use gradient descent to update the boundary point set {P i}, the formula is:
[0161] in, is the boundary point position at the tth iteration, η is the learning rate;
[0162] Convergence judgment: Determine whether the change of the energy function E is less than the preset threshold ∈, if so, stop the iteration, otherwise return to the step to continue the iteration;
[0163] The final converged boundary point set {P i} as the optimized boundary output.
[0164] The boundary clustering in S7 specifically includes:
[0165] S71, calculate the Euclidean distances between all points in the boundary point cloud to form a distance matrix D = {d ij}, where d ij Indicates point P i and point P j The distance between
[0166] S72, density calculation: for each point P i Calculate its local density ρ i , the local density is defined as point P i The number of points within the distance threshold δ is expressed as:
[0167] S73, distance peak calculation: calculate each point P i The minimum distance δ to a point with higher local density i , expressed as: For the point with the highest local density, set δ i =max j (d ij );
[0168] S74, select the points with the highest local density ρ and distance peak δ as cluster centers. These points are usually in high-density areas and far away from other high-density points;
[0169] S75, assign other points to the cluster where the nearest cluster center is located. Each point is assigned according to its distance and density from the cluster center. The formula is:
[0170] Cluster(P i ) = argmin C (d iC ), where C represents the cluster center, d iC For point P i The distance to the cluster center;
[0171] S76, cluster optimization: optimize the initially allocated clusters, adjust the affiliation of the points, maximize the density of each cluster, and output the finally allocated clusters as multiple clusters of the boundary point cloud.
[0172] S8 specifically includes:
[0173] S81, set the initial parameters of the RANSAC algorithm, including the number of iterations N, the internal point threshold d and the fitting accuracy ∈, process the boundary point cloud of each cluster separately, and divide the point cloud data set into multiple clusters {C T}, where T represents the number of the cluster;
[0174] S82, sample point selection: In each cluster, randomly select s points as the sample point set and calculate the candidate line parameters;
[0175] S83, candidate straight line fitting: according to the sample point set, the candidate straight line is fitted using the least square method, and the parameter equation of the candidate straight line is calculated, which is expressed as: y=mx+b, where m is the slope of the straight line and b is the intercept of the straight line;
[0176] S84, interior point evaluation: Using the parameters of the candidate line, calculate the perpendicular distance d from each point to the line line , the formula is: If d line (P i )≤∈, then point P i is the inlier point, count the number of inliers;
[0177] S85, interior point selection: select the candidate straight line with the largest number of interior points as the best straight line of the current cluster;
[0178] S86, Line Fitting Optimization: Use the least squares method to fit the selected internal point set to optimize the line parameters. The formula is:
[0179] Among them, (x i ,y i ) are the coordinates of the interior points, and n is the number of interior points;
[0180] S87, straight line segment extraction: extract the optimized straight line segment, extend the adjacent straight line segments to their intersection points, and form a complete boundary straight line segment;
[0181] S88, adaptive adjustment: After each iteration, the number of sampling points and the number of iterations are adjusted according to the ratio of inliers. The formula is:
[0182] N = log(1-p) / log(1-(1-∈) s ), where p is the expected confidence, ∈ is the proportion of internal points, and s is the number of sampling points;
[0183] S89, verify the accuracy of the extracted straight line segment to ensure that it meets the requirements of building boundary detection, and adjust the RANSAC parameters for iterative optimization as needed.
[0184] S9 specifically includes:
[0185] S91, straight line segment fitting: Use the improved RANSAC algorithm to fit several straight line segments for the boundary point cloud data in each cluster, denoted as L i , where L i The parametric equation is:
[0186] y=m i x+b i , where m i is the slope of the ith straight line segment, b i is the intercept of the i-th straight line segment;
[0187] S92, each fitted straight line segment L i The extended straight line segment is recorded as L i ′;
[0188] S93, calculate the adjacent extended straight line segment L i ′ and L i+1 ′, the intersection coordinates (x ij ,y ij ), by solving the following system of equations: m i x ij +b i =m i+1 x ij +b i+1 , and we get:
[0189]
[0190] y ij =m i x ij +b i ;
[0191] S94, intersection filtering: filtering all calculated intersections to remove abnormal intersections that do not conform to the building outline;
[0192] S95, feature line construction: connect the filtered intersection points in sequence to construct the overall feature line of the building facade;
[0193] S96, optimize the constructed feature line to ensure its smoothness and accuracy, and use the curve fitting algorithm to smooth the feature line. The smoothing process is as follows:
[0194] Initialize the intersection point set: All the intersection points (x ij ,y ij ) are arranged in order to form an intersection set;
[0195] Select the curve fitting method: Select a curve fitting algorithm that is suitable for the building contour, such as B-spline curve fitting or polynomial fitting;
[0196] Curve fitting parameter setting: according to the selected fitting method, set relevant parameters, such as the number of nodes of the B-spline curve or the order of the polynomial;
[0197] Construct a fitting curve model: construct a fitting curve model using the selected curve fitting method;
[0198] Calculate the fitting curve: Calculate the parameters of the curve fitting model according to the intersection point set to obtain the fitting curve;
[0199] Curve smoothing: Smooth the fitted curve to remove noise and sharp turning points on the curve;
[0200] Verify the fit between the smooth curve after fitting and the actual building outline, and adjust the fitting parameters as needed to ensure the accuracy and smoothness of the characteristic line.
[0201] S10 specifically includes:
[0202] Compare the extracted feature lines with the original point cloud data, and calculate the distance from each feature line point to its corresponding original point cloud point;
[0203] Calculate error indicators: Calculate the error indicators between feature lines and original point cloud data, including average error, root mean square error and maximum error;
[0204] Error analysis: Analyze the calculated error index to determine whether the accuracy of the characteristic line meets the requirements;
[0205] You can also draw an error distribution graph to show the distribution of errors at each point on the feature line, help identify areas with large errors, and adjust the parameters of the feature line extraction algorithm based on the error analysis to optimize the feature line extraction accuracy.
[0206] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present invention is limited to these examples. Under the concept of the present invention, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the present invention as described above, which are not provided in detail for the sake of simplicity.
[0207] The present invention is intended to cover all such substitutions, modifications and variations that fall within the broad scope of the claims. Therefore, any omissions, 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 building feature line extraction method based on three-dimensional point cloud, characterized in that: The following steps are involved: S1, point cloud data acquisition: use a 3D laser scanner to obtain point cloud data of the building; S2, point cloud preprocessing: preprocessing the collected point cloud data, including deleting isolated points and noise points; S3, building facade detection: using the improved RANSAC algorithm to detect the building facade and determine the fitting plane; S4, outlier removal: remove outliers from the facade point cloud based on a multi-scale statistical analysis method, including: S41, Neighborhood definition: Define a neighborhood for each point in the point cloud dataset in It is point p i The center is r and the radius is k The set of all points in the sphere of , where k is the multi-scale parameter; S42, distance calculation: For each point p i , calculate the distance d to all points in the neighborhood ij :d ij =‖p i -p j ‖, where ‖·‖ represents the Euclidean distance, S43, multi-scale average distance: Calculate the average distance of each point at different scales, expressed as: in, is the number of points in the neighborhood, k represents the kth scale; S44, outlier detection: The multi-scale average distance of all points follows a Gaussian distribution, and the global average distance μ is calculated. k and standard deviation σ k ; S45, outlier identification: Identify points in the point cloud dataset whose multi-scale average distance exceeds the threshold as outliers, that is, threshold = μ k +t·σ k , where t is the set standard deviation multiple; S46, outlier removal: deleting all points identified as outliers to obtain a point cloud data set after the outliers are removed; S5, point cloud projection: project the denoised point cloud data onto the fitting plane to ensure the accuracy of feature line extraction; S6, boundary extraction: use the adaptive alpha shape algorithm to extract the boundary of the facade point cloud; S7, boundary clustering: the density peak clustering algorithm is used to separate the boundary point cloud into multiple clusters; S8, straight line segment extraction: use the improved RANSAC algorithm to extract the straight line segments of the boundary point cloud from each cluster; S9, intersection calculation: by extending adjacent straight line segments to obtain their intersection points, the overall characteristic line of the building facade is obtained; S10, precision check: perform precision check on the extracted feature lines.
2. The building feature line extraction method based on three-dimensional point cloud according to claim 1, characterized in that: The S3 specifically includes: S31, initial parameter setting: setting the initial parameters of the RANSAC algorithm, including the number of iterations N, the inlier threshold d and the fitting accuracy ∈; S32, dynamic sampling strategy: dynamically adjust the number of sample points under different sampling scales to improve the adaptability of the algorithm to building facades of different scales; S33, preliminary elevation detection: In each iteration, s points are randomly selected as sample point sets to calculate candidate plane parameters; S34, interior point evaluation: Using the parameters of the candidate plane, calculate the distance from all points to the plane, defined as: Among them, d i is the distance from point i to the plane, (x i ,y i ,z i ) are the coordinates of the point, (a, b, c, d) are the parameters of the plane; S35, interior point selection: If d i ≤∈, then point i is an interior point, count the number of interior points, and select the candidate plane with the largest number of interior points; S36, plane fitting optimization: using the least squares method to fit the selected internal point set to optimize the plane parameters; S37, adaptive adjustment: After each iteration, the number of sampling points and the number of iterations are adjusted according to the ratio of the inner points. The formula is: N = log(1-p) / log(1-(1-∈) s ), where p is the expected confidence, ∈ is the proportion of internal points, and s is the number of sampling points.
3. The method for extracting building feature lines based on three-dimensional point clouds according to claim 2, characterized in that: The S5 specifically includes: S51, determining the fitting plane parameters: obtaining the parameter equation of the fitting plane by the RANSAC algorithm, which is in the form of: a·x+b·y+c·z+d=0, where a, b, c and d are the parameters of the fitting plane; S52, point cloud plane distance calculation: For each point P(x s ,y s ,z s ), calculate its vertical distance d to the fitting plane Pi ; S53, projection point calculation: For each point P(x s ,y s ,z s ) is projected onto the fitting plane to obtain the projection point P′(x s ′,y s ′,z s ′); S54, Projection point cloud integration: All points P(x s ,y s ,z s )'s projection point P'(x s ′,y s ′,z s ′) to form a projected point cloud dataset, and perform accuracy verification on the projected point cloud dataset to ensure that the error in the projection process is within a preset range to ensure the accuracy of feature line extraction.
4. The method for extracting building feature lines based on three-dimensional point clouds according to claim 1, characterized in that: The boundary extraction in S6 specifically includes: S61, setting initial parameters of the alphashape algorithm, including an initial radius α0; S62, Neighborhood definition: Define a neighborhood for each point in the point cloud dataset in, It is point p i The set of all points in a sphere with a center and a radius of α0; S63, neighborhood density calculation: Calculate the density of points in the neighborhood of each point: in, is the number of points in the neighborhood; S64, adaptive radius adjustment: adjust the alpha radius α of each point according to the density of the point cloud data i , the formula is: Among them, max is the maximum density in the point cloud dataset; S65, using adaptively adjusted radius α i Construct alphashape and set the radius α i The ball rolls on the point cloud dataset to form a boundary; S66, boundary extraction: record the boundary points formed by rolling the alphashape and extract the boundary of the facade point cloud.
5. The method for extracting building feature lines based on three-dimensional point clouds according to claim 4, characterized in that: After the boundary extraction, the process further includes boundary optimization, wherein the boundary is optimized by a gradient descent algorithm to improve the boundary accuracy.
6. The method for extracting building feature lines based on three-dimensional point clouds according to claim 1, characterized in that: The boundary clustering in S7 specifically includes: S71, calculate the Euclidean distances between all points in the boundary point cloud to form a distance matrix D = {d ij }, where d ij Indicates point P i and point P j The distance between S72, density calculation: for each point P i Calculate its local density ρ i , the local density is defined as point P i The number of points within the distance threshold δ is expressed as: S73, distance peak calculation: calculate each point P i The minimum distance δ to a point with higher local density i , expressed as: For the point with the highest local density, set δ i =max j (d ij ); S74, selecting the point with the highest local density ρ and distance peak δ as the cluster center; S75, assign other points to the cluster where the nearest cluster center is located. Each point is assigned according to its distance and density from the cluster center. The formula is: Cluster(P i ) = argmin C (d iC ), where C represents the cluster center, d iC Point P i The distance to the cluster center; S76, cluster optimization: optimize the initially allocated clusters, adjust the affiliation of the points, maximize the density of each cluster, and output the finally allocated clusters as multiple clusters of the boundary point cloud.
7. The method for extracting building feature lines based on three-dimensional point clouds according to claim 1, characterized in that: The S8 specifically includes: S81, process the boundary point cloud of each cluster separately, and divide the point cloud data set into multiple clusters {C T }, where T represents the number of the cluster; S82, sample point selection: In each cluster, randomly select s points as the sample point set and calculate the candidate line parameters; S83, candidate straight line fitting: according to the sample point set, the candidate straight line is fitted using the least square method, and the parameter equation of the candidate straight line is calculated, which is expressed as: y=mx+b, where m is the slope of the straight line and b is the intercept of the straight line; S84, interior point evaluation: Using the parameters of the candidate line, calculate the perpendicular distance d from each point to the line line , the formula is: If d line (P i )≤∈, then point P i is the inlier point, count the number of inliers; S85, interior point selection: select the candidate straight line with the largest number of interior points as the best straight line of the current cluster; S86, Line Fitting Optimization: Use the least squares method to fit the selected internal point set to optimize the line parameters. The formula is: Among them, (x i ,y i ) are the coordinates of the interior points, and n is the number of interior points; S87, straight line segment extraction: extract the optimized straight line segment, extend the adjacent straight line segments to their intersection points, and form a complete boundary straight line segment; S88, adaptive adjustment: After each iteration, the number of sampling points and the number of iterations are adjusted according to the ratio of inliers. The formula is: N = log(1-p) / log(1-(1-∈) s ), where p is the expected confidence, ∈ is the proportion of internal points, and s is the number of sampling points; S89, verify the accuracy of the extracted straight line segment to ensure that it meets the requirements of building boundary detection, and adjust the RANSAC parameters for iterative optimization as needed.
8. The method for extracting building feature lines based on three-dimensional point clouds according to claim 7, characterized in that: The S9 specifically includes: S91, straight line segment fitting: Use the improved RANSAC algorithm to fit several straight line segments for the boundary point cloud data in each cluster, denoted as L i , where L i The parametric equation is: y=m i x+b i , where m i is the slope of the ith straight line segment, b i is the intercept of the i-th straight line segment; S92, each fitted straight line segment L i The extended straight line segment is recorded as L i ′; S93, calculate the adjacent extended straight line segment L i ′ and L i+1 ′, the intersection coordinates (x ij ,y ij ), by solving the following system of equations: m i x ij +b i =m i+1 x ij +b i+1 , and we get: y ij =m i x ij +b i ; S94, intersection filtering: filtering all calculated intersections to remove abnormal intersections that do not conform to the building outline; S95, feature line construction: connect the filtered intersection points in sequence to construct the overall feature line of the building facade; S96, optimizes the constructed feature lines to ensure their smoothness and accuracy, and uses a curve fitting algorithm to smooth the feature lines.
9. The method for extracting building feature lines based on three-dimensional point clouds according to claim 1, characterized in that: The S10 specifically includes: Compare the extracted feature lines with the original point cloud data, and calculate the distance from each feature line point to its corresponding original point cloud point; Calculate error indicators: Calculate the error indicators between feature lines and original point cloud data, including average error, root mean square error and maximum error; Error analysis: Analyze the calculated error indicators to determine whether the accuracy of the characteristic line meets the requirements.
Citation Information
Patent Citations
Ground laser point cloud building contour line extraction method based on improved Alpha Shapes algorithm
CN112802041A
Laser point cloud building contour progressive optimization method based on multi-dimensional features
CN116824379A