Three-dimensional reconstruction method and related device
By performing two-dimensional projection and segmentation of three-dimensional point cloud data, combined with endpoint and line segment support screening technology, the accuracy problem of indoor wall reconstruction is solved, and efficient three-dimensional model construction and door and window feature extraction of the indoor environment are achieved.
Patent Information
- Application Number
- CN202111320898.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-09
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2041-11-09
AI Technical Summary
The automated reconstruction of indoor 3D models, especially the accurate reconstruction of walls, is difficult in cluttered indoor environments, making it difficult to ensure the accuracy of wall reconstruction in the room.
By obtaining three-dimensional point cloud data and performing two-dimensional projection to form an image, perform room segmentation and point cloud segmentation, extract wall point clouds and filter out wall boundary lines based on endpoint support and line segment support to form closed polygons, and perform slicing and clustering Extract the outline points of doors and windows, and finally build an accurate three-dimensional model.
It achieves accurate reconstruction of indoor walls, improves the accuracy and detail of the 3D model, and can quickly segment rooms and extract door and window features.
Smart Images

Figure CN114219909B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of point cloud processing, and in particular to a three-dimensional reconstruction method and related devices. Background Art
[0002] Indoor 3D models play an important role in many fields, such as games, tourism, public building positioning and navigation services. At the same time, as people's requirements for product quality and experience increase, the update speed of indoor environment models and the detail level of spatial models are also increasing. Therefore, research on the automatic reconstruction of indoor models is very necessary. In addition, the development of laser scanning systems has enabled point cloud data to be widely used and become one of the main data sources for architectural modeling. Compared with two-dimensional images, three-dimensional point clouds can express the geometric details of objects and are more suitable for modeling.
[0003] The reconstruction of buildings using point clouds can be divided into reconstruction from outdoor scan data and reconstruction using indoor scan data. Compared with outdoor scenes, the reconstruction of indoor scenes is more challenging because indoor scenes are often highly cluttered, which will cause serious occlusion of the acquired point cloud data. Therefore, although the indoor 3D reconstruction method based on point clouds has developed rapidly, it is still difficult to automatically reconstruct the parametric model of the building from a cluttered indoor environment, and the accuracy of the reconstruction of the walls in the room cannot be guaranteed. Therefore, a new 3D reconstruction method is urgently needed to solve the above problems. Summary of the invention
[0004] The main technical problem solved by the present application is to provide a three-dimensional reconstruction method and related devices, which can ensure the accuracy of wall reconstruction in a room.
[0005] To solve the above technical problems, a technical solution adopted in the present application is: providing a three-dimensional reconstruction method, including: obtaining three-dimensional point cloud data containing a room to be modeled, and performing two-dimensional projection on the three-dimensional point cloud data to form a first image; performing room segmentation on the first image, and segmenting the three-dimensional point cloud data according to the room segmentation result of the first image to obtain a first point cloud of each room; wherein the first point cloud includes a wall point cloud and a ceiling point cloud; performing two-dimensional projection on a slice of the denoised wall point cloud close to the ceiling point cloud to obtain a second image; wherein the second image includes multiple wall data points; obtaining a wall boundary line from the wall data points, and obtaining a closed polygon from the wall boundary line according to the endpoint support and the line segment support; and stretching the closed polygon to obtain a three-dimensional model of the room.
[0006] The step of obtaining a wall boundary line from the wall data points and obtaining a closed polygon from the wall boundary line according to the endpoint support and the line segment support comprises: extracting straight lines for each wall data point and merging all the straight lines to obtain at least one straight line set; wherein the straight line set includes at least one straight line belonging to the same wall; intersecting the straight lines in the straight line set to obtain the wall boundary line; selecting the optimal line segment from the wall boundary line according to the endpoint support and the line segment support; wherein the endpoint support is the number of line segments with a line segment support greater than zero connected to each endpoint, and the line segment support is the product of the credibility weighted value of each inner point in the bounding box and the point cloud density of all inner points in the bounding box; deleting redundant line segments except the optimal line segment and supplementing the missing part of the optimal line segment to obtain the closed polygon; wherein the support of each endpoint of the closed polygon is two.
[0007] Wherein, before the step of selecting the optimal line segment from the wall boundary line according to the endpoint support and the line segment support, the step includes: obtaining a bounding box using the endpoints of the wall boundary line, wherein the bounding box includes at least one inner point; obtaining the ratio between a first distance between the inner point and the wall boundary line and a first threshold, a difference between one and the ratio, and obtaining the product between the difference and the covariance matrix of the inner point, and taking the sum of the products of all the inner points in the bounding box as the credibility weighted value; wherein, the first distance is less than or equal to the first threshold.
[0008] Among them, before the step of two-dimensionally projecting the slice of the denoised wall point cloud close to the ceiling point cloud to obtain the second image, it includes: segmenting the first point cloud of the room to obtain the wall point cloud in each of the rooms; angularly slicing the wall point cloud according to a preset angle interval to obtain the second distance between the wall point cloud and the center point of all the first point clouds in each of the rooms; distance slicing the wall point cloud according to the second distance and the preset distance interval; and using the number of wall point clouds after double slicing to remove sparse noise points and point clouds representing horizontal planes in each of the rooms.
[0009] Wherein, after the step of stretching the closed polygon to obtain the three-dimensional model of the room, the method includes: extracting a second point cloud in the three-dimensional model; wherein the second point cloud belongs to a wall in the three-dimensional model; dividing the second point cloud according to the height information of the three-dimensional model to obtain at least one horizontal slice, and dividing the second point cloud according to the horizontal angle of the point to obtain at least one vertical slice; using the horizontal slice to extract a first contour point in a first direction perpendicular to the ground, and using the vertical slice to extract a second contour point in a second direction horizontal to the ground; clustering the first contour point and the second contour point to obtain at least one door and window contour point, and projecting the door and window contour point onto the corresponding wall in the three-dimensional model.
[0010] Among them, the step of using the horizontal slice to extract the first contour point in the first direction perpendicular to the ground includes: sorting the wall point cloud in the horizontal slice according to the horizontal angle of the second point cloud in the horizontal slice, and obtaining the third distance between the wall point cloud in the horizontal slice and its adjacent wall point cloud; in response to the third distance satisfying the second threshold, taking the adjacent second point cloud as the first contour point; the step of using the vertical slice to extract the second contour point in the second direction horizontal to the ground includes: sorting the wall point cloud in the vertical slice according to the height value of the second point cloud in the vertical slice, and obtaining the fourth distance between the wall point cloud in the vertical slice and its adjacent wall point cloud; in response to the fourth distance satisfying the third threshold, taking the adjacent second point cloud as the second contour point.
[0011] Among them, after the step of clustering the first contour points and the second contour points to obtain at least one door and window contour point, and projecting the door and window contour point onto the corresponding wall in the three-dimensional model, the method includes: sorting the first contour points and the second contour points according to the direction of the wall, and obtaining the head contour point and the tail contour point according to the sorting result; sorting the first contour points and the second contour points according to the height value, and obtaining the highest contour point and the lowest contour point according to the sorting result; performing initial fitting on the head contour point, the tail contour point, the highest contour point and the lowest contour point to obtain an initial enclosing rectangle; using the four sides of the initial enclosing rectangle to extract the door and window contour points close to each side, and performing secondary fitting on each side using a random sampling consistency algorithm; in response to the figure after the secondary fitting being a quadrilateral, outputting the initial enclosing rectangle.
[0012] Among them, the step of performing room segmentation on the first image and segmenting the three-dimensional point cloud data according to the room segmentation result of the first image to obtain the first point cloud of each room includes: binarizing the first image to obtain the gaps between each of the rooms, and using an edge extraction algorithm to obtain the edges of the gaps; using image dilation and image closing operations to refine the edges; performing Hough transform on the edges to obtain line segments corresponding to the edges, and optimizing the line segments to merge straight lines belonging to the same wall boundary; performing image subtraction operation on the widened line segments and the first image to obtain a third image; wherein the third image includes the room and the wall boundary line; segmenting the room according to the wall boundary line, and separating the first point clouds corresponding to each of the rooms.
[0013] Among them, before the step of segmenting the room according to the wall boundary line and separating the first point clouds corresponding to each of the rooms, it also includes: in response to the presence of noise points in the third image, the noise points are removed and the step of segmenting the room according to the wall boundary line and separating the first point clouds corresponding to each of the rooms is entered.
[0014] Wherein, before the step of performing two-dimensional projection on the three-dimensional point cloud data to form a first image, the step includes: preprocessing the three-dimensional point cloud data.
[0015] To solve the above technical problems, another technical solution adopted in the present application is: to provide a three-dimensional reconstruction system, including a memory and a processor coupled to each other, the memory storing program instructions, and the processor being used to execute the program instructions to implement the three-dimensional reconstruction method mentioned in any of the above embodiments.
[0016] In order to solve the above technical problems, another technical solution adopted in the present application is: providing a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is used to implement the three-dimensional reconstruction method mentioned in any of the above embodiments.
[0017] Different from the prior art, the beneficial effects of the present application are as follows: the 3D reconstruction method provided by the present application includes: obtaining 3D point cloud data containing the room to be modeled, performing 2D projection on the 3D point cloud data to form a first image; performing room segmentation on the first image, and segmenting the 3D point cloud data according to the room segmentation result of the first image to obtain the first point cloud of each room; wherein the first point cloud includes the wall point cloud; performing 2D projection on the slice of the denoised wall point cloud close to the ceiling point cloud to obtain the second image; wherein the second image includes a plurality of wall data points; obtaining the wall boundary line from the wall data points, and obtaining a closed polygon from the wall boundary line according to the endpoint support and the line segment support; and stretching the closed polygon to obtain the 3D model of the room. By such a design method, the accuracy of the wall reconstruction can be guaranteed, thereby obtaining a more accurate 3D reconstruction model of the room. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0019] Figure 1 It is the overall flow chart of the three-dimensional reconstruction method of the present application;
[0020] Figure 2 It is a flowchart of an implementation method of the three-dimensional reconstruction method of the present application;
[0021] Figure 3 is the density histogram of the ceiling-floor segmentation;
[0022] Figure 4 This is a rendering of the room division process;
[0023] Figure 5 yes Figure 2 A schematic flow chart of an implementation method of step S2 in FIG.
[0024] Figure 6 It is a rendering of the room reconstruction process;
[0025] Figure 7 yes Figure 2 A schematic diagram of a flow chart of an implementation method before step S3;
[0026] Figure 8 This is the principle diagram of double slice denoising;
[0027] Fig. 9 yes Figure 2 A schematic flow chart of an implementation method of step S4 in FIG.
[0028] Fig.10 This is the rendering of the door and window extraction process;
[0029] Fig.11 It is a schematic diagram of vertical slices;
[0030] Fig.12 yes Figure 2 A schematic diagram of a flow chart of an implementation method after step S9;
[0031] Fig.13 It is a structural schematic diagram of an implementation method of the three-dimensional reconstruction system of the present application;
[0032] Fig.14 It is a schematic diagram of a framework of an implementation method of a three-dimensional reconstruction system of the present application;
[0033] Fig.15 It is a schematic diagram of a framework of an implementation scheme of a computer-readable storage medium of the present application. DETAILED DESCRIPTION
[0034] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0035] For the reconstruction of indoor buildings, the 3D point cloud data of the room obtained from the room is reconstructed into a regularized and parameterized building model. The main conditions for this application to be effective for typical indoor environments are: the ceiling and floor are flat and parallel structures connected by vertical walls, and different rooms and corridors are connected by narrow passages such as doorways. Please refer to Figure 1 , Figure 1 This is the overall flow chart of the 3D reconstruction method of this application. Figure 1 As shown, the main process of the 3D reconstruction method in the present application is to first use a morphological algorithm to automatically segment the room using the preprocessed 3D point cloud data, then reconstruct the segmented room into a parameterized geometric model using a new line segment selection strategy, and finally use horizontal and vertical slices and adjacent point distance thresholds to extract doors and windows and optimize them.
[0036] See also Figure 2 , Figure 2 1 is a flow chart of an embodiment of a three-dimensional reconstruction method of the present application. The three-dimensional reconstruction method comprises:
[0037] S1: Obtain three-dimensional point cloud data containing a room to be modeled, and perform two-dimensional projection on the three-dimensional point cloud data to form a first image.
[0038] Specifically, in this embodiment, please refer to Figure 2-Figure 4 , Figure 3 is the density histogram of the ceiling-floor segmentation, Figure 4 It is a rendering of the room segmentation process. Before the step of two-dimensionally projecting the three-dimensional point cloud data to form a first image in step S1, the step includes: preprocessing the three-dimensional point cloud data. In this embodiment, the preprocessing step may be: first downsampling the three-dimensional point cloud data, and then using a morphological algorithm to remove noise outside the building. Specifically, in this embodiment, a voxelized grid method may be used for downsampling, and the size of the voxelized grid may be set to V. Of course, in other embodiments, other methods may be used for downsampling, which is not limited here. In addition, ceiling extraction is to slice the original three-dimensional point cloud data with a certain thickness on the z-axis and calculate a histogram based on the number of points in each slice, that is, Figure 3 The density histogram of the ceiling and floor segmentation shown in the figure is used to find the height information with the largest number of points, that is, the ceiling or the floor, and then the height information is used to determine the ceiling. Figure 4 As shown, the three-dimensional point cloud data that has been pre-processed is binary mapped to a two-dimensional space to form a first image ( Figure 4 a).
[0039] S2: performing room segmentation on the first image, and segmenting the three-dimensional point cloud data according to the room segmentation result of the first image to obtain a first point cloud of each room.
[0040] Specifically, the first point cloud includes a wall point cloud.
[0041] Specifically, in this embodiment, please refer to Figure 4 and Figure 5 , Figure 5 yes Figure 2 Schematic diagram of a flow chart of an implementation method of step S2 in FIG. Specifically, step S2 includes:
[0042] S20: Binarizing the first image to obtain the gaps between the rooms, and using an edge extraction algorithm to obtain the edges of the gaps.
[0043] Specifically, if Figure 4 As shown in b, the first image ( Figure 4 a) Perform binarization to highlight the gaps between rooms, and then use the edge extraction algorithm to extract the edges of the room gaps ( Figure 4 c).
[0044] S21: Use image dilation and image closing operations to refine the edges.
[0045] Specifically, if Figure 4 d and Figure 4As shown in e, image expansion and image closing operations are used to Figure 4 The edge refinement in c uses the method of dilation followed by erosion to eliminate small black spots (noise) in the image area.
[0046] S22: Performing Hough transform on the edge to obtain the line segment corresponding to the edge, and optimizing the line segment to merge the straight lines belonging to the same wall boundary.
[0047] Specifically, if Figure 4 As shown in f, the edge ( Figure 4 e) Performing Hough transform to parameterize each edge into a corresponding line segment. Figure 4 g, for Figure 4 The line segments obtained in f are optimized to merge lines belonging to the same wall boundary (i.e., disconnecting the connections between rooms).
[0048] S23: performing an image subtraction operation on the widened line segment and the first image to obtain a third image.
[0049] Specifically, if Figure 4 h, the widened line segment ( Figure 4 g) and the first image ( Figure 4 a) Perform image subtraction to obtain a third image. In this embodiment, the third image includes the room and the wall boundary line.
[0050] S24: Segment the room according to the wall boundary line, and separate the first point cloud corresponding to each room.
[0051] Specifically, the watershed algorithm is used to segment the rooms in the third image, such as Figure 4 As shown in k, in this embodiment, the room may be segmented according to the wall boundary lines in the third image, and the segmentation method is not limited here. Figure 4 As shown in Figure 1, the first point cloud corresponding to each room is segmented.
[0052] Through this design, the morphological processing method used in this application can quickly segment the room. To address the problem of over-segmentation or under-segmentation, this application uses edge detection, Hough transform and optimization algorithm combined with morphological operations to disconnect the connections between rooms, and then uses the watershed segmentation algorithm to segment the room. This method can accurately and quickly segment the room.
[0053] Optionally, in this embodiment, in order to make the reconstructed room model more accurate, Figure 4 i and Figure 4As shown in j, before step S24, it also includes: determining whether there are noise points in the third image; if so, removing the noise points and entering step S24; otherwise, directly entering step S24.
[0054] S3: Perform two-dimensional projection on the slice of the denoised wall point cloud close to the ceiling point cloud to obtain a second image.
[0055] Specifically, the second image includes a plurality of wall data points. Specifically, in this embodiment, after the room segmentation is completed, the room reconstruction step is entered. Figure 6 , Figure 6 This is the rendering of the room reconstruction process. The wall point cloud after double slicing denoising ( Figure 6 c) Take a slice of the point cloud close to the ceiling at a preset distance downward and project it two-dimensionally onto the XY plane to obtain the second image ( Figure 6 d), Slicing can reduce the amount of point cloud data that needs to be processed and thus save a lot of time.
[0056] Preferably, in this embodiment, please refer to Figure 6-Figure 8 , Figure 7 yes Figure 2 A schematic diagram of a flow chart of an implementation method before step S3, Figure 8 This is a schematic diagram of the dual-slice denoising principle. The steps before step S3 specifically include:
[0057] S30: Segment the first point cloud of the room to obtain wall point clouds in each room.
[0058] Specifically, in addition to the wall point cloud, the first point cloud also includes the ceiling point cloud and the floor point cloud. However, a line-based method is used for each room to solve the room reconstruction problem. Therefore, the ceiling point cloud and the floor point cloud are not needed for the reconstruction of the wall, so it can be used. Figure 3 The point cloud density histogram in is used to segment the ceiling point cloud and the floor point cloud while retaining the wall point cloud in each room, such as Figure 6 a and Figure 6 As shown in b.
[0059] S31: Slicing the wall point cloud according to a preset angle interval to obtain a second distance between the wall point cloud and the center point of all the first point clouds in each room.
[0060] S32: Slicing the wall point cloud according to the second distance and the preset distance interval.
[0061] Specifically, after separating the ceiling and floor, indoor denoising is performed ( Figure 6 c) process. Figure 8 As shown in a, Figure 8a is the principle of double slicing. The center point of all the first point clouds in each room is set as the origin. First, the points are spaced at a preset angle S. θ Slice the wall point cloud to get G thea ={group thea1 , group thea2 ,……group theam}, where group thea1 represents a slice after slicing with thea1, G thea Represents the set of all slices, and then calculates the second distance P between the data points in each slice and the origin ij,dis , the second distance P ij,dis At a preset distance S d The wall point cloud is sliced. The above steps S31-S32 are steps for double slicing of the wall point cloud.
[0062] S33: The number of wall point clouds after double slicing is used to remove sparse noise points in each room and point clouds representing horizontal planes.
[0063] Specifically, Figure 8 b is the wall point cloud after double slicing. The sparse indoor noise points and the point cloud representing the indoor horizontal plane structure are removed by denoising the number of points in the slice, and the wall point cloud after noise removal is obtained ( Figure 8 c). In view of the vast majority of indoor occlusions and noises that affect room reconstruction, this application uses a double slicing method to resolve the noises caused by occlusions of objects perpendicular to the walls that affect room reconstruction.
[0064] S4: Obtain a wall boundary line from the wall data points, and obtain a closed polygon from the wall boundary line according to the endpoint support and the line segment support.
[0065] Specifically, in this embodiment, please refer to Figure 6 and Fig. 9 , Fig. 9 yes Figure 2 Schematic diagram of a flow chart of an implementation method of step S4 in FIG. Specifically, step S4 includes:
[0066] S40: extracting straight lines for each wall data point, and merging all straight lines to obtain at least one straight line set.
[0067] Specifically, the straight line set includes at least one straight line belonging to the same wall. Figure 6 As shown in FIG. 5 , the random sampling consensus algorithm (RANSAC) is used to extract and optimize straight lines from the projected wall data points to merge straight lines that approximately belong to the same wall.
[0068] S41: Obtain the wall boundary line by intersecting the straight lines in the straight line set.
[0069] Specifically, if Figure 6 As shown in f, all the above straight lines are intersected to obtain a line segment, which is the wall boundary line.
[0070] S42: Filter out the optimal line segment from the wall boundary line according to the endpoint support and the line segment support.
[0071] In this embodiment, if Figure 6 As shown in Figure g, the optimal line segment is selected from the wall boundary line using the line segment selection principle. The above line segment selection principle is divided into preliminary selection, reselection and line segment selection. The basis of preliminary selection and reselection is the endpoint support and line segment support Support, two parameters for evaluating the importance of line segments. Specifically, the endpoint support is the number of line segments connected by each endpoint whose line segment support Support is greater than zero. The line segment support Support is the product of the confidence weighted value confidence of each inner point in the bounding box and the point cloud density density of all inner points in the bounding box, that is: Support = confidence*density.
[0072] S43: Delete the redundant line segments except the optimal line segment and fill the missing part of the optimal line segment to obtain a closed polygon.
[0073] Specifically, the support degree of each endpoint of the closed polygon is 2. In this embodiment, after the optimal line segment is selected from the wall boundary line, the redundant line segments other than the optimal line segment are gradually deleted, and the missing part of the optimal line segment is supplemented, and finally a closed polygon with a support degree of each endpoint of 2 is obtained. In this way, the accuracy of the reconstruction of the walls in the room can be guaranteed, thereby obtaining relatively accurate 3D model data.
[0074] Specifically, in this embodiment, the steps before step S4 include: 1. Obtaining a bounding box using the endpoints of the wall boundary line. The method of obtaining the bounding box here is consistent with the existing method and will not be repeated here. Specifically, the bounding box includes at least one inner point P. 2. Obtaining a first distance dist(p,L) between the inner point P and the wall boundary line segi ) and the first threshold ε, the difference between one and the ratio, and obtain the product between the difference and the confidence term conf(P) of the inner point P, and the sum of the products of all the inner points P in the bounding box is used as the confidence weighted value confidence. The calculation formula of the confidence weighted value confidence is:
[0075]
[0076] Specifically, the first distance dist(p,Lsegi ) is less than or equal to the first threshold ε. In this formula, |P| is the total number of wall data points in the bounding box, point P is a point in the bounding box, dist(p,L segi ) is the distance from each point to the line segment L segi The distance between the point and the line segment L is allowed. segi In this embodiment, the preset length is taken as the distance from the points on both sides of the bounding box to the line segment, which can be a value such as 0.03, which is not limited here. In addition, point P satisfies dist(p,L segi )<ε. The confidence term conf(P) measures the local quality of the wall data point at point p. It is defined by calculating the local covariance matrix defined at p. In this work, we calculated the covariance matrix of p through the local neighborhood of p at three static scales (i.e., different neighborhood sizes). Then the confidence term conf(P) is defined as:
[0077] Among them, λ is the eigenvalue.
[0078] S5: Stretch the closed polygon to obtain a three-dimensional model of the room.
[0079] Specifically, after the closed polygon is obtained in the above step S43, the closed polygon is stretched into a three-dimensional model using the segmented ceiling height and floor height, and the three-dimensional model is the room reconstruction model.
[0080] Through this design method, based on the Manhattan principle, the wall slices perpendicular to the ground and ceiling are used to fit the line segments, and the new line segment optimization and selection strategies are used to reconstruct the walls. Slicing can reduce the amount of point cloud data that needs to be processed, thereby greatly saving time. At the same time, the line segment optimization and selection strategies ensure the accuracy of the wall reconstruction in the room, so that more accurate three-dimensional model data can be obtained.
[0081] Further, in this embodiment, after obtaining the 3D model, the doors and windows are reconstructed using the point cloud slices and the differences between the horizontal distances and vertical distances between adjacent points. Figure 2 and Fig.10 , Fig.10 It is a rendering of the door and window extraction process. Specifically, after step S5, it also includes:
[0082] S6: extracting a second point cloud in the three-dimensional model.
[0083] Specifically, the second point cloud belongs to the wall in the 3D model. Fig.10 As shown in a, the second point cloud of the walls belonging to each room in the three-dimensional model is extracted.
[0084] S7: Divide the second point cloud according to the height information of the three-dimensional model to obtain at least one horizontal slice, and divide the second point cloud according to the horizontal angle of the point to obtain at least one vertical slice.
[0085] Specifically, in this embodiment, Fig.10 As shown in FIG. 2 , the horizontal slices are divided according to the z coordinate, that is, according to the height of the room wall. Fig.10 c and Fig.11 , Fig.11 This is the principle diagram of vertical slicing. Vertical slicing is divided according to the horizontal angle of the point. Fig.11 As shown in a, a perpendicular line is drawn to CD, and a point A on the perpendicular line is taken so that AB = CD. CD is divided into slices according to an angle threshold (for example, θ), as shown in Fig.11 As shown in b.
[0086] S8: Use horizontal slices to extract first contour points in a first direction perpendicular to the ground, and use vertical slices to extract second contour points in a second direction horizontal to the ground.
[0087] Preferably, in this embodiment, if Fig.10 As shown in FIG. d, the step of extracting the first contour point in the first direction perpendicular to the ground using the horizontal slice in step S8 may include: 1. Sort the wall point cloud in the horizontal slice according to the horizontal angle of the second point cloud in the horizontal slice, and obtain the third distance between the wall point cloud in the horizontal slice and its adjacent wall point cloud; 2. Determine whether the third distance meets the second threshold; 3. If so, take the adjacent second point cloud as the first contour point; 4. Otherwise, return to the step of determining whether the third distance meets the second threshold. This determination process ends until the wall point cloud in the last horizontal slice.
[0088] Preferably, in this embodiment, if Fig.10 d, the step of extracting the second contour point in the second direction horizontal to the ground using the vertical slice in step S8 may include: 1. Sort the wall point cloud in the vertical slice according to the height value of the second point cloud in the vertical slice, and obtain the fourth distance between the wall point cloud in the vertical slice and its adjacent wall point cloud; 2. Determine whether the fourth distance meets the third threshold; 3. If so, take the adjacent second point cloud as the second contour point; 4. Otherwise, return to the step of determining whether the fourth distance meets the third threshold. This determination process ends until the wall point cloud in the last vertical slice.
[0089] S9: Clustering the first contour point and the second contour point to obtain at least one door and window contour point, and projecting the door and window contour point onto a corresponding wall in the three-dimensional model.
[0090] Specifically, if Fig.10 As shown in FIG. 5 , all the extracted first contour points and second contour points are classified into different door and window contour points using Euclidean distance clustering, and are projected onto the corresponding walls in the three-dimensional model.
[0091] like Fig.10 f, parameterize the door and window contour points obtained in step S9, that is, convert the points into lines. Fig.10 and Fig.12 , Fig.12 yes Figure 2 Schematic diagram of a flow chart of an implementation method after step S9. Specifically, the process after step S9 includes:
[0092] S50: Sort the first contour point and the second contour point according to the direction of the wall, and obtain the head contour point and the tail contour point according to the sorting result.
[0093] Specifically, all the first contour points and the second contour points are removed from their height information and sorted according to the direction of the wall, and the head contour point and the tail contour point are obtained according to the sorting result.
[0094] S51: Sort the first contour point and the second contour point according to the height values, and obtain the highest contour point and the lowest contour point according to the sorting result.
[0095] Specifically, all the first contour points and the second contour points are sorted according to the height information, and the highest contour point and the lowest contour point are obtained according to the sorting result;
[0096] S52: Performing initial fitting on the head contour point, the tail contour point, the highest contour point and the lowest contour point to obtain an initial enclosing rectangle.
[0097] Specifically, the extracted head contour point and tail contour point represent the endpoints of the rectangle in the horizontal direction, and the highest contour point and the lowest contour point represent the height information, and the initial fitting is performed to obtain the initial enclosing rectangle.
[0098] S53: Using the four sides of the initial enclosing rectangle, extracting the door and window contour points close to each side, and performing a secondary fitting on each side using a random sampling consistency algorithm.
[0099] S54: Determine whether the figure composed of four sides after the quadratic fitting is a quadrilateral.
[0100] S55: If yes, output the initial enclosing rectangle.
[0101] S56: Otherwise, discard the initial enclosing rectangle.
[0102] Specifically, the four sides of the initial enclosing rectangle are used to extract the door and window contour points close to each side, and then each side is re-fitted using the random sampling consensus algorithm (RANSAC). If a quadrilateral cannot be fitted during the re-fitting process, it means that one of the four sides cannot be re-fitted due to insufficient points, and the door and window contour points are discarded.
[0103] Through this design, in order to solve the problem of detail reconstruction of indoor mobile scanning, the room wall reconstruction is used to extract the wall, and then horizontal and vertical slices are performed. The door and window contour points are proposed using the adjacent point distance threshold, and the doors and windows are separated and parameterized through clustering. This method can quickly and accurately extract the openings on the wall.
[0104] See also Fig.13 , Fig.13 Schematic diagram of the structure of an embodiment of the three-dimensional reconstruction system of the present application. The three-dimensional reconstruction system specifically includes:
[0105] The acquisition module 10 is used to obtain three-dimensional point cloud data containing the room to be modeled, and perform two-dimensional projection on the three-dimensional point cloud data to form a first image.
[0106] The segmentation module 12 is coupled to the acquisition module 10 and is used to perform room segmentation on the first image and segment the three-dimensional point cloud data according to the room segmentation result of the first image to obtain a first point cloud of each room; wherein the first point cloud includes a wall point cloud.
[0107] The processing module 14 is coupled to the segmentation module 12 and is used to perform a two-dimensional projection on the double-sliced wall point cloud to obtain a second image, wherein the second image includes a plurality of wall data points. In addition, the processing module 14 is also used to obtain a wall boundary line from the wall data points, and obtain a closed polygon from the wall boundary line according to the endpoint support and the line segment support.
[0108] The stretching module 16 is coupled to the processing module 14 and is used to stretch the closed polygon to obtain a three-dimensional model of the room.
[0109] See also Fig.14 , Fig.14 1 is a schematic diagram of a framework of an embodiment of a three-dimensional reconstruction system of the present application. The three-dimensional reconstruction system includes a memory 20 and a processor 22 coupled to each other. Specifically, in this embodiment, the memory 20 stores program instructions, and the processor 22 is used to execute the program instructions to implement the three-dimensional reconstruction method mentioned in any of the above embodiments.
[0110] Specifically, the processor 22 may also be referred to as a CPU (Central Processing Unit). The processor 22 may be an integrated circuit chip having the ability to process signals. The processor 22 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. In addition, the processor 22 may be implemented by a plurality of integrated circuit chips.
[0111] See also Fig.15 , Fig.15 It is a schematic diagram of a framework of an embodiment of a computer-readable storage medium of the present application. The computer-readable storage medium 30 stores a computer program 300, which can be read by a computer, and the computer program 300 can be executed by a processor to implement the three-dimensional reconstruction method mentioned in any of the above embodiments. Among them, the computer program 300 can be stored in the above-mentioned computer-readable storage medium 30 in the form of a software product, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The computer-readable storage medium 30 with a storage function can be a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, RandomAccess Memory), a disk or an optical disk, etc., which can store program codes, or a terminal device such as a computer, a server, a mobile phone, and a tablet.
[0112] In summary, different from the prior art, the 3D reconstruction method provided by the present application includes: obtaining 3D point cloud data containing the room to be modeled, and performing 2D projection on the 3D point cloud data to form a first image; performing room segmentation on the first image, and segmenting the 3D point cloud data according to the room segmentation result of the first image to obtain the first point cloud of each room; wherein the first point cloud includes the wall point cloud; performing 2D projection on the slice of the denoised wall point cloud close to the ceiling point cloud to obtain the second image; wherein the second image includes a plurality of wall data points; obtaining the wall boundary line from the wall data points, and obtaining a closed polygon from the wall boundary line according to the endpoint support and the line segment support; and stretching the closed polygon to obtain the 3D model of the room. By such a design method, the accuracy of the wall reconstruction and the door and window reconstruction can be guaranteed, thereby obtaining a more accurate 3D reconstruction model of the room.
[0113] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A three-dimensional reconstruction method, It is characterized in that include: Obtaining three-dimensional point cloud data containing a room to be modeled, and performing two-dimensional projection on the three-dimensional point cloud data to form a first image; Performing room segmentation on the first image, and segmenting the three-dimensional point cloud data according to the room segmentation result of the first image to obtain a first point cloud of each room; wherein the first point cloud includes a wall point cloud and a ceiling point cloud; Perform two-dimensional projection on a slice of the denoised wall point cloud close to the ceiling point cloud to obtain a second image; wherein the second image includes a plurality of wall data points; Obtaining a wall boundary line from the wall data points, and obtaining a closed polygon from the wall boundary line according to endpoint support and line segment support; Stretching the closed polygon to obtain a three-dimensional model of the room; The step of obtaining a wall boundary line from the wall data points and obtaining a closed polygon from the wall boundary line according to endpoint support and line segment support comprises: Extracting a straight line for each of the wall data points, and merging all the straight lines to obtain at least one straight line set; wherein the straight line set includes at least one straight line belonging to the same wall; Intersecting the straight lines in the straight line set to obtain the wall boundary line; Filter out the best line segment from the wall boundary line according to the endpoint support and the line segment support; wherein the endpoint support is the number of line segments connected by each endpoint whose line segment support is greater than zero, and the line segment support is the product of the credibility weighted value of each inner point in the bounding box and the point cloud density of all inner points in the bounding box; The redundant line segments except the optimal line segment are deleted and the missing parts of the optimal line segment are supplemented to obtain the closed polygon; wherein the support degree of each endpoint of the closed polygon is two.
2. The three-dimensional reconstruction method according to claim 1, It is characterized in that Before the step of selecting the optimal line segment from the wall boundary line according to the endpoint support and the line segment support, the method includes: Obtaining a bounding box using the endpoints of the wall boundary line, wherein the bounding box includes at least one inner point; Obtain the ratio between the first distance between the inner point and the wall boundary line and a first threshold, the difference between one and the ratio, and obtain the product between the difference and the covariance matrix of the inner point, and use the sum of the products of all the inner points in the bounding box as the credibility weighted value; wherein the first distance is less than or equal to the first threshold.
3. The three-dimensional reconstruction method according to claim 1, It is characterized in that Before the step of performing two-dimensional projection on a slice of the denoised wall point cloud close to the ceiling point cloud to obtain a second image, the method includes: Segmenting the first point cloud of the room to obtain wall point clouds in each of the rooms; Slice the wall point cloud according to a preset angle interval to obtain a second distance between the wall point cloud and the center point of all the first point clouds in each of the rooms; Slicing the wall point cloud according to the second distance and a preset distance interval; The number of wall point clouds after double slicing is used to remove sparse noise points and point clouds representing horizontal planes in each of the rooms.
4. The three-dimensional reconstruction method according to claim 1, It is characterized in that After the step of stretching the closed polygon to obtain the three-dimensional model of the room, the method further comprises: Extracting a second point cloud in the three-dimensional model; wherein the second point cloud belongs to a wall in the three-dimensional model; Dividing the second point cloud according to the height information of the three-dimensional model to obtain at least one horizontal slice, and dividing the second point cloud according to the horizontal angle of the point to obtain at least one vertical slice; Extracting first contour points in a first direction perpendicular to the ground using the horizontal slices, and extracting second contour points in a second direction horizontal to the ground using the vertical slices; The first contour points and the second contour points are clustered to obtain at least one door and window contour point, and the door and window contour point is projected onto a corresponding wall in the three-dimensional model.
5. The three-dimensional reconstruction method according to claim 4, It is characterized in that The step of extracting first contour points in a first direction perpendicular to the ground using the horizontal slice comprises: sorting the wall point cloud in the horizontal slice according to the horizontal angle of the second point cloud in the horizontal slice, and obtaining a third distance between the wall point cloud in the horizontal slice and its adjacent wall point cloud; In response to the third distance satisfying a second threshold, taking an adjacent second point cloud as the first contour point; The step of extracting second contour points in a second direction horizontal to the ground using the vertical slice comprises: sorting the wall point clouds in the vertical slice according to the height values of the second point clouds in the vertical slice, and obtaining a fourth distance between the wall point cloud in the vertical slice and its adjacent wall point cloud; In response to the fourth distance satisfying a third threshold, the adjacent second point cloud is used as the second contour point.
6. The three-dimensional reconstruction method according to claim 4, It is characterized in that After the step of clustering the first contour points and the second contour points to obtain at least one door and window contour point, and projecting the door and window contour point onto a corresponding wall in the three-dimensional model, the method includes: Sorting the first contour points and the second contour points according to the directions of the walls, and obtaining the first contour point and the last contour point according to the sorting results; Sorting the first contour points and the second contour points according to their height values, and obtaining the highest contour point and the lowest contour point according to the sorting result; Performing initial fitting on the head contour point, the tail contour point, the highest contour point and the lowest contour point to obtain an initial enclosing rectangle; Using the four sides of the initial enclosing rectangle to extract the door and window contour points close to each side, and using a random sampling consistency algorithm to perform a quadratic fit on each side; In response to the figure after the quadratic fitting being a quadrilateral, the initial enclosing rectangle is output.
7. The three-dimensional reconstruction method according to claim 1, It is characterized in that The step of performing room segmentation on the first image, and segmenting the three-dimensional point cloud data according to the room segmentation result of the first image to obtain a first point cloud of each room includes: Binarizing the first image to obtain the gaps between the rooms, and using an edge extraction algorithm to obtain the edges of the gaps; Refining the edge using image dilation and image closing operations; Performing Hough transformation on the edge to obtain line segments corresponding to the edge, and optimizing the line segments to merge straight lines belonging to the same wall boundary; Performing an image subtraction operation on the widened line segment and the first image to obtain a third image; wherein the third image includes the room and the wall boundary line; The room is segmented according to the wall boundary lines, and the first point clouds corresponding to the rooms are separated.
8. The three-dimensional reconstruction method according to claim 7, It is characterized in that Before the step of segmenting the room according to the wall boundary line and separating the first point clouds corresponding to each room, the method further includes: In response to the presence of noise points in the third image, the noise points are removed and the process proceeds to a step of segmenting the rooms according to the wall boundary lines and separating the first point clouds corresponding to the rooms.
9. The three-dimensional reconstruction method according to claim 1, It is characterized in that Before the step of performing two-dimensional projection on the three-dimensional point cloud data to form a first image, the method includes: The three-dimensional point cloud data is preprocessed.
10. A three-dimensional reconstruction system, It is characterized in that It comprises a memory and a processor coupled to each other, wherein the memory stores program instructions, and the processor is used to execute the program instructions to implement the three-dimensional reconstruction method according to any one of claims 1 to 9.
11. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and the computer program is used to implement the three-dimensional reconstruction method according to any one of claims 1 to 9.
