Automatic 2D Floorplan CAD Generation from 3D Point Clouds

: In the architecture, engineering, and construction (AEC) industry, creating an indoor model of existing buildings has been a challenging task since the introduction of building information modeling (BIM). Because the process of BIM is primarily manual and implies a high possibility of error, the automated creation of indoor models remains an ongoing research. In this paper, we propose a fully automated method to generate 2D ﬂoorplan computer-aided designs (CADs) from 3D point clouds. The proposed method consists of two main parts. The ﬁrst is to detect planes in buildings, such as walls, ﬂoors, and ceilings, from unstructured 3D point clouds and to classify them based on the Manhattan-World (MW) assumption. The second is to generate 3D BIM in the industry foundation classes (IFC) format and a 2D ﬂoorplan CAD using the proposed line-detection algorithm. We experimented the proposed method on 3D point cloud data from a university building, residential houses, and apartments and evaluated the geometric quality of a wall reconstruction. We also offer the source code for the proposed method on GitHub.


Introduction
The creation of 2D floorplan computer-aided designs (CADs) of the existing buildings is a challenging task in the architecture, engineering, and construction (AEC) industry, as the as-built condition of buildings can differ from original plans due to undocumented renovations. The creation of an indoor model from existing building has been widely researched with building information modeling (BIM) and has been increasingly requested in various applications [1]. Currently, BIM processes are well established for new buildings, but most existing buildings are not maintained, refurbished, or deconstructed with BIM [2]. The advantage of the implementation of BIM in existing buildings is significant, especially for restoration, documentation, maintenance, quality control, and energy/space management.
Thus, the most important aspect is the creation of BIM without a prior model, as existing buildings usually do not have a model. To create BIM for existing buildings, 3D reconstruction is required, and a key aspect of 3D reconstruction is wall geometry modeling because it forms the basis for other elements of buildings. Currently, these objects are created manually based on large unstructured 3D point clouds acquired from the built structure. However, this process is labor-intensive and is prone to human error. Another challenge related to automated reconstruction is that 3D point clouds contain various types of clutter, such as furniture, and 3D point clouds lack semantic information [3].
In order to resolve these issues, we propose a fully automated method to create 2D floorplan CADs from 3D point clouds without a prior model. In the proposed method, we generate 3D reconstruction model of walls based on assumption of Manhattan-World (MW) buildings, which assumes that most man-made structures can be approximated by planar surfaces that are parallel to one of the three principal planes of a common orthogonal coordinate system [4].
We then generate a 2D floorplan CAD based on the 3D reconstruction of the elements. In detail, to reconstruct the wall geometry, the proposed algorithm initially detects planes from 3D point clouds and classifies them as belonging to floors, ceilings, or walls. A 2D image which contains only wall candidate points is then created and wall lines are detected. There are several line-detection algorithms, such as RANSAC [5], the Hough transform [6], and the least-square (LS) method [7]. In this paper, we propose an efficient line-detection algorithm for wall detection.
This paper is organized as follows. In Section 2, the background and related works are presented. Section 3 presents the proposed method, including the steps of data preprocessing, floor segmentation, wall detection, and 2D floorplan CAD generation. In Section 4, experimental results are discussed, including the evaluation metrics and datasets used. Finally, the concluding remarks follow in Section 5.

Backgrounds and Related Works
The main process when generating a 2D floorplan from unstructured 3D point clouds is to create BIM objects from 3D point clouds. This process can be divided into two steps, i.e., 3D reconstruction and conversion into a BIM format such as the industry foundation classes (IFC) format.
3D reconstruction commonly consists of three parts after the acquisition of the point cloud: data preprocessing, plane segmentation, and plane classification. First, the 3D point cloud data are preprocessed to create structured data in order to save time during the process and achieve more efficient results. In 2D methods, the point cloud is represented as a set of images consisting of a slice of points or other information [8,9]. In 3D methods, the point cloud is restructured as a voxel octree which allows efficient neighborhood searches [10]. Subsequently, the point cloud is segmented. Typically, lines are used for point cloud segmentation in 2D methods such as RANSAC based [8,11,12] and Hough transform based [13][14][15] methods, while planes are used for point cloud segmentation in 3D methods [10,16,17]. Finally, the segments are classified into categories such as floors and walls by using heuristics or machine learning techniques [18][19][20][21].
After 3D reconstruction, wall geometry modeling is the most important part of the next step. There have been several studies of the reconstruction of wall geometries. Xiong et al. and Adan and Huber reconstructed planar wall boundaries and openings based on machine learning [18,22]. Michailidis and Pajarola reconstructed severely occluded wall surfaces using Bayesian graph-cut optimization based on cell complex decomposition [23].
The relationship between elements in a building leads at the end to the BIM establishment. Additionally, element topology can serve to describe building elements. Topological data assign spatial relationship information, whereas the dimensions and locations of elements are represented by geometrical data. Types of elements and relationships with other elements are associated with these processes. Several proposed models determine topological relationships among objects automatically. Nguyen et al. presented an approach that automatically analyzes the topological relationships of building elements [24]. Belsky et al. implemented a prototype system for the semantic improvement of prior factual model files [25]. In their system, shared and slab collection concepts were acknowledged and topological, geometric, and other generic operators were used in collections of rule sets. Anagnostopoulos et al. presented a semi-automatic algorithm which calculated the boundaries and adjacency of objects in 3D point clouds [26]. It generated depictions of objects in the IFC format.

Proposed Method
The input to our method consists of unstructured 3D point clouds, and the output is the 2D floorplan CAD having topological relationships between the walls. The proposed method is composed of the 3D reconstruction and 2D floorplan CAD generation parts. In the first part, walls are detected as follows: 1.
Floor segmentation based on horizontal planes 3.
Wall proposals based on vertical planes for each floor 4.
Wall detection using the horizontal projection of wall proposals 5.
IFC file generation from the detected wall points In the second part, we create structural elements from the IFC file, after which, based on this information, we generate the 2D floorplan CAD. Our approach is fully automated and implemented using the PCL (point cloud library) the most popular library that works with 3D point clouds [27]. Figure 1 shows the overall flow of the proposed method. The code for the proposed method is available at https://github.com/joyjo/to-generate-2D-floorplan-CAD-from-3D-point-clouds.

Data Pre-Processing
We used unstructured 3D point clouds as an input data from LIDAR scanners. Therefore, our algorithm requires preprocessing of the 3D point clouds in order to save time during the process and to gain more insight for meaningful element extractions, such as for floors and walls. For data preprocessing, 3D point clouds are spatially re-sampled at 1 cm and rotated to follow the proper orientation for a wall detection algorithm.

Floor Segmentation
After data preprocessing, floor segmentation is performed. We consider the assumption that floors and ceilings are horizontal and parallel to the x-y plane. Therefore, the largest horizontal planes are extracted using a parallel model of the RANSAC algorithm because the floor and ceilings would contain the highest points in every possible horizontal plane. Then, detected planes are ordered by z-coordinate and analyzed with floor altitude threshold. Each plane is identified as a floor or a ceiling based on the altitude threshold and the 3D points of floors and ceilings are then removed to detect walls. The ceilings may contain clutters such as lamps, air conditioning, or ventilation openings, but these clutters are considered as a part of ceiling and removed with ceilings together.

Wall Detection
Detecting walls is a more complex process than detecting floors and ceilings. After removing floors and ceilings, 3D point clouds contain points belonging to walls as well as points belonging to clutter, such as furniture (e.g., desks, chairs and bookshelves). Detecting a wall is highly sensitive in cluttered data. In order to solve this problem, wall proposals are conducted by removing most of the clutter from the 3D point clouds. As shown in Figure 2, wall proposals, W p = {w p1 , ..., w pn }, are calculated based on the assumption that walls are vertical and parallel to y-z or x-z planes. Therefore, all possible planes are extracted using a parallel model of the RANSAC algorithm. Then, our proposed algorithm retains the planes with altitudes higher than a threshold, as follows: Here, w pi_height is the height of the i-th plane, thres is a constant value that describes the minimum plane height, Ceiling minZ is the minimum point of the z-axis for a ceiling, Floor maxZ is the maximum point of the z-axis for the floor. Therefore, (Ceiling minZ − Floor maxZ ) becomes the height of the current floor. After the wall proposals, walls are detected with two steps. In the first step, we create depth image based on points of wall proposal planes that are projected onto the x-y plane using Algorithm 1. The expected result is described in Figure 3a  In the second step, walls are detected using the created depth image with Algorithm 2. To solve the problem of missing 3D points when the building is scanned by a LIDAR, we propose an efficient line-detection algorithm from the created depth image. The proposed algorithm finds all horizontal and vertical lines in the depth image if a line contains at least one point. All possible wall candidates are defined in each horizontal and vertical line, as presented in Figure 3b. We then detect actual walls from the wall candidate lines. The expected result is presented in Figure 3c. Algorithm 2 has the following steps: -Inputs are the depth image that results from Algorithm 1 and the thresholds, i.e., minimum points for the wall line, minPoints; minimum length of the wall line, minLen; and determined area, detArea. -Define the wall candidate lines, clines (lines between 1 and 6). If a pixel, depthImg i j , has an intensity value greater than 0, i.e., the pixel is not black, then the pixel is a part of the wall candidate lines. Therefore, the horizontal and vertical lines that pass the pixel are drawn. In detail, the horizontal and vertical lines are described by two points: (0, j) and (depthImg.cols − 1, j), and (i, 0) and (i, depthImg.rows − 1). This process is repeatedly done for all pixels in depthImg. -Define actual wall lines from wall candidate lines (lines between 7 and 20). First, we check the pixels in each wall candidate line, clines. If there are points around the pixel within the predefined area threshold (the default value is 50 pixels), it means that the pixel can be a part of the wall line. We set an area threshold value because there are some missing points and noise from the LIDAR sensor. We set pLines[i] to 1 if the i-th pixel satisfies the condition, and set it to 0 otherwise. As a result, we obtain the pLines vector, which is a sequence of 0 and 1 for each wall candidate line. The size of the pLines vector is equal to the width and height of the depth image for the horizontal and vertical wall candidate lines, respectively. Based on the pLines vector, we determine the actual wall lines using the thresholds, i.e., minimum points on the wall line, minPoints, and minimum length of the wall line, minLen. For example, if pLines = {1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1}, we can see two sequences of ones. If these two sequences meet the threshold condition, they are determined to be actual wall lines. if sequence has more points than minPoints and is longer than minLen then 17 Store detected sequence to wallLines; 18 end 19 end 20 return wallLines

IFC File and 2D Floorplan CAD Generation
Using the proposed method, walls are identified successfully with information that includes the position, direction and altitudes, but they are still in the form of 3D point clouds. Therefore, 3D reconstruction of the structural elements of the building must be performed. There are two necessary steps when reconstructing walls and exporting the result into a BIM format. In the first step, we describe the 3D geometry of the elements based on information for which the wall is described as either a volume composed of eight points and six facets or as a surface composed four points and one facet. The second step consists of translating the 3D geometry of the elements into an IFC file.
The elements describe what is expected in the building information model. A conversion phase is thus necessary to be able to integrate the results in BIM software. The IFC format is chosen as the format for the output in this approach. The IFC format is a standardized object-based file format used by the AEC industry to facilitate interoperability between building actors. Both elements and relationships between elements are described in this type of file. In order to generate a file in the IFC format from a 3D geometry of structural elements, we use the open-source library IfcOpenShell [28].
After creating the IFC format, a 2D floorplan CAD file, such as an SVG format file, is generated using the IfcConvert method in an IfcOpenShell library. The IfcConvert method converts IFC files into various output formats, which include geometrical models and which are tessellated and easy to understand.

Experiments
The proposed method was experimented on university building, residential houses, and apartment data. We evaluated the wall geometry quality using the recall and precision metric. This section explains the experimental environment and results.

Experimental Environment
We developed our method focused on the data of the seventh floor of the Robot Convergence Building of Korea University collected by a handheld laser scanner (ZEB-REVO). This data consists of multiple rooms with various types of clutter such as desks, chairs, and sofas as presented in Figure 4a. Therefore, we experimented on another three datasets, as presented in Figure 4b-d, to prove that the proposed method works robustly even for unseen data which were collected by different scanners. The data in Figure 4b are the second floor of the residential house collected by LIDAR (Velodyne HDL-32E), and this 3D point cloud data are very noisy and contain multiple rooms, clutters, and highly missed points in walls. The data in Figure 4c,d are residential house and apartment which are from research that Liu et al. created a benchmark for a new vector-graphics reconstruction problem [29]. They provide 155 scans collected by Google Tango phones (Lenovo Phab 2 Pro and Asus ZenFone AR). We selected two pieces of residential data from these datasets that have multiple rooms, little clutter, and the highly missed point in walls. In this paper, we referenced these two datasets as "Tango Scan-1" and "Tango Scan-2". The details of each data are presented in Table 1. The proposed algorithm used all 3D point clouds as an input, as presented in Figure 4. In the preprocessing step, we decreased by nearly 30% of number of input point clouds and conducted structuring in voxels with a leaf size of 0.01m in order to save time and retrieve more structural data. We evaluated the position and length of the detected walls by means of precision and recall, as used in pattern recognition, information retrieval, and classification. The main concept of these methods is the fraction of relevant instances among the retrieved instances. We computed these metrics based on the overlap between the areas of the ground truth and detected walls. We evaluated true-positive, false-positive, and false-negative cases. True-positive (TP) refers to the area of a detected wall that is a wall in the ground truth, false-positive (FP) refers to the area of a detected wall that is not a wall in the ground truth, and false-negative (FN) is the area that is a wall in the ground truth but is not detected as a wall by the proposed algorithm. Based on TP, FP, and FN, we calculated the precision and recall as follows: We defined thresholds by considering common buildings. During the wall detection process, thres = 0.9; in Algorithm 1, gridSize = 0.01 m; and in Algorithm 2, detArea = 50 pixels which is identical at 50 cm because gridSize is 0.01 m, minPoints = 2500, and minLen = 100 cm.

Experiment Results
During the overall wall detection process, we initially removed the floor and ceiling from the input 3D point clouds. Figure 5 shows the detected floor and ceiling point clouds of the seventh floor of the Robot Convergence Building of Korea University. Then, using Algorithms 1 and 2, we detected lines from point clouds. We proposed an efficient line-detection algorithm by considering missing 3D points and noise from sensor input. The proposed algorithm is more efficient than existing algorithms such as the faster line detection and Hough transform algorithms. Furthermore, the proposed algorithm does not require any post-processing such as the Hough transform. Figure 6 shows the comparison results of line-detection algorithms on the seventh floor of the Robot Convergence Building of Korea University and Table 2 shows the processing time for each algorithm using an Intel i7-7800X and 64 GB of memory.    Table 3 shows the final wall detection result. We detected 97% of the ground truth and reconstructed the detected walls in the IFC file format, as shown in Table 4.  Table 4. Result of the proposed method.

Dataset 3D Reconstruction BIM 2D Floorplan CAD [SVG]
Seventh floor of the Robot Convergence Building of Korea University Table 4. Cont.

Conclusions and Future Work
Here, we proposed a fully automated algorithm for generating 2D floorplan CADs from 3D point clouds. First, the proposed algorithm automatically detected walls. We proposed an efficient line-detection algorithm in the wall detection section. The advantages of the proposed algorithm compared to others are it does not require any post-processing and only needs certain predefined thresholds. Second, the proposed algorithm reconstructed detected walls in the BIM format, which can be edited in CAD programs. Finally, a 2D floorplan was generated using IfcOpenShell. We experimentally tested the proposed algorithm on the 3D point cloud data gathered from the seventh floor of the Robot Convergence Building of Korea University using LIDAR and second floor of residential house using LIDAR and open source residential house using Google Tango phone. More than 97% of the walls in the ground truth were detected, and the 2D floorplan was generated successfully. However, the proposed method had limitations in input data because it was more sensitive to data that have missing points in the wall. Our line detection algorithm solved this issue but still if more than approximately 55% of wall points per each wall were missed that wall was not detected as a wall line correctly. In the future, we will develop an algorithm that considers stairs and openings in buildings, such as doors and windows.

Conflicts of Interest:
The authors declare no conflict of interest.