Method for automatically generating building geometry-constrained point cloud vectorization CAD general layout layer
Patent Information
- Application Number
- CN202611257976.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-19
- Publication Date
- 2026-10-30
AI Technical Summary
[0004]有鉴于此,本发明实施例提供建筑物几何约束的点云矢量化CAD总图图层自动生成方法,旨在克服现有技术的缺陷,针对现有点云矢量化与CAD总平面图生成过程中自动化程度不足、几何表达不规范的问题
在本发明实施例中,充分利用点云数据的空间几何特征,引入建筑物结构约束关系,实现对建筑轮廓与内部空间的规范化表达与自动建模,在保证方法通用性的同时,有效提升了图层生成结果的规则性、精度与工程适用性。通过对点云数据进行自动分割、结构识别与边界提取,实现建筑物内部结构的自动矢量化表达,减少人工干预,提高数据处理效率。将附有限制条件的间接平差引入点云建筑物墙体主方向识别,通过逆线段长度加权与正交约束联合优化,实现墙体方向的全局最优估计,解决了现有方法依赖启发式规则、缺乏全局最优性的问题。利用法向量分析及正交、平行等结构约束关系,对墙体方向进行统一优化,使生成的CAD图形满足制图规范,同时结合PCA主方向分析提高边界提取精度。通过方向聚类与空间拓扑分析,实现墙体边界的自动补全与优化,并输出CAD兼容格式成果,可直接应用于既有建筑测绘、不动产测量及室内建模等工程场景。
Smart Images

Figure CN123015751A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of building interior measurement technology, and to, but is not limited to, a method for automatically generating point cloud vectorized CAD site plan layers based on building geometric constraints. Background Technology
[0002] Drawing CAD site plans in the absence of original design drawings has practical applications in fields such as existing building surveying, real estate measurement, and interior space reconstruction. For a long time, such tasks have relied primarily on manual interpretation and drawing, which is not only inefficient but also highly dependent on the experience of the operators, making it difficult to guarantee consistency in the results. In recent years, with the development of point cloud processing and image recognition technologies, some automatic or semi-automatic geometric extraction methods have emerged, such as the technical path based on feature point capture and boundary tracking. Although these methods have improved work efficiency to some extent, the generated results often suffer from irregular boundaries, manifested as wall lines deviating from orthogonal relationships and room outlines not meeting the drafting standards of horizontal and vertical alignment.
[0003] However, the aforementioned problems directly affect the expression of spatial topological relationships and geometric accuracy. Especially in applications such as area calculation and real estate registration, errors are easily amplified, thus reducing the reliability and engineering applicability of the results. Therefore, how to introduce geometric constraints and structural rules while ensuring automation, and achieve the automatic generation of CAD site plans that conform to drafting standards and possess high accuracy, has become a key issue that urgently needs to be addressed in current research and engineering practice. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a method for automatically generating CAD site plan layers from point cloud vectorization of building geometric constraints, aiming to overcome the shortcomings of the prior art and address the problems of insufficient automation and non-standard geometric representation in the existing point cloud vectorization and CAD site plan generation processes.
[0005] The specific technical solutions of this invention are as follows: This invention provides a method for automatically generating point cloud vectorized CAD site plan layers based on building geometric constraints, including: The raw point cloud data of the building's internal structure is acquired and preprocessed to obtain the target point cloud data; The target point cloud data is structurally segmented to obtain several point cloud clusters; the normal vector of each point cloud cluster is determined; and the wall point cloud clusters are identified based on the angle characteristics between the normal vector and the gravity direction. An extreme point extraction algorithm based on principal component analysis (PCA) is used to extract the edge patches of each wall point cloud cluster, resulting in a set of wall boundary line segments. The unit direction vector of each line segment is then calculated. The unit direction vectors of all line segments are clustered into two categories, and the principal direction of each line segment in each category is estimated to obtain two initial principal directions. Based on the orthogonal geometric constraints of the building, the direction angle of each line segment is used as the observation value. The two initial principal directions are corrected by indirect adjustment with orthogonal constraints to obtain two mutually orthogonal global principal directions. A local axis-aligned coordinate system is established with the global principal directions as the coordinate axes. The set of wall boundary line segments is transformed to the local axis-aligned coordinate system. With the global principal directions as the direction constraints, combined with spatial proximity analysis, the scattered and discontinuous wall boundary line segments are completed and merged. The completed set of wall boundary segments is rotated back to the original coordinate system and output as a CAD-loadable drawing of the building's internal wall structure.
[0006] In some embodiments, the direction of gravity is parallel to the Z-axis of the coordinate system; the identification of wall point cloud clusters based on the angle between the normal vector and the direction of gravity includes: The angle between the normal vector of the point cloud cluster and the gravity direction vector is calculated using the following formula:
[0007] in, The angle between the normal vector of the point cloud cluster and the gravity direction vector; The direction vector of gravity; This is the normalized unit normal vector of the point cloud cluster; The magnitude of the gravity direction vector; It is the inverse cosine function; Point cloud clusters with included angles greater than a preset angle are identified as wall point cloud clusters and retained, while point cloud clusters with included angles less than or equal to the preset angle are discarded as horizontal plane point cloud clusters.
[0008] In some embodiments, the step of using a principal component analysis (PCA)-based extreme point extraction algorithm to extract the edge patches of each wall point cloud cluster, obtaining a set of wall boundary line segments, and calculating the unit direction vector of each line segment includes: Calculate the centroid coordinates of the wall point cloud cluster and construct the covariance matrix of the wall point cloud cluster; The covariance matrix is subjected to eigenvalue decomposition, and the eigenvector corresponding to the largest eigenvalue is taken as the main extension direction of the wall point cloud cluster. Project each point in the wall point cloud cluster onto the main extension direction, extract the points corresponding to the maximum and minimum projection values as the boundary endpoints of the wall surface, generate the boundary line segments corresponding to the wall point cloud cluster, and summarize all the boundary line segments of the walls to obtain the wall boundary line segment set. Project the set of wall boundary line segments onto the XOY horizontal plane, calculate the direction vector based on the endpoints of the projected two-dimensional line segments, and normalize the direction vector to obtain the unit direction vector corresponding to each line segment.
[0009] In some embodiments, based on the orthogonal geometric constraints of the building, the direction angle of each line segment is used as an observation value, and the two initial principal directions are corrected through indirect adjustment with orthogonal constraints to obtain two mutually orthogonal global principal directions, including: Constructing an indirect adjustment with orthogonal constraints: The two initial principal directions are used as parameters to be estimated, and constraints are introduced in the indirect adjustment process: the direction angle of each line segment is used as the observation value, the weight is the weight of the opposite line segment length, principal direction estimation and orthogonal constraints are set, and an objective function is constructed; the principal direction angle corresponding to the minimum value of the objective function is solved to obtain two mutually orthogonal global principal directions; The formula for calculating the observed value is as follows:
[0010] in, For the first The direction angle of the line segment; For the first The coordinates of the starting point of the line segment; For the first The coordinates of the endpoint of the line segment; It is the arctangent function; The formula for calculating the weight is:
[0011] in, For the first The weight of each line segment; For the first The length of the line segment; The principal direction is estimated as follows:
[0012] in, This is the first set of estimated principal orientation angles; For the first The direction angle of the line segment; For the first The weight of each line segment; The orthogonal constraint is:
[0013] in, This is the estimated second set of principal orientation angles; This is the first set of estimated principal orientation angles; Orthogonal angle constraint; The objective function is:
[0014] in, For the smallest operator, This represents the set of line segment indices that are classified as belonging to the first principal direction; This represents the set of line segment indices that are classified as belonging to the second principal direction; For the first The weight of each line segment; For the first The weight of each line segment; For the first The direction angle of the line segment; For the first The direction angle of the line segment; This is the first set of estimated principal orientation angles; This is the estimated second set of principal direction angles.
[0015] In some embodiments, the step of using the global principal direction as a directional constraint, combined with spatial proximity analysis, to complete and merge scattered and discontinuous wall boundary segments includes: Under the local axis-aligned coordinate system, each wall boundary line segment is classified according to its deviation from the global main direction, and divided into horizontal line segments and vertical line segments; The vertical coordinates of horizontal line segments are snapped to the same horizontal zone, and the horizontal coordinates of vertical line segments are snapped to the same vertical zone. After grouping by coordinate zone, line segments in the same group whose projection intervals along the main direction overlap or whose gaps are less than the preset gap threshold are merged to obtain continuous line segments. The horizontal and vertical line segments are paired to detect their orthogonal intersections, and the theoretical intersection point of each pair of line segments is calculated. If the distance between the endpoint of a line segment and the corresponding theoretical intersection point is less than a preset extension threshold, the endpoint is extended and attached to the position of the theoretical intersection point to form a topological node for the wall intersection. Spatial clustering is performed on the endpoints of all line segments, and endpoints whose distance from each other is less than a preset extension threshold are unified into the same topological node; A topology graph is constructed based on the processed line segments and topology nodes. Unclosed room boundary gaps are detected, and line segments are added to the broken boundaries where the distance between the two ends of the gap is less than the preset room closure threshold to generate a closed room outline.
[0016] The beneficial effects of the technical solutions provided by the embodiments of the present invention include at least the following: In this embodiment of the invention, the spatial geometric features of point cloud data are fully utilized, and structural constraints of buildings are introduced to achieve standardized expression and automatic modeling of building outlines and internal spaces. While ensuring the universality of the method, the regularity, accuracy, and engineering applicability of the generated layer results are effectively improved. By automatically segmenting, identifying structures, and extracting boundaries from point cloud data, automatic vectorization of the building's internal structure is achieved, reducing manual intervention and improving data processing efficiency. Indirect adjustment with constraints is introduced into the identification of the principal orientation of the point cloud building walls. Through joint optimization using inverse segment length weighting and orthogonal constraints, the global optimal estimation of the wall orientation is achieved, solving the problem of existing methods relying on heuristic rules and lacking global optimality. Using normal vector analysis and structural constraints such as orthogonality and parallelism, the wall orientation is uniformly optimized so that the generated CAD graphics meet drafting standards. At the same time, PCA principal orientation analysis is combined to improve the accuracy of boundary extraction. Through directional clustering and spatial topology analysis, automatic completion and optimization of wall boundaries are achieved, and CAD-compatible format results are output, which can be directly applied to engineering scenarios such as existing building surveying, real estate surveying, and interior modeling. Attached Figure Description
[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort, wherein: Figure 1 This is a flowchart illustrating the method for automatically generating point cloud vectorized CAD site plan layers of building geometric constraints according to an embodiment of the present invention. Figure 2 A schematic diagram of the point cloud data preprocessing result of the automatic generation method for point cloud vectorization of building geometric constraints CAD site drawing layer provided in an embodiment of the present invention; Figure 3 A schematic diagram of the point cloud segmentation result of the automatic generation method for point cloud vectorization of CAD site plan layers based on building geometric constraints provided in an embodiment of the present invention; Figure 4 A schematic diagram of edge extraction and clustering analysis results for the automatic generation method of point cloud vectorization CAD site plan layer of building geometric constraints provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of the normal vector topology rule constraint result of the automatic generation method for point cloud vectorization of building geometric constraints in CAD general plan layers provided in an embodiment of the present invention. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. The following embodiments are used to illustrate the present invention, but are not intended to limit the scope of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0020] It should be noted that the terms "first, second, and third" used in the embodiments of the present invention are only used to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, and third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of the present invention described herein can be implemented in an order other than that illustrated or described herein.
[0021] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which these embodiments of the invention pertain. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0022] Figure 1 This is a flowchart illustrating the method for automatically generating CAD site plan layers from point cloud vectorization of building geometric constraints provided in an embodiment of the present invention. Figure 1 As shown, the method includes at least the following steps: Step S110: Obtain the original point cloud data of the building's internal structure and perform preprocessing to obtain the target point cloud data.
[0023] Data on the internal structure of a building is collected using a handheld LiDAR, including all corners and stairwells, to obtain raw point cloud data of the building's internal structure.
[0024] It should be noted that handheld LiDAR scanning technology is an important technique for acquiring point cloud data inside buildings, removing point clouds outside the building while retaining the target point cloud of the main building. Specifically, this can be achieved by manually selecting or automatically identifying the building's outer contour, creating a spatial bounding box, and then removing the point cloud outside the bounding box.
[0025] Statistical filtering algorithms are used to preprocess the original point cloud data, removing outliers and noise points to reduce noise impact. Then, voxel downsampling is performed on the denoised point cloud data, with the voxel size adaptively determined based on the point cloud density. This reduces data volume and improves processing speed, yielding the target point cloud data. The preprocessed point cloud data results are shown below. Figure 2 As shown.
[0026] Step S120: Perform structured segmentation on the target point cloud data to obtain several point cloud clusters; determine the normal vector of each point cloud cluster; and identify the wall point cloud clusters based on the angle between the normal vector and the gravity direction.
[0027] It should be noted that the point cloud patches are structurally segmented according to the wall they are located on, and the local density characteristics of the point cloud are characterized by the neighborhood radius and the minimum number of points, so as to achieve adaptive clustering of continuous structures in space without the need to preset the number of categories.
[0028] It's important to note that DBSCAN (Density-Based Spatial Clustering of Applications with Noise) is a density-based clustering method. Its core idea is to group nearby points with sufficiently high local density into the same category, while treating isolated points with low density as noise. Unlike algorithms that require pre-specifying the number of clusters, DBSCAN is suitable for point clouds containing data with uncertain target numbers, irregular shapes, and noise.
[0029] It should be noted that, firstly, the DBSCAN algorithm is used to perform structured segmentation of the target point cloud data to obtain several point cloud clusters, and several point cloud clusters are several point cloud sub-regions with geometric consistency; then, plane fitting is performed on each point cloud cluster, and targets that conform to the geometric features of the wall are selected based on the plane normal vector features, and finally the wall point cloud clusters are saved as independent files.
[0030] Specifically, the DBSCAN algorithm is used to cluster and segment the target point cloud data. The result of the point cloud segmentation is as follows: Figure 3 As shown, with a neighborhood radius of 0.2m and a minimum number of points of 200, spatially adjacent and high-density points are divided into several clusters, resulting in several spatially adjacent point cloud clusters with consistent density.
[0031] For each point cloud cluster, if the number of points in the point cloud cluster is greater than the preset point count threshold (the point count threshold is 300), it is determined to be a point cloud cluster. According to the preset plane fitting distance threshold, RANSAC sampling points, and iteration number, such as a plane fitting distance threshold of 0.03, RANSAC sampling points of 3, and iteration number of 1000, the RANSAC algorithm is used to perform plane fitting on each point cloud cluster, and the plane normal vector of each point cloud cluster is determined based on the coefficient of the first-order term of the plane equation obtained by plane fitting.
[0032] It should be noted that the main parameters used in the DBSCAN algorithm include neighborhood radius eps=0.2, minimum number of points min_points=200, post-clustering point threshold of 300, plane fitting distance threshold of 0.03, RANSAC sampling point number of 3, and number of iterations of 1000.
[0033] Calculate the centroid coordinates:
[0034] in, This represents the total number of points in the point cloud. , , For the first point cloud The three-dimensional coordinates of each point; , , Let be the centroid coordinates of the point set.
[0035] Construct the covariance matrix:
[0036] in, It is a 3×3 covariance matrix; , , For the first point cloud The three-dimensional coordinates of each point; , , Let be the centroid coordinates of the point set.
[0037] Eigenvalue decomposition of the covariance matrix C yields the normal vectors of the point cloud clusters:
[0038]
[0039] in, It is a 3×3 covariance matrix; These are the eigenvalues of the covariance matrix C; For the corresponding eigenvalues 3D feature vectors; For feature vectors exist , , Three components on the axis.
[0040] Normal vector normalization: in, This is the normalized unit normal vector of the point cloud cluster; For vectors The L2 norm, i.e., the spatial length of the vector, ; Based on the angle between the normal vector and the direction of gravity, the wall point cloud clusters are identified from each point cloud cluster.
[0041] Specifically, the angle between the normal vector of the point cloud cluster and the gravity direction vector is calculated using the following formula:
[0042] in, The angle between the normal vector of the point cloud cluster and the gravity direction vector; The direction vector of gravity; This is the normalized unit normal vector of the point cloud cluster; The magnitude of the gravity direction vector; It is the dot product of the unit normal vector and the gravity vector; It is an inverse cosine function.
[0043] The direction of gravity is parallel to the Z-axis of the coordinate system, and the included angle is determined by the absolute value of the Z-axis component of the normal vector; where the included angle is equal to the inverse cosine of the absolute value of the Z-axis component. Point cloud clusters with an included angle greater than a preset angle are identified as wall point cloud clusters and retained, while point cloud clusters with an included angle less than or equal to a preset angle are discarded as horizontal plane point cloud clusters; the preset angle is 66.4°.
[0044] It should be noted that the preset component threshold is 0.4, which is equivalent to the preset angle between the normal vector and the Z-axis being approximately 66.4°. When the absolute value of the Z-axis component of the normal vector of a point cloud cluster is less than 0.4, the point cloud cluster is determined to be a wall point cloud cluster, belonging to a vertical structure. If the absolute value of the Z-axis component of the normal vector of a point cloud cluster is greater than or equal to the component threshold, it is identified as a horizontal plane (ceiling, ground) and discarded, thus retaining the main vertical structures such as walls. All point clouds identified as walls are summarized and saved as a separate wall point cloud file.
[0045] Step S130: The extreme point extraction algorithm based on principal component analysis (PCA) is used to extract the edge of each wall point cloud cluster to obtain the set of wall boundary line segments, and the unit direction vector of each line segment is calculated. The unit direction vectors of all line segments are clustered into two categories, and the principal direction of each line segment in each category is estimated to obtain two initial principal directions.
[0046] It should be noted that boundary ruleization algorithms and knowledge-based reconstruction strategies are applied to perform model reconstruction and edge extraction on the segmentation results.
[0047] An extreme point extraction algorithm based on principal component analysis (PCA) is used to extract edges from the surfaces of vertical structures. The principle is to treat the distribution of the wall point cloud clusters as a two-dimensional spatial sample set. The edge extraction clustering analysis results are as follows: Figure 4 As shown.
[0048] First, calculate the centroid coordinates of the wall point cloud cluster to describe its center position.
[0049] Next, the covariance matrix of the wall point cloud cluster is constructed by constructing the product sum matrix of the differences in point coordinates; the matrix is then subjected to eigenvalue decomposition, and the eigenvector corresponding to the largest eigenvalue is taken as the main extension direction of the wall point cloud cluster.
[0050] After determining the main extension direction, each point in the wall point cloud cluster is projected onto the main extension direction. During projection, the three-dimensional shape of the wall is compressed into a one-dimensional coordinate sequence. The extreme points of the projection on this sequence are extracted, and the points corresponding to the maximum and minimum projection values are extracted as the boundary endpoints of the wall patches. The boundary line segments corresponding to the wall point cloud cluster are generated, realizing the simplification of the three-dimensional point cloud into a two-dimensional linear structure and the determination of the boundary. The boundary line segments of all walls are summarized to obtain the wall boundary line segment set.
[0051] Project the set of wall boundary line segments onto the XOY horizontal plane, calculate the direction vector based on the endpoints of the projected two-dimensional line segments, and normalize the direction vector to obtain the unit direction vector corresponding to each line segment.
[0052] It should be noted that, based on the direction vector of the line element extracted from the XOY plane, the centroid is first determined based on its two-dimensional coordinates, and then the above dispersion analysis and principal direction solution process is repeated. Finally, the obtained principal direction vector is normalized to obtain the unit direction vector.
[0053] Project each wall boundary line segment onto the XOY horizontal plane, calculate the direction vector based on the endpoints of the projected two-dimensional line segments, and normalize the direction vector to obtain the unit direction vector corresponding to each line segment.
[0054] It should be noted that, based on the unit direction vector obtained above, and combined with the common orthogonal and parallel relationships in buildings, K-means clustering analysis is performed on line segments with the same or similar directions. The extracted walls are clustered according to their normal vectors and divided into two roughly orthogonal classes. The position and direction of the walls are then adjusted according to topological rules.
[0055] It should be noted that the K-means clustering algorithm is used to cluster the orientation vectors of each wall into two mutually orthogonal classes (for buildings that only contain orientation vectors orthogonal to parallel walls), and the least squares method is used to calculate the orientation vector that best represents the class by taking the small error of the normal vector within each class.
[0056] Specifically, the K-means clustering algorithm is used to cluster the unit direction vectors of all line segments to obtain two direction categories; For each direction category, the representative direction of the unit direction vector of each line segment within the direction category is fitted using the least squares method to obtain two initial principal directions.
[0057] Step S140: Based on the orthogonal geometric constraints of the building, the direction angle of each line segment is used as the observation value. The two initial principal directions are corrected by indirect adjustment with orthogonal constraints to obtain two mutually orthogonal global principal directions. A local axis-aligned coordinate system is established with the global principal directions as the coordinate axes. The set of wall boundary line segments is transformed to the local axis-aligned coordinate system. With the global principal directions as the direction constraints, combined with spatial proximity analysis, the scattered and discontinuous wall boundary line segments are completed and merged.
[0058] It should be noted that, based on the unit direction vectors obtained above, fragmented and discontinuous wall boundaries are merged and topologically completed through directional constraints and spatial proximity analysis.
[0059] It should be noted that indirect adjustment is an optimization estimation method based on inversely calculating unknown parameters from observed values. Its core idea is to treat the direction of each line segment as an observation with error, and by establishing a parametric model and introducing geometric constraints, the estimation results satisfy the prior conditions while minimizing the overall observation residuals. The results of the normal vector topological rule constraints are as follows: Figure 5 As shown, the building walls have only two sets of mutually orthogonal principal directions on the plane. Therefore, the directions of the segmented line segments are taken as observations, and the two initial principal directions are taken as parameters to be estimated. The constraint of "keeping the two orthogonal" is introduced during the adjustment process to achieve robust estimation and correction of the principal directions.
[0060] It should be noted that the direction angle of each line segment is regarded as the observation value with error. In the indirect adjustment, two mutually orthogonal global principal directions are set as constraints. The two initial principal directions are used as parameters to be estimated. The constraints include the observation value, weight, principal direction estimation, orthogonality constraint and objective function. Specifically, an indirect adjustment with orthogonal constraints is constructed: two initial principal directions are used as parameters to be estimated, and constraints are introduced in the indirect adjustment process: the direction angle of each line segment is used as the observation value, the weight is the weight of the reverse line segment length, principal direction estimation and orthogonal constraints are set, and an objective function is constructed; the principal direction angle corresponding to the minimum value of the objective function is solved to obtain two mutually orthogonal global principal directions.
[0061] The formula for calculating the observed value is as follows:
[0062] in, For the first The direction angle of the line segment; For the first The coordinates of the starting point of the line segment; For the first The coordinates of the endpoint of the line segment; It is the arctangent function; The formula for calculating the weight is:
[0063] in, For the first The weight of each line segment; For the first The length of the line segment; The main direction is estimated as follows:
[0064] in, This is the first set of estimated principal orientation angles; For the first The direction angle of the line segment; For the first The weight of each line segment; Orthogonal constraints are:
[0065] in, This is the estimated second set of principal orientation angles; This is the first set of estimated principal orientation angles; Orthogonal angle constraint; The objective function is:
[0066] in, For the smallest operator, This represents the set of line segment indices that are classified as belonging to the first principal direction; This represents the set of line segment indices that are classified as belonging to the second principal direction; For the first The weight of each line segment; For the first The weight of each line segment; For the first The direction angle of the line segment; For the first The direction angle of the line segment; This is the first set of estimated principal orientation angles; This is the estimated second set of principal direction angles.
[0067] It should be noted that the main direction statistics of the output line segment set are performed. Based on the least squares idea of reverse line segment length weighting and indirect adjustment, two sets of mutually orthogonal main directions in the building plan are automatically identified. The line segment set is rotated to a local coordinate system aligned with the coordinate axes, so that the line segments that were originally approximately parallel to the wall direction are mapped to horizontal line segments and vertical line segments respectively.
[0068] In the local axis-aligned coordinate system, each wall boundary line segment is classified according to its deviation from the global main direction, and divided into horizontal line segments and vertical line segments. It should be noted that line segment directional snapping: In the rotated local coordinate system, directional snapping is performed on approximately horizontal line segments and approximately vertical line segments respectively. The angular tolerance for classification is ANGLE_TOL_DEG=20.0°, and the coordinate threshold for directional snapping is SNAP_TOL=0.08; this is to reduce minor deviations caused by point cloud noise and fitting errors.
[0069] Specifically, the vertical coordinates of horizontal line segments are snapped to the same horizontal zone, and the horizontal coordinates of vertical line segments are snapped to the same vertical zone. After grouping by coordinate zone, line segments in the same group whose projection intervals along the main direction overlap or whose gaps are less than a preset gap threshold are merged to obtain continuous line segments. The preset gap threshold is 0.12.
[0070] It should be noted that coaxial broken wall segment merging: After the line segments are adsorbed, they are grouped according to their horizontal or vertical zones. Line segments with similar normal positions and overlapping projection intervals within the same group, and whose gaps are less than the preset gap threshold GAP_TOL=0.12 for broken wall merging, are merged into continuous wall edges.
[0071] Perform pairwise orthogonal intersection detection on horizontal and vertical line segments, and calculate the theoretical intersection point for each pair of line segments; if the distance between the endpoint of a line segment and the corresponding theoretical intersection point is less than a preset extension threshold, extend the endpoint and snap it to the position of the theoretical intersection point to form a topological node for wall intersection. It should be noted that pairwise orthogonal intersection point detection is performed on horizontal and vertical line segments, and the theoretical intersection point of each pair of line segments is calculated. If the distance between the endpoint of the line segment and the corresponding theoretical intersection point is less than the preset extension threshold (0.08m), the endpoint is extended and attached to the position of the theoretical intersection point to form a topological node of the wall intersection.
[0072] Spatial clustering is performed on the endpoints of all line segments, and endpoints whose distance from each other is less than a preset extension threshold are unified into the same topological node; A topology graph is constructed based on the processed line segments and topology nodes. Unclosed room boundary gaps are detected, and line segments are added to the broken boundaries where the distance between the two ends of the gap is less than the preset room closure threshold to generate a closed room outline.
[0073] It should be noted that if the distance between the endpoint near the intersection and the point is less than 0.08, the endpoint near the intersection and the point are considered to be the same topological node; when the distance between the endpoint and the intersection is less than 0.12, the endpoint is considered to be extended to the intersection. Through the above operations, the orthogonal connection relationship between the walls is restored, and the topological completion of the corner and the edge of the wall is realized, so that the walls that were not originally intersecting but should theoretically intersect form a connection relationship in the topology.
[0074] Spatial clustering is performed on the endpoints of all line segments, and endpoints that are less than a preset gap threshold are merged into the same topological node.
[0075] It should be noted that endpoint adsorption and small gap repair: the endpoints of all wall segments are spatially clustered based on neighborhood. If the spatial distance between several endpoints is less than the node NODE_TOL=0.08, they are unified into the same topological node. For wall edges that are close but not connected, missing segments are supplemented according to their horizontal or vertical relationship to repair small gaps.
[0076] A topology graph is constructed based on the processed line segments and topology nodes. Unclosed room boundary gaps are detected. For broken boundaries where the distance between the two ends of the gap is less than a preset closure threshold, line segments are added to generate a closed room outline. The closure threshold is 0.2.
[0077] It should be noted that the closed-loop detection and room boundary completion are as follows: a topology diagram is constructed based on the repaired node and line segment relationships to detect whether there are unclosed room boundaries; for broken boundaries that meet the same horizontal or vertical direction and whose spacing is less than the preset closure threshold, connecting line segments are automatically added to form a closed room outline.
[0078] Step S150: Rotate the completed wall boundary line segment set back to the original coordinate system and output it as a CAD-loadable drawing of the building's internal wall structure.
[0079] Coordinate system restoration and result output: Perform an inverse rotation operation on the completed set of wall boundary segments to restore it from the local axis-aligned coordinate system to the original coordinate system, thus obtaining the wall boundary segments in the original coordinate system; The wall boundary lines in the original coordinate system are converted into DXF graphic data format that can be recognized by CAD; based on the converted DXF graphic data, an internal wall structure drawing of the building that can be loaded by CAD is output. It should be noted that the repaired line segment set is rotated back from the local axis-aligned coordinate system to the original coordinate system and output as a CAD-recognizable DXF graphic file to form a complete architectural floor plan. The method of automatically vectorizing CAD site plan layers using point clouds improves data acquisition efficiency and reduces manual workload; the final output is a CAD-loadable drawing of the building's internal wall structure.
[0080] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of the invention. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of the invention, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the invention. The sequence numbers of the above-described embodiments of the invention are merely descriptive and do not represent the superiority or inferiority of the embodiments.
[0081] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0082] In the several embodiments provided by this invention, it should be understood that the disclosed methods can be implemented in other ways. The methods disclosed in the several method embodiments provided by this invention can be arbitrarily combined without conflict to obtain new method embodiments. The features disclosed in the several method embodiments provided by this invention can be arbitrarily combined without conflict to obtain new method embodiments.
[0083] The above description is merely an embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A method for automatically generating CAD site plan layers from point cloud vectorization of building geometric constraints, characterized in that, include: The raw point cloud data of the building's internal structure is acquired and preprocessed to obtain the target point cloud data; The target point cloud data is structurally segmented to obtain several point cloud clusters; the normal vector of each point cloud cluster is determined; and the wall point cloud clusters are identified based on the angle characteristics between the normal vector and the gravity direction. An extreme point extraction algorithm based on principal component analysis (PCA) is used to extract the edge patches of each wall point cloud cluster, resulting in a set of wall boundary line segments. The unit direction vector of each line segment is then calculated. The unit direction vectors of all line segments are clustered into two categories, and the principal direction of each line segment in each category is estimated to obtain two initial principal directions. Based on the orthogonal geometric constraints of the building, the direction angle of each line segment is used as the observation value. The two initial principal directions are corrected by indirect adjustment with orthogonal constraints to obtain two mutually orthogonal global principal directions. A local axis-aligned coordinate system is established with the global principal directions as the coordinate axes. The set of wall boundary line segments is transformed to the local axis-aligned coordinate system. With the global principal directions as the direction constraints, combined with spatial proximity analysis, the scattered and discontinuous wall boundary line segments are completed and merged. The completed set of wall boundary segments is rotated back to the original coordinate system and output as a CAD-loadable drawing of the building's internal wall structure.
2. The method according to claim 1, characterized in that, The preprocessing includes: Outlier noise points in the original point cloud data are removed using a statistical filtering algorithm. Then, the denoised point cloud data is downsampled using voxels to obtain the target point cloud data. The voxel size of the downsampled voxels is adaptively determined based on the point cloud density.
3. The method according to claim 1, characterized in that, Determining the normal vector of each point cloud cluster includes: Based on the preset plane fitting distance threshold, the number of RANSAC sampling points, and the number of iterations, the RANSAC algorithm is used to perform plane fitting on each point cloud cluster, and the plane normal vector of each point cloud cluster is determined according to the plane equation obtained by plane fitting.
4. The method according to claim 1, characterized in that, The direction of gravity is parallel to the Z-axis of the coordinate system; and based on the angle between the normal vector and the direction of gravity, the wall point cloud clusters are identified, including: The angle between the normal vector of the point cloud cluster and the gravity direction vector is calculated using the following formula: in, The angle between the normal vector of the point cloud cluster and the gravity direction vector; The direction vector of gravity; This is the normalized unit normal vector of the point cloud cluster; The magnitude of the gravity direction vector; It is the inverse cosine function; Point cloud clusters with included angles greater than a preset angle are identified as wall point cloud clusters and retained, while point cloud clusters with included angles less than or equal to the preset angle are discarded as horizontal plane point cloud clusters.
5. The method according to claim 1, characterized in that, The extreme point extraction algorithm based on principal component analysis (PCA) is used to extract the edge patches of each wall point cloud cluster, resulting in a set of wall boundary line segments. The unit direction vector of each line segment is then calculated, including: Calculate the centroid coordinates of the wall point cloud cluster and construct the covariance matrix of the wall point cloud cluster; The covariance matrix is subjected to eigenvalue decomposition, and the eigenvector corresponding to the largest eigenvalue is taken as the main extension direction of the wall point cloud cluster. Project each point in the wall point cloud cluster onto the main extension direction, extract the points corresponding to the maximum and minimum projection values as the boundary endpoints of the wall surface, generate the boundary line segments corresponding to the wall point cloud cluster, and summarize all the boundary line segments of the walls to obtain the wall boundary line segment set. Project the set of wall boundary line segments onto the XOY horizontal plane, calculate the direction vector based on the endpoints of the projected two-dimensional line segments, and normalize the direction vector to obtain the unit direction vector corresponding to each line segment.
6. The method according to claim 1, characterized in that, The process involves clustering the unit direction vectors of all line segments into two categories, and estimating the principal direction for each line segment within each category to obtain two initial principal directions, including: The K-means clustering algorithm is used to cluster the unit direction vectors of all line segments to obtain two direction categories; For each direction category, the representative direction of the unit direction vector of each line segment within the direction category is fitted using the least squares method to obtain two initial principal directions.
7. The method according to claim 1, characterized in that, Based on the orthogonal geometric constraints of the building, the direction angle of each line segment is used as the observation value. The two initial principal directions are corrected through indirect adjustment with orthogonal constraints to obtain two mutually orthogonal global principal directions, including: Constructing an indirect adjustment with orthogonal constraints: The two initial principal directions are used as parameters to be estimated, and constraints are introduced in the indirect adjustment process: the direction angle of each line segment is used as the observation value, the weight is the weight of the opposite line segment length, principal direction estimation and orthogonal constraints are set, and an objective function is constructed; the principal direction angle corresponding to the minimum value of the objective function is solved to obtain two mutually orthogonal global principal directions; The formula for calculating the observed value is as follows: in, For the first The direction angle of the line segment; For the first The coordinates of the starting point of the line segment; For the first The coordinates of the endpoint of the line segment; It is the arctangent function; The formula for calculating the weight is: in, For the first The weight of each line segment; For the first The length of the line segment; The principal direction is estimated as follows: in, This is the first set of estimated principal orientation angles; For the first The direction angle of the line segment; For the first The weight of each line segment; The orthogonal constraint is: in, This is the estimated second set of principal orientation angles; This is the first set of estimated principal orientation angles; Orthogonal angle constraint; The objective function is: in, For the smallest operator, This represents the set of line segment indices that are classified as belonging to the first principal direction; This represents the set of line segment indices that are classified as belonging to the second principal direction; For the first The weight of each line segment; For the first The weight of each line segment; For the first The direction angle of the line segment; For the first The direction angle of the line segment; This is the first set of estimated principal orientation angles; This is the estimated second set of principal direction angles.
8. The method according to claim 1, characterized in that, The process of using the global main direction as a directional constraint, combined with spatial proximity analysis, to complete and merge scattered and discontinuous wall boundary segments includes: Under the local axis-aligned coordinate system, each wall boundary line segment is classified according to its deviation from the global main direction, and divided into horizontal line segments and vertical line segments; The vertical coordinates of horizontal line segments are snapped to the same horizontal zone, and the horizontal coordinates of vertical line segments are snapped to the same vertical zone. After grouping by coordinate zone, line segments in the same group whose projection intervals along the main direction overlap or whose gaps are less than the preset gap threshold are merged to obtain continuous line segments. The horizontal and vertical line segments are paired to detect their orthogonal intersections, and the theoretical intersection point of each pair of line segments is calculated. If the distance between the endpoint of a line segment and the corresponding theoretical intersection point is less than a preset extension threshold, the endpoint is extended and attached to the position of the theoretical intersection point to form a topological node for the wall intersection. Spatial clustering is performed on the endpoints of all line segments, and endpoints whose distance from each other is less than a preset extension threshold are unified into the same topological node; A topology graph is constructed based on the processed line segments and topology nodes. Unclosed room boundary gaps are detected, and line segments are added to the broken boundaries where the distance between the two ends of the gap is less than the preset room closure threshold to generate a closed room outline.
9. The method according to claim 1, characterized in that, The process of rotating the completed set of wall boundary segments back to the original coordinate system and outputting it as a CAD-loadable internal wall structure drawing includes: Perform an inverse rotation operation on the completed set of wall boundary segments to restore it from the local axis-aligned coordinate system to the original coordinate system, thus obtaining the wall boundary segments in the original coordinate system; The wall boundary line segments in the original coordinate system are converted into DXF graphic data format that can be recognized by CAD; based on the converted DXF graphic data, the output is a CAD-loadable internal wall structure drawing of the building.