A method for generating building floor plan based on 3D scanning point cloud
By downsampling and principal component analysis of 3D scanning point cloud data, combined with manual repair and structural optimization, the problem of information loss and misidentification of building planes in 3D point cloud processing is solved, and the generation of complete and continuous 2D Vector flat illustration capabilities.
Patent Information
- Application Number
- CN202111044731.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-07
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-09-07
AI Technical Summary
Existing 3D point cloud processing technology is difficult to effectively identify building planes, especially when there are occlusions and secondary decorations, resulting in information loss and misidentification during the identification process, making it difficult to generate a complete and continuous two-dimensional vector plan view.
Calculate normal vector values by downsampling and principal component analysis of 3D scanning point cloud data, limit the number of face orientations for plane fitting, and combine manual repair and structural optimization to generate a 2D vector plan view to avoid information loss and ensure the consistency of results. .
It ensures the consistency and stability of the results without forcing any restrictions on the surface direction, avoids information loss, and can extract complete and continuous wall surfaces to adapt to different structures and scenes, including non-Manhattan structures and the influence of debris.
Smart Images

Figure CN113781649B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer vision three-dimensional perception and three-dimensional point cloud processing, and in particular to a method for generating a building plan view based on three-dimensional scanning point cloud. Background Art
[0002] With the development and popularization of 3D scanning technology, photogrammetry and depth sensors, we can easily obtain a large amount of 3D point cloud information. Compared with 2D image information, 3D point cloud can more accurately and intuitively describe the geometric properties of objects. In fact, the geometric shapes of life and industrial products are composed of geometric primitives such as planes, spheres, cylinders and cones. Using computers to automatically and efficiently analyze the geometric primitives of parts from point cloud data containing rich information is an important part of the 3D point cloud processing field.
[0003] As a basic geometric primitive, planes are the most common and characteristic objects, and they exist in large numbers in daily life and industrial products. Efficiently identifying all planes in an unordered point cloud and obtaining their accurate geometric properties is a key issue in point cloud processing. Effectively solving the plane fitting problem can reduce the difficulty of computer calculations, determine the posture and properties of the target object, and enable the machine to better perceive the world.
[0004] After 3D reconstruction, the reconstructed point cloud will have various applications, mainly in the field of architecture. There is a demand to efficiently generate a 2D vector plan of a floor after scanning it. Since structural omissions and errors are inevitable due to occlusion, secondary decoration and other reasons during the scanning process, the more reliable one is the semi-automatic solution with manual repair. For the initial recognition stage before manual recognition, the existing technical solutions can be mainly divided into two categories: one is the face recognition solution based on random sampling consistency algorithm or region growing, and the other is the solution based on detecting line segments through Hough transform after 2D projection.
[0005] There are many problems with the above two solutions:
[0006] 1. Non-interactive face recognition solutions are difficult to adapt to all data situations. Data with different layer heights and different scales of deposits may lead to a large number of misidentifications, which significantly increases the workload of the manual repair step.
[0007] 2. It is difficult to obtain a complete and continuous wall based on the solution of detecting line segments with two-dimensional projection. It is difficult to eliminate the influence of debris and only project the wall surface during the projection process, which will cause the edge projection of the deposit to seriously hinder the detection of the wall surface; when detecting lines with Hough transform, if the parameters such as the interval between points in the line segment are increased, two adjacent wall segments will be connected together. If the parameters are reduced, the sparsity will be affected during the projection and scanning process, thus interrupting the line segment.
[0008] 3. Both methods inevitably require secondary optimization of the wall direction, because the detected wall directions are independent of each other, so they will appear scattered in the global structure diagram. At this time, it is often necessary to pull the directions of all line segments to be parallel or perpendicular to the coordinate axis based on the Manhattan world assumption (the geometric structure in the scene only contains parallel, orthogonal and coplanar relationships), but this will greatly limit the structure that can be generated.
[0009] Therefore, it is necessary to provide a method for identifying the two-dimensional plane of a building based on a three-dimensional point cloud, which can effectively avoid the loss of information during the identification process and make it possible to extract complete and continuous walls. Summary of the invention
[0010] Technical issues solved
[0011] The present invention provides a building floor plan generation method based on three-dimensional scanning point cloud, which is applied to the building floor plan generation. The generation method can effectively avoid data loss during the generation process, making it possible to extract a complete and continuous building floor plan.
[0012] Technical Solution
[0013] To achieve the above objectives, the present invention is implemented through the following technical solutions:
[0014] The present invention provides a method for generating a building plan view based on a three-dimensional scanning point cloud, comprising:
[0015] Performing three-dimensional scanning and fusion on a building to obtain three-dimensional point cloud coordinate data of the building;
[0016] Performing data preprocessing on the three-dimensional point cloud coordinate data, wherein the data preprocessing includes downsampling and using principal component analysis to calculate a normal vector value of the point cloud;
[0017] Performing plane fitting based on the three-dimensional point cloud coordinate data after the data preprocessing, wherein the plane fitting limits the number of orientations of the building, and an initial plane structure is obtained through the plane fitting;
[0018] Manually repairing the initial plane structure;
[0019] The manually repaired initial plane structure is structurally optimized to generate a two-dimensional vector plane diagram.
[0020] Furthermore, the scanning and fusion of a building is based on a three-dimensional sensor and a corresponding SLAM algorithm.
[0021] Further, the downsampling includes:
[0022] Creating a three-dimensional voxel grid by inputting the three-dimensional point cloud coordinate data;
[0023] In each of the three-dimensional voxel grids, the centroids of all points in the three-dimensional voxel grid are used to approximate and display other points in the three-dimensional voxel grid.
[0024] Furthermore, the use of principal component analysis to calculate the normal vector value of the point cloud specifically includes:
[0025] Decentralizing the three-dimensional point cloud coordinate data after the downsampling, wherein decentralization refers to subtracting the respective average values from each feature dimension;
[0026] Calculate the covariance matrix;
[0027] The eigenvalue decomposition method is used to find the eigenvalues and eigenvectors of the covariance matrix, and the eigenvectors are sorted from large to small according to the eigenvalues, wherein the smallest eigenvector is the normal vector.
[0028] Furthermore, the plane fitting includes optimization of an objective function, and the objective function is:
[0029]
[0030] Where N is the number of points, N i is the neighborhood point set of the i-th point, V is the optimized normal vector set, z i is the index of the normal vector of the i-th point in V, I is the set of normal vectors calculated in the preprocessing stage, and I i is the original normal vector of the i-th point, and λ represents the outlier penalty coefficient;
[0031] The optimization of the objective function includes the optimization of the following equations (1) and (2);
[0032]
[0033]
[0034] The optimization of formula (1) includes:
[0035] Calculate the change ΔE of the objective function when merging two subdomains,
[0036]
[0037] Among them, v i and v j Represents two subdomains, c ij is the number of connected units in two subdomains, w i is the number of point sets in domain i, w jis the number of point sets in domain j, and λ0 represents the initial value: calculate the median distance between each point and its neighboring points, and take the minimum value in the median set;
[0038] If ΔE is positive, the two subdomains are merged, otherwise they are not merged;
[0039] The normal vector of the new subdomain after merging is:
[0040]
[0041] The optimization of formula (2) includes:
[0042] Construct a function that satisfies F(X∪{x})-F(X)≥F(Y∪{x})-F(Y)for any The submodular function of :
[0043]
[0044] where φ is a set of disconnected regions, is the normal vector of the ith subregion, V φ is included The set of normal vectors of ;
[0045] To initialize: Y←φ;
[0046] Traverse all regions where the number of points in the region is greater than the threshold, and for the i-th region φ i , if F(X∪{φ i})-F(X)≥F(Y\{φ i})-F(Y) then X←X∪{S i}, On the contrary, Y←Y\{φ i}, the obtained V is the optimization result.
[0047] Furthermore, the plane fitting also includes:
[0048] If the length of the points in the region in the direction of the normal vector is greater than 0.1m, project it in this direction to count the number of points in a histogram with a width of 0.01m, take the midpoint of the two highest points as the boundary, and divide the region into two sub-regions;
[0049] For each sub-region, the distribution of its internal points in space is calculated using the principal component analysis method to obtain the eigenvector with the largest corresponding eigenvalue;
[0050] Combined with the normal vector, a rotation matrix from the sub-region coordinate system to the global coordinate system and a rotation matrix from the global coordinate system to the sub-region coordinate system are obtained;
[0051] The points in the region are rotated to the sub-region coordinate system using the rotation matrix from the global coordinate system to the sub-region coordinate system, and the points with the median z-axis coordinate value are sorted and rotated back to the global coordinate system using the rotation matrix from the sub-region coordinate system to the global coordinate system to obtain the point p that the plane passes through in the global coordinate system. median .
[0052] Furthermore, obtaining the initial plane structure through the plane fitting includes:
[0053] For any sub-region, through its three-dimensional normal vector The two-dimensional direction vector is obtained as:
[0054]
[0055] Among them, n1, n2 and n3 represent the directional components in the x-axis, y-axis and z-axis directions respectively;
[0056] according to The angle value of the two-dimensional wall is calculated as θ=arccos(d1);
[0057] Rotate the x-axis and y-axis coordinates of all points according to the two-dimensional rotation matrix:
[0058]
[0059] Rotate to local coordinate system;
[0060] According to the maximum value x in the x-axis direction max and the minimum value x min , and p median The y value y obtained after rotation median , and get the two endpoints in the global coordinate system:
[0061]
[0062] For the wall line segment with θ≤45 or θ>135, take the smaller x value as the starting point and the larger x value as the end point; for the line segment with 45<θ≤135, take the smaller y value as the starting point and the larger y value as the end point;
[0063] According to the maximum and minimum values of the point cloud on the z-axis, the height range (h min ,h max );
[0064] Filter all planes with n3>0.1, adjust the range of wall height, and set a threshold (h low ,h high ), retain the range of height (h min ,h max ) at the threshold (h low ,hhigh ) to obtain the wall surface and obtain a two-dimensional image of the initial plane structure.
[0065] Furthermore, the manual repair includes drawing a line on the two-dimensional image, generating a line according to two points, and calculating θ, data, or select redundant line segments and delete them to get the repaired sketch.
[0066] Furthermore, the structural optimization of the initial planar structure after manual repair includes:
[0067] Calculate whether each point on the repaired sketch can be closed by scaling 5 pixels. If so, replace the line segment with a closed optimized line segment; if not, retain the original line segment.
[0068] Beneficial Effects
[0069] Compared with the known public technology, the technical solution provided by the present invention has the following beneficial effects:
[0070] The present invention uses a method based on l0 restriction, wherein the l0 restriction is used to measure the number of non-zero elements in a vector, that is, the number of normal vectors is limited here: whether the subtraction of two normal vectors is all 0, rather than calculating the normal vector distance. The number of surface directions in the environment is limited, so that without forcibly restricting the directions of each surface, a relationship is established between the surfaces in each direction, the consistency and stability of the results are ensured, and secondary optimization of the directions is avoided; in addition, the method directly acts on three-dimensional data, avoiding the loss of information during the projection process, making it possible to extract complete and continuous walls. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0072] Figure 1 A schematic diagram of a flow chart of a method for generating a building plan view based on a three-dimensional scanning point cloud provided by an embodiment of the present invention;
[0073] Figure 2 The system architecture of a method for generating a building plan view based on a three-dimensional scanning point cloud provided by an embodiment of the present invention is shown in the figure;
[0074] Figure 3 A flow chart of a method for generating a building plan based on a three-dimensional scanning point cloud provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0075] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0076] The present invention will be further described below in conjunction with the embodiments.
[0077] See also Figure 1-3 An embodiment of the present invention provides a method for generating a building plan based on a three-dimensional scanning point cloud, comprising:
[0078] S100, performing three-dimensional scanning and fusion on a building to obtain three-dimensional point cloud coordinate data of the building.
[0079] In this embodiment, the required input data is the three-dimensional point cloud coordinate data obtained by scanning and fusion based on the three-dimensional sensor and the corresponding SLAM algorithm. The original data does not need to have a normal vector value because the data needs to be downsampled first.
[0080] S200, performing data preprocessing on the three-dimensional point cloud coordinate data, wherein the data preprocessing includes downsampling and using principal component analysis to calculate a normal vector value of the point cloud;
[0081] In this embodiment, the downsampling method used is voxel filtering, which creates a three-dimensional voxel grid through the input point cloud data, and then in each voxel (i.e., a three-dimensional cube), the center of gravity of all points in the voxel is used to approximate the display of other points in the voxel, so that all points in the voxel are finally represented by a center of gravity point, and the filtered point cloud is obtained after all voxels are processed. In this embodiment, the length, width and height of the voxel cube can be selected to be 0.05m, which is a relatively large value, because the processing object of this embodiment is the structure of the wall on the plane, and there is no need to detect some particularly small structures, and the number scale of the point cloud has a very huge impact on the speed of the subsequent surface detection step.
[0082] In this embodiment, after downsampling, this embodiment uses principal component analysis to calculate the normal vector value of the point cloud. This method is currently widely used in the calculation of data set distribution in three-dimensional space. Its main steps are:
[0083] (1) The three-dimensional point cloud coordinate data set X = {x1, x2, ..., x n}Decentralize, that is, subtract the mean value from each feature dimension;
[0084] (2) Calculate the covariance matrix
[0085] (3) Use the eigenvalue decomposition method to find the covariance matrix The eigenvalues and eigenvectors of are sorted from large to small to obtain the eigenvalues λ1, λ2, λ3 and eigenvectors in is the normal vector.
[0086] The reason why the normal vector can be calculated using this statistical method is that the line connecting the point and its neighboring points (a certain direction on the plane) should be perpendicular to the direction of the normal vector, that is:
[0087]
[0088] S300, performing plane fitting based on the three-dimensional point cloud coordinate data after the data preprocessing, wherein the plane fitting limits the number of orientations of the building, and an initial plane structure is obtained through the plane fitting.
[0089] In this embodiment, plane fitting includes optimization of an objective function, and the objective function is:
[0090]
[0091] Where N is the number of points, N i is the neighborhood point set of the i-th point, V is the optimized normal vector set, z i is the index of the normal vector of the i-th point in V, I is the set of normal vectors calculated in the preprocessing stage, and I i is the original normal vector of the i-th point, λ is the outlier penalty coefficient, that is, a point and its neighboring points should have similar normal vector values, otherwise it may be caused by outliers. This coefficient controls the proportion and takes values between 1 and 10.
[0092] In this energy function, ||V zi -I i || 2 This is to guide the output normal vector to be as consistent as possible with the input. The adjacent points in the restricted space are finally assigned to the same normal vector. The λ before the formula is the proportion of the restriction in the energy function, which is usually adjusted between 1 and 10 according to the data. For the convenience of optimization, the problem is divided into two sub-problems, that is, the optimization of the objective function includes the optimization of the following formulas (1) and (2);
[0093]
[0094]
[0095] The optimization of formula (1) includes:
[0096] The optimization is performed by merging adjacent plane domains (a set of points that form a plane), which calculates the change in the energy function when merging two subdomains, ΔE.
[0097]
[0098] Among them, v i and v j Represents two subdomains, c ij is the number of connected units in two subdomains, w i is the number of point sets in domain i, w j is the number of point sets in domain j, and λ0 represents the initial value: calculate the median distance between each point and its neighboring points, and take the minimum value in the median set. In the optimization iteration cycle, each time the value is 1.2 times the previous value to promote the expression of the objective function and merge the subdomains.
[0099] If ΔE is positive, the two subdomains are merged, otherwise they are not merged;
[0100] The normal vector of the new subdomain after merging is:
[0101]
[0102] The optimization of formula (2) includes:
[0103] Construct a function that satisfies F(X∪{x})-F(X)≥F(Y∪{x})-F(Y)for any The submodular function of :
[0104]
[0105] where φ is a set of disconnected regions, is the normal vector of the ith subregion, V φ is included The set of normal vectors of ;
[0106] To initialize: Y←φ;
[0107] Traverse all regions where the number of points in the region is greater than the threshold, and for the i-th region φ i , if F(X∪{φ i})-F(X)≥F(Y\{φ i})-F(Y) then X←X∪{S i}, On the contrary, Y←Y\{φ i}, the obtained V is the optimization result.
[0108] However, the above method has a problem, that is, the double wall will be two parallel walls with very close intervals in the scanning result, but because the number of normal vectors is limited in the method, they will be grouped together.
[0109] Therefore, in order to solve this problem, in this embodiment, if the length of a point in the area in the direction of the normal vector is greater than 0.1m, it is projected in this direction, and a histogram of the number of points is counted with a width of 0.01m. The midpoint of the two highest points is taken as the boundary to divide the area into two sub-areas.
[0110] Then, in this embodiment, for each region, the distribution of its internal points in space is calculated using principal component analysis (PCA) to obtain the eigenvector with the largest eigenvalue Combined with the normal vector of the region Then we can get the rotation matrix R from the sub-region coordinate system to the global coordinate system wn and the rotation matrix R from the global coordinate system to the sub-region coordinate system nw :
[0111]
[0112]
[0113] Using R nw Rotate the points in the region to the sub-region coordinate system and sort them to get the median z value z=median(z i ) point, and use R wn Rotate back to the global coordinate system, and you get the point p that the plane passes through in the global coordinate system median .
[0114] At this point, the normal vector and the passing point obtained in the optimization step can represent the plane.
[0115] In addition, in this embodiment, obtaining the initial plane structure through the plane fitting includes:
[0116] For any sub-region, through its three-dimensional normal vector The two-dimensional direction vector is obtained as:
[0117]
[0118] Among them, n1, n2 and n3 represent the directional components in the x-axis, y-axis and z-axis directions respectively;
[0119] according to The angle value of the two-dimensional wall is calculated as θ=arccos(d1);
[0120] Rotate the x-axis and y-axis coordinates of all points according to the two-dimensional rotation matrix:
[0121]
[0122] Rotate to local coordinate system;
[0123] According to the maximum value x in the x-axis direction max and the minimum value x min , and p median The y value y obtained after rotation median , and get the two endpoints in the global coordinate system:
[0124]
[0125] For the wall line segment with θ≤45 or θ>135, take the smaller x value as the starting point and the larger x value as the end point; for the line segment with 45<θ≤135, take the smaller y value as the starting point and the larger y value as the end point;
[0126] According to the maximum and minimum values of the point cloud on the z-axis, the height range (h min ,h max );
[0127] Filter all planes with n3>0.1, adjust the range of wall height, and set a threshold (h low ,h high ), retain the range of height (h min ,h max ) at the threshold (h low ,h high ) to obtain the wall surface and obtain a two-dimensional image of the initial plane structure.
[0128] S400, manually repairing the initial plane structure;
[0129] In this embodiment, after the initial structure is generated, a line is manually drawn on the two-dimensional image, a line is generated from two points, and the corresponding θ is calculated at the same time. Or select redundant line segments and delete them. In addition, the line segments are not required to be closed correctly in this process.
[0130] S500: Optimizing the structure of the manually repaired initial plane structure to generate a two-dimensional vector plane diagram.
[0131] In this embodiment, the structural optimization of the manually repaired initial plane structure includes: calculating whether each point on the repaired sketch can be closed by scaling 5 pixels, specifically:
[0132] (1) If θ≤45 or θ>135, it is a horizontal line, and if 45<θ≤135, it is a vertical line;
[0133] (2) For d=0, 1, 2, 3, 4, 5, repeat steps S300 and S400, and exit if it intersects with other original line segments;
[0134] (3) For a horizontal line, the original x value of the starting point decreases by d, and the original y value decreases by d2 / d1·d, while the original x value of the end point increases by d, and the original y value increases by d2 / d1·d; for a vertical line, the original y value of the starting point decreases by d, and the original x value decreases by d1 / d2·d, while the original y value of the end point increases by d, and the original x value increases by d1 / d2·d.
[0135] (4) For a horizontal line, the original x value of the starting point increases by d, and the original y value increases by d2 / d1·d, while the original x value of the end point decreases by d, and the original y value decreases by / d1·d; for a vertical line, the original y value of the starting point increases by d, and the original x value increases by d1 / d2·d, while the original y value of the end point decreases by d, and the original x value decreases by d1 / d2·d.
[0136] (5) If it is not closed, the original line segment is retained. Thus, the structure optimization is completed and the final two-dimensional vector plane graph is generated.
[0137] like Figure 3 As shown, they are all the line segments drawn after plane fitting, the structure after filtering out objects on the ground such as tables after interactively adjusting the height threshold, the structure after manual repair to remove the over-recognized lines and fill in the missing lines, and the final structure after optimization.
[0138] The advantages of the present invention are that the number of surface directions in the environment is limited by a method based on l0 restriction, so that without forcibly restricting the directions of each surface, an association is established between the surfaces in each direction, the consistency and stability of the results are ensured, and secondary optimization of the directions is avoided; further, the method directly acts on three-dimensional data, avoiding the loss of information in the projection process, making it possible to extract complete and continuous walls; further, no mandatory restrictions are made on the directions, so that it can adapt to some non-Manhattan structures, such as "human"-shaped building floors; further, the semi-automatic interactive process enables it to adapt to various scenes. For example, if there are a lot of debris piled up in the scene, the upper and lower limits of interest can be set to 1.5m to 2m to avoid the influence of too much debris; finally, the optimization is carried out with the closure of the structure as the goal, which provides convenience for the next step of calculating the area, etc.
[0139] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the above embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the above embodiments, or replace some of the technical features therein by equivalents; and these modifications or replacements will not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present invention. In addition, the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features.
Claims
1. A method for generating a building plan based on a three-dimensional scanning point cloud, characterized in that: include: Performing three-dimensional scanning and fusion on a building to obtain three-dimensional point cloud coordinate data of the building; Performing data preprocessing on the three-dimensional point cloud coordinate data, wherein the data preprocessing includes downsampling and using principal component analysis to calculate a normal vector value of the point cloud; Performing plane fitting based on the three-dimensional point cloud coordinate data after the data preprocessing, wherein the plane fitting limits the number of orientations of the building, and an initial plane structure is obtained through the plane fitting; Manually repairing the initial plane structure; Performing structural optimization on the manually repaired initial plane structure to generate a two-dimensional vector plane diagram; Wherein, the plane fitting includes optimization of the objective function, and the objective function is: s.t.|V|≤m Where N is the number of points, N i is the neighborhood point set of the i-th point, V is the optimized normal vector set, z i is the index of the normal vector of the i-th point in V, I is the set of normal vectors calculated in the preprocessing stage, and I i is the original normal vector of the i-th point, λ is the outlier penalty coefficient; The optimization of the objective function includes the optimization of the following equations (1) and (2); The optimization of formula (1) includes: Calculate the change ΔE of the objective function when merging two subdomains, Among them, v i and v j Represents two subdomains, c ij is the number of connected units in two subdomains, w i is the number of point sets in domain i, w j is the number of point sets in domain j, λ0 represents the initial value, that is, the median of the distance between each point and its neighboring points is calculated, and the minimum value in the median set is taken; If ΔE is positive, the two subdomains are merged, otherwise they are not merged; The normal vector of the new subdomain after merging is: The optimization of formula (2) includes: Construct a function that satisfies F(X∪{x})-F(X)≥F(Y∪{x})-F(Y) for any The submodular function of : where φ is a set of disconnected regions, is the normal vector of the ith subregion, V φ is included The set of normal vectors of ; To initialize: Y←φ; Traverse all regions where the number of points in the region is greater than the threshold, and for the i-th region φ i , if F(X∪{φ i })-F(X)≥F(Y\{φ i })-F(Y) then X←X∪{S i }, On the contrary, Y←Y\{φ i }, the obtained V is the optimization result; The plane fitting also includes: If the length of the points in the region in the direction of the normal vector is greater than 0.1m, project it in this direction to count the number of points in a histogram with a width of 0.01m, take the midpoint of the two highest points as the boundary, and divide the region into two sub-regions; For each sub-region, the distribution of its internal points in space is calculated using the principal component analysis method to obtain the eigenvector with the largest corresponding eigenvalue; Combined with the sub-region normal vector, a rotation matrix from the sub-region coordinate system to the global coordinate system and a rotation matrix from the global coordinate system to the sub-region coordinate system are obtained; The points in the region are rotated to the sub-region coordinate system using the rotation matrix from the global coordinate system to the sub-region coordinate system, and the points with the median z-axis coordinate value are sorted and rotated back to the global coordinate system using the rotation matrix from the sub-region coordinate system to the global coordinate system to obtain the point p that the plane passes through in the global coordinate system. median .
2. The method for generating a building plan based on a three-dimensional scanning point cloud according to claim 1, characterized in that: The scanning and fusion of a building is based on a three-dimensional sensor and a corresponding SLAM algorithm.
3. The method for generating a building plan based on a three-dimensional scanning point cloud according to claim 1, characterized in that: The downsampling comprises: Creating a three-dimensional voxel grid by inputting the three-dimensional point cloud coordinate data; In each of the three-dimensional voxel grids, the centroids of all points in the three-dimensional voxel grid are used to approximate and display other points in the three-dimensional voxel grid.
4. The method for generating a building plan based on a three-dimensional scanning point cloud according to claim 3, characterized in that: The method of using principal component analysis to calculate the normal vector value of the point cloud specifically includes: Decentralizing the three-dimensional point cloud coordinate data after the downsampling, wherein decentralization refers to subtracting the respective average values from each feature dimension; Calculate the covariance matrix; The eigenvalue decomposition method is used to find the eigenvalues and eigenvectors of the covariance matrix, and the eigenvectors are sorted from large to small according to the eigenvalues, wherein the smallest eigenvector is the normal vector.
5. The method for generating a building plan based on a three-dimensional scanning point cloud according to claim 1, characterized in that: The obtaining of the initial plane structure by plane fitting comprises: For any sub-region, through its three-dimensional normal vector The two-dimensional direction vector is obtained as: Among them, n1, n2 and n3 represent the directional components in the x-axis, y-axis and z-axis directions respectively; according to The angle value of the two-dimensional wall is calculated as θ=arccos(d1); Rotate the x-axis and y-axis coordinates of all points according to the two-dimensional rotation matrix: Rotate to local coordinate system; According to the maximum value x in the x-axis direction max and the minimum value x min , and p median The y value y obtained after rotation median , and get the two endpoints in the global coordinate system: For the wall line segment with θ≤45 or θ>135, take the smaller x value as the starting point and the larger x value as the end point; for the line segment with 45<θ≤135, take the smaller y value as the starting point and the larger y value as the end point; According to the maximum and minimum values of the point cloud on the z-axis, the height range (h min ,h max ); Filter all planes with n3>0.1, adjust the range of wall height, and set a threshold (h low ,h high ), retain the range of height (h min ,h max ) at the threshold (h low ,h high ) to obtain the wall surface and obtain a two-dimensional image of the initial plane structure.
6. The method for generating a building plan based on a three-dimensional scanning point cloud according to claim 5, characterized in that: The manual repair includes drawing a line on the two-dimensional image, generating a line from two points, and calculating θ, data, or select redundant line segments and delete them to get the repaired sketch.
7. The method for generating a building plan based on a three-dimensional scanning point cloud according to claim 6, characterized in that: The structural optimization of the initial plane structure after manual repair comprises: Calculate whether each point on the repaired sketch can be closed by scaling 5 pixels; if so, replace the line segment with a closed optimized line segment; if not, retain the original line segment.
