A building template instantiation modeling method based on point cloud data
Through the template instantiation modeling method based on point cloud data, feature parameter extraction and template matching are used to solve the problems of holes, damage, and deformation in the construction of three-dimensional building models in traditional methods, achieving fast and complete model generation, and improving efficiency and similarity.
Patent Information
- Application Number
- CN202210739217.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-27
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2042-06-27
AI Technical Summary
The traditional three-dimensional building model construction method is limited by the quality of point clouds, especially in large-scale outdoor terrain scenes, which are prone to problems such as holes, damage, and distortion. The large amount of calculations makes model generation time-consuming.
The template instantiation modeling method based on point cloud data is used to generate a complete three-dimensional building model through feature parameter extraction and template matching, including designing the standard structure of universal component template files, indirect image segmentation, connected domain algorithms, and region growing algorithms. Instanced editing and texture generation.
It achieves fast and complete three-dimensional building model construction and automated processing, repairs the holes, damage, and deformation problems in traditional methods, and improves the efficiency and similarity of model generation.
Smart Images

Figure CN115033967B
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of landscape modeling and surveying and mapping, and relates to a building template instantiation modeling method based on point cloud data. Background Art
[0002] The construction of 3D building models refers to the technology of using cameras, laser scanners and other equipment to shoot and scan buildings in real scenes from multiple angles, obtain their images, point clouds and other information, and then use technical means to process them to generate building models that can be displayed in 3D virtual form. Modeling based on parametric templates refers to the technology of reading scene parameters and editing existing model templates according to the obtained parameters to form a 3D model that is as close to the real scene as possible. Specifically in the construction of 3D building models, templates refer to standardized and fixed files formed by extracting the common features of buildings.
[0003] Point clouds are a massive collection of points that contain the surface characteristics of objects in the scene. According to different generation and collection principles, they contain different attribute information such as three-dimensional coordinates (XYZ), laser reflection intensity, RGB color values, etc. The traditional building modeling method generates facets by performing meshing and triangulation on the point cloud to generate a three-dimensional building model file. However, this model construction method is restricted by the quality of point clouds, especially for large-scale outdoor terrain scenes. Point clouds may be missing during the collection or generation process due to blind spots, etc., which will cause the generated building model to have problems such as holes, damage, distortion, etc. In addition, the traditional building model construction method has a large amount of calculation, which makes the model generation time-consuming. Summary of the invention
[0004] Aiming at the problem of constructing a three-dimensional model of buildings in a target area, the present invention provides a template instantiation construction method based on point cloud data, which extracts feature parameters from point cloud data and edits a pre-prepared building template file to produce a complete building model with a sense of reality.
[0005] The present invention provides a method for instantiating a building template based on point cloud data, comprising the following steps:
[0006] S1: Design a standard structure and storage format of template files of common components, disassemble the building model according to the common components, model the common categories of each component respectively, design a database storage structure of the model library, and store the template files and attribute information of each component of the building;
[0007] S2: performing image-based indirect segmentation on the target scene point cloud to separate the building point cloud of the target scene, and performing filtering on the generated building point cloud to remove erroneous segmentation points and outliers;
[0008] S3: Use the connected domain algorithm to perform monomer operation on the building point cloud cluster and segment the single building contained in the point cloud cluster;
[0009] S4: Extract the characteristic parameters of the point cloud of a single building, segment the point cloud through the region growing algorithm to obtain the plane point cloud of each component, and extract the overall parameters of the building point cloud and the common and individual parameters of each component, which are called the first characteristic parameters;
[0010] S5: acquiring a component template that meets preset conditions by matching the first characteristic parameter with a template file in the model library, and instantiating and editing the acquired component template according to the acquired first characteristic parameter;
[0011] S6: assembling the instantiated edited components, and checking the position, size relationship and combination rule, and generating an instantiated model of the building after the verification;
[0012] S7: Obtain the two-dimensional original landscape image and point cloud projection image corresponding to each component through the correspondence between the plane point cloud of each component and the original oblique photography image obtained by shooting, and generate the surface map of each component through image fusion, which is called generated map;
[0013] S8: UV unfolding the building instance model, and generating a texture map of the entire building according to the correspondence between each face of the building model and each face of the generated map, achieving the correspondence between the map and the model, and outputting the final textured building instance 3D model.
[0014] Furthermore, the process of constructing the object model template database in step S1 is as follows:
[0015] S1-1: Set the standard structure of the template file, including template identification, attribute set, object set and rule set, and the storage format is OSGB, OBJ, FBX;
[0016] S1-2: Decompose the building into five components: roof, floor, column, beam, foundation, and other components. Create corresponding template models for storage. Divide each component into universal and distinguishing main features and secondary features. Use the features as step-by-step retrieval information to store and read the template files.
[0017] S1-3: After completing the modeling of all components of the building, design the overall storage structure of the template library, store the template files and extended data in layers, and use the extended type parameters, shape parameters and various feature data as indexes to retrieve and read different types of terrain model template files to improve search efficiency. Establish a building model template database, which includes five sub-tables: roof, building, foundation, column beam, and others. Each table stores the feature parameters of various components and the template file storage path in layers. By searching through the selected feature parameters, you can quickly obtain the target template.
[0018] Furthermore, in step S2, the target scene point cloud is indirectly segmented based on an image, the building point cloud is separated, and the generated building point cloud is filtered to remove the erroneous segmentation points and outliers. The algorithm flow is as follows:
[0019] S2-1: Build a neural network to perform semantic segmentation on landscape images and identify building areas contained in the images;
[0020] S2-2: Ignore the influence of the Z axis in the three-dimensional scene point cloud, project the point cloud to the XOY coordinate plane, and obtain a two-dimensional projection image of the point cloud;
[0021] S2-3: Use the trained semantic segmentation network to segment the point cloud projection image, identify the building part, project the 2D recognition result to the 3D point cloud, and segment the 3D building point cloud by the correspondence of the geometric dimensions of the two.
[0022] S2-4: Use an outlier filter to filter the building point cloud, calculate the average distance d from each point in the input point cloud to all points in its k-neighborhood, and obtain an array containing the average neighborhood distances of all points, where it is assumed that the array conforms to a Gaussian distribution and a preset threshold range is set. The d values that are not within the threshold range are allowed to be judged as belonging to the outlier point set, and the points in the outlier point set are allowed to be deleted.
[0023] So far, the building point cloud cluster has been calculated for subsequent feature extraction and building model instantiation process.
[0024] Furthermore, in step S3, the connected domain algorithm is used to perform a monomer operation on the building point cloud cluster to segment the single building contained in the point cloud cluster. The algorithm flow is as follows:
[0025] S3-1: Binarize the semantic segmentation image, mark the part identified as a building, and perform connected domain detection. Use the secondary scanning method to traverse and read the image twice. The first time, for the non-zero pixels in the image, assign a digital label to each non-zero point. If the pixels in the neighborhood to the left and above a pixel already have a label value, take the smaller value of the two labels as the digital label of the current pixel, otherwise assign a new label value. In the first traversal, the same pixel may have multiple different digital labels, so a second traversal is required to merge the digital labels belonging to the same connected domain so that the pixels in the same connected domain have the same digital label. The eight adjacent points of the target point in the horizontal, vertical and diagonal directions are used as the neighborhood to detect each point in the image, realize the detection and judgment of the connected domain, and mark the identified different connected areas with different pixel values;
[0026] S3-2: Segment the building according to the filtered image to achieve coordinate correspondence between the two-dimensional label image and the three-dimensional building point cloud, traverse the different pixel values in the label image, judge and classify the point cloud point by point, and divide the point cloud clusters belonging to the same connected domain into the same building, so as to achieve the individualization of the building point cloud and obtain relatively independent point cloud data of a single building.
[0027] At this point, multiple buildings in the same building point cloud cluster are separated, which facilitates the subsequent component segmentation, identification and feature information extraction of each building.
[0028] Furthermore, in step S4, the characteristic parameters of the point cloud of a single building are extracted, the point cloud is segmented by a region growing algorithm to obtain the plane point cloud of each component, and the specific algorithm flow for extracting the overall parameters of the point cloud of the building and the common and individual parameters of each component is as follows:
[0029] S4-1: First, the overall parameters of the building are obtained for the correct placement of the subsequent building model in the 3D landscape scene. The coordinates of the 3D building point cloud and the maximum and minimum values xmax, xmin, ymax, ymin, zmax, zmin of the point cloud outer bounding box in the X, Y, and Z coordinate axis directions are read respectively;
[0030] S4-2: Use a region growing-based algorithm to disassemble the components contained in the building, classify points with similar properties in the point cloud through neighborhood information, and divide the point cloud into different regions with certain differences in some aspects. Use curvature as the main basis for distinguishing different building point cloud components to segment the building point cloud and obtain the surface of each component;
[0031] S4-3: By performing plane fitting on the segmented components and calculating the aspect ratio, curvature, and normal information to identify the component types, the segmented components are further divided into roofs, foundations, buildings, columns, beams, and others;
[0032] S4-4: After the building components are disassembled and identified, the feature information corresponding to different components is extracted by category. First, the common information of each component is extracted, including the point cloud size, position and size for screening effective components;
[0033] S4-5: Project the decomposed plane point clouds of each building component from the world coordinate system of the three-dimensional scene to the pixel coordinate system of the two-dimensional image, obtain the corresponding area of the building component point cloud in the original landscape image, and obtain the actual boundary points by calculating the convex hull of the point cloud, calculate the minimum matrix bounding box corresponding to the point cloud in the image, obtain the minimum matrix area corresponding to the image, crop the area and rotate it to be parallel to the X and Y coordinate axes, so as to obtain the original landscape image corresponding to each point cloud plane;
[0034] S4-6: Processing is performed according to the type of components, and individual feature information including the type of each component is obtained by combining the point cloud of each component and the original landscape image corresponding to the point cloud.
[0035] Furthermore, in step S5, the component template that meets the preset conditions is obtained by matching the first characteristic parameter with the template file in the model library, and the specific algorithm flow of instantiating and editing the obtained component template according to the obtained first characteristic parameter is as follows:
[0036] S5-1: For each category of components, search according to the main features and secondary features step by step, and match the corresponding template file from the building template database;
[0037] S5-2: Instantiate and edit the template file according to the acquired position, size, and tilt angle parameters to obtain instance models of each building component.
[0038] Furthermore, in step S6, the instantiated edited components are assembled, and the position, size relationship and combination rule are checked. The specific algorithm flow of generating the instantiated model of the building after the check is as follows:
[0039] S6-1: Assemble the template files instantiated according to the coordinates and sizes of the actual building components to obtain an initial building instance model;
[0040] S6-2: Calibrate the size and position of the building model. Based on the three-dimensional coordinates and geometric dimensions of the foundation, calibrate the geometric position and size of the building components from bottom to top to achieve seamless connection in the three directions of X, Y, and Z. If there is a size conflict, adjust it according to the priority of the Z axis from bottom to top;
[0041] S6-3: Calibrate the combination and nesting relationship of each component of the building model. When calling each ground feature component, check the modeling rules to confirm that the combination and nesting rules between components are met;
[0042] S6-4: After completing the size, position adjustment and combination relationship verification, the building components are merged and output as an instantiated model.
[0043] Furthermore, in step S7, the corresponding relationship between the plane point cloud of each component and the original oblique photography image is used to obtain the two-dimensional original shooting image and the point cloud projection image corresponding to each component, and the specific algorithm flow of generating the surface map of each component by image fusion is as follows:
[0044] S7-1: The original oblique photographic images corresponding to the plane point clouds of each component can be obtained by step S4, and the images are screened to obtain images whose sizes and rotation angles are within a given threshold;
[0045] S7-2: Solve the rotation matrix by the normal vector to transform the point cloud to be parallel to the XOY coordinate plane;
[0046] S7-3: Calculate the longest side of the fitting surface of the point cloud component, and use it as a reference to rotate the point cloud so that the longest side is parallel to the Y axis;
[0047] S7-4: Sample the Z value to generate a projection image of the transformed point cloud on the XOY plane;
[0048] S7-5: Feature point matching and image fusion are performed on the original landscape image corresponding to the point cloud and the projection image to generate a surface texture image of each component with a more complete coverage.
[0049] Furthermore, in step S8, the building instance model is UV-unwrapped, and a texture map of the entire building is generated according to the correspondence between each face of the building model and each face of the generated map, so as to achieve the correspondence between the map and the model, and output the final textured building instance 3D model. The specific algorithm flow is as follows:
[0050] S8-1: Perform UV expansion on the building instance model to generate a corresponding UV expansion diagram;
[0051] S8-2: Using the 3D building point cloud as the intermediate data, the correspondence between each surface in the UV image and the generated map is realized, and the textures of each surface of the building are merged into a complete building UV image through the OPENCV image processing library;
[0052] S8-3: Edit the building instance model, realize the correspondence between the UV image and the building instance model, generate the building model containing the texture image, and output the complete building instance model.
[0053] The present invention provides a method for instantiating a building template based on point cloud data, which can quickly generate a complete three-dimensional building model. Compared with the traditional method for constructing a building model based on point cloud, the present invention has the following advantages:
[0054] (1) Automation: The algorithm can automatically extract point cloud features, solve them, and match them to model templates, and finally integrate them into a building instance model and complete the verification work without manual operation;
[0055] (2) Completeness: Through template model instantiation modeling, the problems of holes, damage, deformation, information loss, etc. existing in traditional modeling methods are solved, and a complete building model can be obtained while ensuring a high degree of similarity;
[0056] (3) Speed: Template instantiation modeling is faster than the traditional modeling method that generates a three-dimensional model from point cloud data through mesh construction, triangulation and other solving processes. It can achieve real-time modeling effects and support the rapid construction of large-scale scene building complex models. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. By referring to the drawings, the features and advantages of the present invention will be more clearly understood. The drawings are schematic and should not be understood as limiting the present invention in any way. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0058] Figure 1 A flow chart of a method for instantiating building templates based on point cloud data provided by an embodiment of the present invention;
[0059] Figure 2 Model template framework for building components;
[0060] Figure 3 It is the roof component library structure;
[0061] Figure 4 This is an example of a complete 3D point cloud for the scene;
[0062] Figure 5 Example of building point cloud clusters obtained for semantic segmentation of scene point clouds;
[0063] Figure 6 This is an example of the effect after filtering the building point cloud;
[0064] Figure 7 This is the effect diagram of connected domain detection for building area semantic labels;
[0065] Figure 8 This is an illustration of the result after singulation of the building point cloud cluster;
[0066] Fig. 9 The basic process for determining component categories;
[0067] Fig.10 To obtain the geometric relationship diagram of the minimum matrix bounding box of the point cloud plane;
[0068] Fig.11 Generate methods for model instances;
[0069] Fig.12 (a) is the original 3D building point cloud, and (b) is the generated building instance model.
[0070] Fig.13 Algorithm flow for generating texture maps for building models;
[0071] Fig.14 (a) is the UV unfolded image of the building model, and (b) is the texture image generated after texture matching of the UV unfolded image;
[0072] Fig.15 An example model of a building is shown below. DETAILED DESCRIPTION
[0073] In order to make the technical solution of the present invention clearer, the present invention is further described below in conjunction with the accompanying drawings. Figure 1 shown.
[0074] In the process of constructing a three-dimensional model of a target scene building, the present invention extracts features from a generated three-dimensional point cloud, and instantiates and edits a constructed building template file based on the acquired feature information to generate a three-dimensional model of the building.
[0075] The method proposed in the present invention can accelerate the speed of model construction while ensuring a high degree of similarity with the buildings in the real landscape, while improving the problems of damage, voids, distortion and deformation of the building model caused by the lack of point cloud information, which is conducive to the rapid and complete construction of building models in large-scale scenes.
[0076] Specifically, a building template instantiation modeling method based on point cloud data comprises the following steps:
[0077] S1: Design a standard structure and storage format of template files of common components, disassemble the building model according to the common components, model the common categories of each component respectively, design a database storage structure of the model library, and store the template files and attribute information of each component of the building;
[0078] S2: performing image-based indirect segmentation on the target scene point cloud to separate the building point cloud of the target scene, and performing filtering on the generated building point cloud to remove erroneous segmentation points and outliers;
[0079] S3: Use the connected domain algorithm to perform monomer operation on the building point cloud cluster and segment the single building contained in the point cloud cluster;
[0080] S4: Extract the characteristic parameters of the point cloud of a single building, segment the point cloud through the region growing algorithm to obtain the plane point cloud of each component, and extract the overall parameters of the building point cloud and the common and individual parameters of each component, which are called the first characteristic parameters;
[0081] S5: acquiring a component template that meets preset conditions by matching the first characteristic parameter with a template file in the model library, and instantiating and editing the acquired component template according to the acquired first characteristic parameter;
[0082] S6: assembling the instantiated edited components, and checking the position, size relationship and combination rule, and generating an instantiated model of the building after the verification;
[0083] S7: Obtain the two-dimensional original landscape image and point cloud projection image corresponding to each component through the correspondence between the plane point cloud of each component and the original oblique photography image obtained by shooting, and generate the surface map of each component through image fusion, which is called generated map;
[0084] S8: UV unfolding the building instance model, and generating a texture map of the entire building according to the correspondence between each face of the building model and each face of the generated map, achieving the correspondence between the map and the model, and outputting the final textured building instance 3D model.
[0085] Furthermore, the process of constructing the object model template database in step S1 is as follows:
[0086] S1-1: The basic structure of the template file is set to include four parts: template identifier, attribute set, object set and rule set. The storage format is OSGB, OBJ, FBX.
[0087] S1-2: The overall building component model template structure is as follows Figure 2 As shown, the building is decomposed into five components: roof, floor, column, beam, foundation, and other components. Corresponding template models are established for storage. Each component is divided into universal and distinguishing main features and secondary features. The features are used as step-by-step retrieval information to store and read the template file.
[0088] For each type of component, for the roof, the facade shape is taken as the main feature, including three types of pitched roofs, flat roofs and curved roofs, and the top view shape of the roof is taken as the secondary feature, including top view rectangle, triangle, circle and I-shape, thus forming twelve types of roof component models, retaining the nine most commonly used types in the actual environment. The overall structure of the roof template library is as follows: Figure 3 As shown, the complex roof model in the scene is composed of these basic models spliced and combined;
[0089] The template model of the building mainly includes a cubic building template. The model construction of the building instance is completed by adjusting the size and orientation of the template and nesting and combining different buildings.
[0090] Columns and beams mainly include two categories: columns and beams. Columns include common cylindrical and prismatic types. More complex L-shaped columns and composite columns can be formed through combination and nesting. Beams mainly include rectangular beams, arched beams, curved beams and special-shaped beams, which can be used as templates to form beam structures with more diverse shapes.
[0091] The foundation includes a single-shaped foundation and a combined-shaped foundation. The single-shaped foundation is a foundation model composed of a single basic shape, and the most commonly used rectangular foundation and circular foundation are selected. The combined shape is a foundation model composed of two or more basic shapes, including an I-shaped foundation, a random-shaped foundation, and a combined-shaped foundation.
[0092] In addition, there are other components such as stairs and fences in the building, and corresponding templates are also stored for such components;
[0093] S1-3: After completing the modeling of all components of the building, design the overall storage structure of the template library, store the template files and extended data in layers, and use the extended type parameters, shape parameters and various feature data as indexes to retrieve and read different types of terrain model template files to improve search efficiency. Establish a building model template database, which includes five sub-tables: roof, building, foundation, column beam, and others. Each table stores the feature parameters of various components and the storage path of the template files in layers. By searching through the selected feature parameters, you can quickly obtain the target template.
[0094] In step S2, the target scene point cloud is indirectly segmented based on the image, the building point cloud is separated, and the generated building point cloud is filtered to remove the wrong segmentation points and outliers. The algorithm flow is as follows:
[0095] S2-1: Build a neural network to perform semantic segmentation on landscape images and identify building areas contained in the images;
[0096] S2-2: Ignore the influence of the Z axis in the three-dimensional scene point cloud, project the point cloud to the XOY coordinate plane, and obtain a two-dimensional projection image of the point cloud;
[0097] S2-3: Use the trained semantic segmentation network to segment the point cloud projection image. After identifying the building part, project the 2D recognition result to the 3D point cloud. Segment the 3D building point cloud based on the correspondence of the geometric dimensions of the two. Figure 4 For a complete 3D scene point cloud example, Figure 5 This is an example of the building point cloud obtained after segmentation;
[0098] S2-4: Use an outlier filter to filter the building point cloud, calculate the average distance d from each point in the input point cloud to all points in its k-neighborhood, and obtain an array containing the average distances of all point neighborhoods, wherein, assuming that the array conforms to the Gaussian distribution, a preset threshold range is set, and d values that are not within the threshold range are allowed to be determined as belonging to the outlier point set, and points in the outlier point set are allowed to be deleted, and the threshold value is 1.5 times the mode value of the average distance d from each point in the point cloud to the points in its k-neighborhood. Figure 6 This is an example of a building point cloud after filtering.
[0099] So far, the building point cloud cluster has been calculated for subsequent feature extraction and building model instantiation process.
[0100] Furthermore, in step S3, the connected domain algorithm is used to perform a monomer operation on the building point cloud cluster to segment the single building contained in the point cloud cluster. The algorithm flow is as follows:
[0101] S3-1: Binarize the semantic segmentation image, mark the part identified as a building, and perform connected domain detection. Use the secondary scanning method to traverse and read the image twice. The first time, for the non-zero pixels in the image, assign a digital label to each non-zero point. If the pixels in the neighborhood to the left and above a pixel already have a label value, take the smaller value of the two labels as the digital label of the current pixel, otherwise assign a new label value. In the first traversal, the same pixel may have multiple different digital labels, so a second traversal is required to merge the digital labels belonging to the same connected domain so that the pixels in the same connected domain have the same digital label. The eight adjacent points of the target point in the horizontal, vertical and diagonal directions are used as the neighborhood to detect each point in the image, realize the detection and judgment of the connected domain, and mark the identified different connected areas with different pixel values;
[0102] S3-2: Segment the building according to the filtered image to achieve coordinate correspondence between the two-dimensional label image and the three-dimensional building point cloud, traverse the different pixel values in the label image, judge and classify the point cloud point by point, and divide the point cloud clusters belonging to the same connected domain into the same building, so as to achieve the individualization of the building point cloud and obtain relatively independent point cloud data of a single building.
[0103] At this point, multiple buildings in the same building point cloud cluster are separated, which facilitates the subsequent component segmentation, identification and feature information extraction of each building.
[0104] In step S4, characteristic parameters of the point cloud of a single building are extracted, and the point cloud is segmented by a region growing algorithm to obtain the plane point cloud of each component. The specific algorithm flow for extracting the overall parameters of the point cloud of the building and the parameters of each component are as follows:
[0105] S4-1: First, the overall parameters of the building are obtained for the correct placement of the subsequent building model in the 3D landscape scene. The coordinates of the 3D building point cloud and the maximum and minimum values xmax, xmin, ymax, ymin, zmax, zmin of the point cloud outer bounding box in the X, Y, and Z coordinate axis directions are read respectively;
[0106] S4-2: Use a region growing-based algorithm to disassemble the components contained in the building, classify points with similar properties in the point cloud through neighborhood information, and divide the point cloud into different regions with certain differences in some aspects. Use curvature as the main basis for distinguishing different building point cloud components to segment the building point cloud and obtain the surface of each component;
[0107] S4-3: By performing plane fitting on the segmented components and calculating the aspect ratio, curvature, and normal information to identify the component category, the segmented components are further divided into roofs, foundations, buildings, columns and beams, and others. The specific judgment process is as follows: Fig. 9 As shown:
[0108] The calculation method of principal component analysis (PCA) is used to calculate the normal vector of the segmented building components. First, the surface fitting method is used to estimate the normal vector of the point cloud surface. The point clouds segmented by regional growth are basically plane-like point clouds with relatively smooth surfaces, and approximate planes can be easily fitted. Therefore, for each point p in the point cloud, first search for K adjacent points within the nearest neighbor range, and then use the least squares method to fit the local plane P from these points. The plane normal vector fitted by the K nearest neighbor points is used as the normal vector of the current calculation point, and the normal vector of the entire plane can be obtained by principal component analysis. For each point in the plane, the covariance matrix of the following formula is decomposed by eigenvalue to obtain the eigenvalue of the matrix M. The smallest eigenvalue corresponds to the normal vector of the plane P.
[0109]
[0110] The normal vector calculated in this way is actually only the straight line where the normal vector is located. To determine the actual direction, it is necessary to perform orientation calculation again. i、n j , if the normal vectors calculated by the two are in the same direction, then n i ·n j ≈1. If the inner product is negative, it means that the normal vector direction of one of the two points needs to be reversed. Therefore, first specify the direction of the normal vector of a point in the fitting plane, and then calculate the normal vectors of the neighboring points. If the inner product of the two is negative, flip the normal vector direction, otherwise keep the direction unchanged.
[0111] After calculating the plane normal vector, the normal vector is used for further calculation and judgment to obtain the curvature of the building component and the angle between the component plane and each coordinate axis plane. For the M matrix decomposition eigenvalue in the above formula, if the solved eigenvalue satisfies λ0≤λ1≤λ2, the surface curvature of the component plane is:
[0112]
[0113] By calculating the angle between the normal vector (x, y, z) of the building component and the unit normal vector of the XOY plane, we can get the angle between the plane and the horizontal plane. Similarly, by calculating the angle between the normal vector and other coordinate axis planes, we can get the actual orientation of the plane in space.
[0114] After obtaining the above information, further judgment can be made on the foundation, roof and building facade. The judgment process is as follows:
[0115] (1) By calculating the angle between the plane of the building component and the XOY coordinate plane and setting a reasonable threshold, the segmented building components are divided into planes, slopes, and facades;
[0116] (2) The foundation is easy to identify because it has the lowest height. We only need to obtain a plane point cloud with an upward normal vector and the surface with the smallest elevation difference with the ground in the scene is the foundation.
[0117] (3) Those that maintain a substantially perpendicular relationship with the XOY plane (the angle is within the right angle and the set acceptable deviation) are determined to be the facades that constitute the building;
[0118] (4) The plane that is inclined at an angle to the XOY plane is determined to be a component of the pitched roof;
[0119] (5) Components whose normal vectors are upward (maintaining a basically parallel relationship with the XOY plane) and are not part of the foundation are determined to be components of the flat roof.
[0120] The above method can be used to further identify the roof, building and foundation planes;
[0121] S4-4: After the building components are disassembled and identified, the feature information corresponding to different components is extracted by category. First, the common information of each component is extracted, including the point cloud size, position and size for screening effective components;
[0122] S4-5: Using the concept of point cloud convex hull, project the decomposed plane point clouds of each building component from the world coordinate system of the three-dimensional scene to the pixel coordinate system of the two-dimensional image, obtain the corresponding area of the building component point cloud in the original landscape image, and obtain the actual boundary points by calculating the point cloud convex hull, calculate the minimum matrix bounding box corresponding to the point cloud in the image, obtain the minimum matrix area corresponding to the image, crop the area and rotate it to be parallel to the X and Y coordinate axes, so as to obtain the original landscape image corresponding to each point cloud plane;
[0123] The original landscape image area corresponding to the three-dimensional point cloud computing needs to use the associated key points between images and the focal length parameters of the camera to estimate and solve the camera pose parameters corresponding to each original image, and use the association between images to convert between the world coordinate system to the camera imaging coordinate system and the image coordinate system, and finally project it to the pixel coordinate system used for image calculation. The conversion formula is as follows:
[0124]
[0125] By substituting the actual parameters of each image and camera into the above formula, the actual area corresponding to the point cloud data in different images can be obtained. The coordinate extreme value acquisition function getMinMax3D in the PCL point cloud processing library can be used to determine the extreme values of the building component point cloud in each coordinate axis direction, obtain the maximum and minimum values of the point cloud in the X and Y directions and map them to the original image, and obtain four boundary values xmax, xmin, ymax, and ymin. (xmin, ymin) is taken as the starting point of image cropping, and the difference Δx and Δy between the maximum and minimum values on the X and Y axes are used as the cropping scales in the x and y directions. The original image is cropped using the OPENCV visual library to obtain multiple original oblique photography images corresponding to the three-dimensional point cloud.
[0126] The concept of convex hull is introduced. First, the convex hull detection is performed on the decomposed plane point cloud of each building component. The actual boundary points of the point cloud are obtained by the convex hull, and the boundary points are mapped back to the original landscape image obtained by shooting by the above calculation formula. The solution process is as follows: Fig.10As shown, firstly, the quadrilateral bounding box corresponding to the component point cloud in the original image is obtained according to the minimum boundary point, and the corresponding minimum matrix bounding box is solved, and the original landscape image is cropped according to the minimum matrix bounding box to obtain the image area corresponding to the point cloud, and then the rotation center and angle are solved, and the bounding box is rotated to be parallel to the coordinate axis, thereby rotating the cropped image to obtain the original landscape image parallel to the X and Y coordinate axes. Compared with the traditional extreme value method of obtaining the original image, it can correspond to the original image area more accurately and reduce the influence of irrelevant areas in the image;
[0127] S4-6: Processing is performed according to the type of components, combining the point cloud of each component and the corresponding original landscape image to obtain individual feature information including the type of each component;
[0128] Different types of image classification and target recognition networks are built based on the original images corresponding to the point cloud to further identify the parameters of each component, including the top view types of the roof, which are I-shaped, circular, triangular and round, the cross-sectional shapes of the columns and beams, and the category parameters of other components.
[0129] Furthermore, in step S5, the component template that meets the preset conditions is obtained by matching the first characteristic parameter with the template file in the model library, and the obtained component template is instantiated and edited according to the obtained first characteristic information. The specific steps are as follows:
[0130] S5-1: For each category of components, search according to the main features and secondary features step by step, and match the corresponding template file from the building template database;
[0131] S5-2: Instantiate and edit the template file according to the acquired position, size, and tilt angle parameters to obtain instance models of each building component.
[0132] Furthermore, in step S6, the instantiated edited components are assembled, and the position, size relationship and combination rule are checked. The specific algorithm flow of generating the instantiated model of the building after the check is as follows:
[0133] S6-1: Assemble the template files instantiated according to the coordinates and sizes of the actual building components to obtain an initial building instance model;
[0134] S6-2: Calibrate the size and position of the building model. Based on the three-dimensional coordinates and geometric dimensions of the foundation, calibrate the geometric position and size of the building components from bottom to top to achieve seamless connection in the three directions of X, Y, and Z. In case of size conflict, adjust according to the priority of the Z axis from bottom to top. Bottom to top means that based on the foundation, the position and size of the building components in the negative direction of the Z axis are prioritized, and the building components in the positive direction of the Z axis are adjusted accordingly to eliminate the conflict of geometric position and size between components;
[0135] For example, if the actual size of the roof conflicts with the size of the building, resulting in a non-negligible intersection between the roof and the building, which affects the modeling effect, the vertical position of the roof (Z axis) should be appropriately translated while ensuring the normal size of the roof. The same is true for the size and position conflicts of other components. Through the calibration process, the initially assembled building model can be corrected to obtain a more reasonable and appropriate building.
[0136] S6-3: Calibrate the combination and nesting relationship of each component of the building model. When calling each ground feature component, check the modeling rules to confirm that the combination and nesting rules between components are met;
[0137] For example, the roof is usually connected to the building or other roofs, the foundation is usually the building, the vertical direction of the column is much longer than the horizontal direction, and the beam has a longer side parallel to the XOY plane. When calling each ground object component, the modeling rules need to be checked to confirm that they meet the combination and nesting rules between components. This can avoid the construction of invalid or erroneous models and improve modeling efficiency.
[0138] S6-4: After completing the size, position adjustment and combination relationship verification, the building components are merged and output as an instantiated model. Fig.12 (a) is the original 3D point cloud data of the building point cloud, which has some problems such as damage, holes, and deformation. Fig.12 (b) The building model is obtained through template instantiation modeling, which can maintain a high degree of similarity with the building point cloud while avoiding problems such as damage and holes in the model.
[0139] Furthermore, in step S7, the corresponding relationship between the plane point cloud of each component and the original oblique photography image is used to obtain the two-dimensional original shooting image and the point cloud projection image corresponding to each component, and the specific algorithm flow of generating the surface map of each component by image fusion is as follows: Fig.13 As shown, the specific steps are as follows:
[0140] S7-1: The original oblique photographic images corresponding to the plane point clouds of each component can be obtained from step S4, and the images are screened to obtain images whose sizes and rotation angles are within a given threshold;
[0141] S7-2: Solve the rotation matrix by the normal vector to transform the point cloud to be parallel to the XOY coordinate plane;
[0142] S7-3: Calculate the longest side of the fitting surface of the point cloud component, and use it as a reference to rotate the point cloud so that the longest side is parallel to the Y axis;
[0143] S7-4: Generate a projection image of the transformed point cloud on the XOY plane;
[0144] S7-5: Feature point matching and image fusion are performed on the original landscape image corresponding to the point cloud and the projection image to generate a surface texture image of each component with a more complete coverage.
[0145] Furthermore, in step S8, the building instance model is UV-unwrapped, and a texture map of the entire building is generated according to the correspondence between each face of the building model and each face of the generated map, so as to achieve the correspondence between the map and the model, and output the final textured building instance 3D model. The specific algorithm flow is as follows:
[0146] S8-1: Perform UV expansion on the building instance model to generate the corresponding UV map. Fig.14 (a) is an example of UV expansion diagram;
[0147] S8-2: Using the 3D building point cloud as the intermediate data, the correspondence between the UV image and the generated texture is achieved. The textures of each surface of the building are merged into a complete building UV image through the OPENCV image processing library. First, the position and size of each surface in the building model in the UV unfolded image are determined, and the corresponding relationship between the building model surface and the texture image is determined using the building component point cloud as the intermediate data. According to this relationship, the generated texture images of each surface are combined and spliced into the UV texture of the entire building model. The size and arrangement of each texture image are adjusted according to the structure and size of the UV texture, and the material information is given. Fig.14 (b) is the UV unfolded image after adding the texture image;
[0148] S8-3: Edit the building instance model, realize the correspondence between the UV image and the building instance model, generate the building model with texture image, and output the complete building instance model. Fig.15 The outputted textured building model instance has a high degree of similarity with the 3D point cloud data, while maintaining the advantages of integrity and speed.
Claims
1. A building template instantiation modeling method based on point cloud data, characterized in that: The method specifically comprises the following steps: S1: Design a standard structure and storage format of template files of common components, disassemble the building model according to the common components, model the common categories of each component respectively, design a database storage structure of the model library, and store the template files and attribute information of each component of the building; S2: performing image-based indirect segmentation on the target scene point cloud to separate the building point cloud of the target scene, and performing filtering on the generated building point cloud to remove erroneous segmentation points and outliers; S3: Use the connected domain algorithm to perform monomer operation on the building point cloud cluster and segment the single building contained in the point cloud cluster; S4: Extract the characteristic parameters of the point cloud of a single building, segment the point cloud through the region growing algorithm to obtain the plane point cloud of each component, and extract the overall parameters of the building point cloud and the common and individual parameters of each component, which are called the first characteristic parameters; S5: acquiring a component template that meets preset conditions by matching the first characteristic parameter with a template file in the model library, and instantiating and editing the acquired component template according to the acquired first characteristic parameter; S6: assembling the instantiated edited components, and checking the position, size relationship and combination rule, and generating an instantiated model of the building after the verification; S7: Obtain the two-dimensional original landscape image and point cloud projection image corresponding to each component through the correspondence between the plane point cloud of each component and the original oblique photography image obtained by shooting, and generate the surface map of each component through image fusion, which is called generated map; S8: UV unfolding the building instance model, and generating a texture map of the entire building according to the correspondence between each face of the building model and each face of the generated map, achieving the correspondence between the map and the model, and outputting a final textured building instance three-dimensional model; The specific process of S3 is as follows: S3-1: Binarize the semantic segmentation image, mark the part identified as a building, and perform connected domain detection. Use the secondary scanning method to traverse and read the image twice. The first time, for the non-zero pixels in the image, assign a digital label to each non-zero point. If the pixels in the neighborhood to the left and above a pixel already have a label value, take the smaller value of the two labels as the digital label of the current pixel, otherwise assign a new label value. In the first traversal, the same pixel may have multiple different digital labels, so a second traversal is required to merge the digital labels belonging to the same connected domain so that the pixels in the same connected domain have the same digital label. The eight adjacent points of the target point in the horizontal, vertical and diagonal directions are used as the neighborhood to detect each point in the image, realize the detection and judgment of the connected domain, and mark the identified different connected areas with different pixel values; S3-2: Segment the building according to the filtered image, realize the coordinate correspondence between the two-dimensional label image and the three-dimensional building point cloud, traverse the different pixel values in the label image, judge and classify the point cloud point by point, divide the point cloud clusters belonging to the same connected domain into the same building, realize the monomerization of the building point cloud, and obtain relatively independent point cloud data of a single building; The specific process of S4 is as follows: S4-1: First, the overall parameters of the building are obtained for the correct placement of the subsequent building model in the 3D landscape scene. The coordinates of the 3D building point cloud and the maximum and minimum values xmax, xmin, ymax, ymin, zmax, zmin of the point cloud outer bounding box in the X, Y, and Z coordinate axis directions are read respectively; S4-2: Use a region growing-based algorithm to disassemble the components contained in the building, classify points with similar properties in the point cloud through neighborhood information, and divide the point cloud into different regions with certain differences in some aspects. Use curvature as the main basis for distinguishing different building point cloud components to segment the building point cloud and obtain the surface of each component; S4-3: By performing plane fitting on the segmented components and calculating the aspect ratio, curvature, and normal information to identify the component categories, the segmented components are further divided into roofs, foundations, buildings, columns and beams, and others; S4-4: After completing the disassembly and identification of building components, the feature information corresponding to different components is extracted by category. First, the common information of each component is extracted, including the point cloud size, position, and size for screening effective components; S4-5: Project the decomposed plane point clouds of each building component from the world coordinate system of the three-dimensional scene to the pixel coordinate system of the two-dimensional image, obtain the corresponding area of the building component point cloud in the original landscape image, and obtain the actual boundary points by calculating the convex hull of the point cloud, calculate the minimum matrix bounding box corresponding to the point cloud in the image, obtain the minimum matrix area corresponding to the image, crop the area and rotate it to be parallel to the X and Y coordinate axes, so as to obtain the original landscape image corresponding to each point cloud plane; S4-6: Processing is performed according to the type of components, and individual feature information including the type of each component is obtained by combining the point cloud of each component and the original landscape image corresponding to the point cloud.
2. The method according to claim 1, characterized in that The specific process of S1 is as follows: S1-1: Set the standard structure of the template file, including template identification, attribute set, object set and rule set, and the storage format is OSGB, OBJ, FBX; S1-2: Decompose the building into five components: roof, floor, column, beam, foundation, and other components. Create corresponding template models for storage. Divide each component into universal and distinguishing main features and secondary features. Use the features as step-by-step retrieval information to store and read the template files. S1-3: After completing the modeling of all components of the building, design the overall storage structure of the template library, store the template files and extended data in layers, and use the extended type parameters, shape parameters and various feature data as indexes to retrieve and read different types of terrain model template files to improve search efficiency. Establish a building model template database, which includes five sub-tables: roof, building, foundation, column beam, and others. Each table stores the feature parameters of various components and the template file storage path in layers. By searching through the selected feature parameters, you can quickly obtain the target template.
3. The method according to claim 1, characterized in that The specific process of S2 is as follows: S2-1: Build a neural network to perform semantic segmentation on the landscape image and identify the building areas contained in the image; S2-2: Ignore the influence of the Z axis in the three-dimensional scene point cloud, project the point cloud to the XOY coordinate plane, and obtain a two-dimensional projection image of the point cloud; S2-3: Use the trained semantic segmentation network to segment the point cloud projection image, identify the building part, project the 2D recognition result to the 3D point cloud, and segment the 3D building point cloud by the correspondence of the geometric dimensions of the two. S2-4: Use an outlier filter to filter the building point cloud, calculate the average distance d from each point in the input point cloud to all points in its k-neighborhood, and obtain an array containing the average neighborhood distances of all points, where it is assumed that the array conforms to a Gaussian distribution and a preset threshold range is set. The d values that are not within the threshold range are allowed to be judged as belonging to the outlier point set, and the points in the outlier point set are allowed to be deleted.
4. The method according to claim 1, characterized in that: The specific process of S5 is as follows: S5-1: For each category of components, search according to the main features and secondary features step by step, and match the corresponding template file from the building template database; S5-2: Instantiate and edit the template file according to the acquired position, size, and tilt angle parameters to obtain instance models of each building component.
5. The method according to claim 1, characterized in that The specific process of S6 is as follows: S6-1: Assemble the template files instantiated according to the coordinates and sizes of the actual building components to obtain an initial building instance model; S6-2: Calibrate the size and position of the building model. Based on the three-dimensional coordinates and geometric dimensions of the foundation, calibrate the geometric position and size of the building components from bottom to top to achieve seamless connection in the three directions of X, Y, and Z. If there is a size conflict, adjust it according to the priority of the Z axis from bottom to top; S6-3: Calibrate the combination and nesting relationship of each component of the building model. When calling each ground feature component, check the modeling rules to confirm that the combination and nesting rules between components are met; S6-4: After completing the size, position adjustment and combination relationship verification, the building components are merged and output as an instantiated model.
6. The method according to claim 1, characterized in that The specific process of S7 is as follows: S7-1: The original oblique photographic images corresponding to the plane point clouds of each component can be obtained by step S4, and the images are screened to obtain images whose sizes and rotation angles are within a given threshold; S7-2: Solve the rotation matrix by the normal vector to transform the point cloud to be parallel to the XOY coordinate plane; S7-3: Calculate the longest side of the fitting surface of the point cloud component, and use it as a reference to rotate the point cloud so that the longest side is parallel to the Y axis; S7-4: Sample the Z value to generate a projection image of the transformed point cloud on the XOY plane; S7-5: Feature point matching and image fusion are performed on the original landscape image corresponding to the point cloud and the projection image to generate a surface texture image of each component with a more complete coverage.
7. The method according to claim 1, characterized in that The specific process of S8 is as follows: S8-1: Perform UV expansion on the building instance model to generate a corresponding UV expansion diagram; S8-2: Using the 3D building point cloud as the intermediate data, the correspondence between each surface in the UV image and the generated map is realized, and the textures of each surface of the building are merged into a complete building UV image through the OPENCV image processing library; S8-3: Edit the building instance model, realize the correspondence between the UV image and the building instance model, generate the building model containing the texture image, and output the complete building instance model.
