A METHOD FOR DETECTION OF DOORS IN BUILDING INDOOR POINT CLOUD THROUGH MULTI-LAYER THRESHOLDING AND HISTOGRAM ANALYSIS

: Indoor navigation is a critical service providing safe paths for humans in an emergency. Since doors connect different parts of a building, door detection is essential in creating a navigation map and walkable spaces. Considering the Manhattan World Assumption (MWA), this paper proposes a method for detecting doors that connect two scanned rooms. In contrast with most existing approaches, the proposed method requires neither trajectory nor scanning position. This method consists of two main steps. At first, with the help of multi-layer thresholding, a raster will be created from the point cloud that its Digital Numbers (DNs) correspond to the ceiling elevation. Then, this raster's pixels will be segmented based on their DNs, and those segments whose elevations are local minimums are chosen as door candidates. The second step extracts the part of the point cloud corresponding to each door candidate and analyses its coordinates components' histograms to decide whether there is a door or not. The proposed scheme has been tested on two different datasets and could accurately detect 91% of the inner doors. Although this method is designed to detect inner doors, it also detected 65% of marginal doors.


INTRODUCTION
In case of emergency, in large public buildings such as airports, hospitals, and hotels, having access to accurate and up-to-date spatial information is essential in management and dealing with the crisis.Indoor navigation is a service that can manage crowds in such situations.To provide this service, detection of a navigation map is critical (Staats et al., 2019).Traditionally, 2D floor plans were used to detect walkable spaces and produce a navigational network.However, as 3D indoor models contain more and semantically rich information, they are of greater interest and have become the primary data source for indoor navigation services.Although most of the new buildings are first designed in software and then built, some minor changes in the construction stage and the changes that occur in the renovation stage might reduce the completeness and the correctness of the initial models.Also, there is no model representing indoor environment of old buildings.As a result, indoor modelling has attracted photogrammetric communities' attention.
Since Light Detection And Ranging (LiDAR) systems can provide dense and accurate point clouds in a short period of time, they are widely used in indoor modelling projects.Also, the manual generation of the models is too time-consuming and expensive, and automation of this process is a way to save time and reduce costs.Most of the existing automatic methods proposed for indoor modelling only consider walls, ceilings, floors, and sometimes stairs as the main permanent structures of the building and try to detect and connect them to produce indoor models (Ochmann et al., 2019;Zavar et al., 2021).Manhattan-World Assumption (MWA) can simplify the process of connecting the permanent structures.Based on this assumption, the indoor environment can be modelled with the help of parallel and perpendicular surfaces.In other words, the ceiling and the floor are horizontal, and the walls are vertical surfaces (Oh et al., 2021).Also, each two adjacent walls are perpendicular.
Representation of the doors and windows improves the completeness of the building model (Pexman et al., 2021).Doors are connections between different building sections, which makes the door detection task an essential topic in navigationbased services.This paper proposes an automatic method for detecting the doors from a point cloud that can only be applied in single-storey buildings.Considering the MWA, this method is specifically designed to detect doors connecting two rooms scanned by a laser scanner.In other words, this method is inappropriate for the doors located at the margins of the point cloud.The main idea in detecting doors is that doors are shorter than the ceiling.Hence, the proposed method can only be implemented where this condition is met.Although this idea is inspired by the strategy used in (Díaz-Vilariño et al., 2017), as an advantage, it does not need the knowledge of the scanner's trajectory.In fact, the proposed method only uses a point cloud as an input, making it applicable for point clouds acquired by both Terrestrial Laser Scanners (TLS) and Mobile Laser Scanners (MLS).This paper is organized into six sections.The next section reviews the literature and the proposed method is described in the third section.While the fourth section introduces the datasets, implementation details and results are reported in the section five.Finally, the last section is dedicated to the conclusion.

RELATED WORKS
Most of the existing methods proposed to detect doors from point clouds need either trajectories of MLS or the scanner position of TLS.For example, Díaz-Vilariño et al. (2017) analyzed the point cloud and the trajectory of an MLS to detect the doors through which the scanner passed.In that research, a vertical profile of the point cloud along the trajectory was produced.The profile's upper part corresponds to the ceiling or some objects connected to that, such as lamps and pipes.Since doors typically have a lower height than the ceiling, a sudden decrease in the Z component of the profile can be seen when the scanner passes through a door.Such reductions were detected by thresholding on the normalized version of the profile (Díaz-Vilariño et al., 2017).An improved version of the mentioned method was proposed by (Staats et al., 2019), where another criterion was added to the method.This criterion investigates the fluctuations of the point cloud in a horizontal plane.Also, (Elseicy et al., 2018) used the trajectory data and point cloud to identify approximated locations of doors traversed by an MLS operator.In that research, those laser points located within a certain distance from the trajectory were considered door candidates.Then, they were segmented to detect the walls surrounding the door frame.Afterwards, the false candidates were removed based on the frame's width and height.Moreover, (Nikoohemat et al., 2020) used the idea of intersecting the trajectory with the labelled wall surfaces to detect the approximate location of the center of the doors.Their proposed method was able to detect closed doors as well.
Furthermore, in (Xie & Wang, 2017), another door detection method based on the 2D projection of trajectory is reported that uses Delaunay triangulation and alpha-shape properties as well.This method could only detect open doors, which converts the door detection issue into the vacancy detection problem.Then, these vacancies are detected by intersecting some triangles representing the outer walls with the scanner's trajectory or simulated rays from the scanner positions.These triangles are produced through alpha-shape analysis.
Moreover, other techniques have been proposed that do not rely on the scanner's trajectory and position (Jung et al., 2018).For example, (Pexman et al., 2021) proposed a method to detect the doors connecting two neighboring wall surfaces.In that research, the wall surfaces were extracted by an iterative M-estimator SAmple Consensus (MSAC) method.In this method, after detecting a pair of neighboring surfaces (two surfaces that were close and had similar surface normal), if there are some points between these surfaces, these points are considered a candidate for either a door or a window.Then, by voxellizing the points, the false candidates were detected and removed.Finally, by analyzing the histogram of the voxels, the doors and windows were discriminated.

METHODOLOGY
Considering the MWA, the point cloud can be rotated into a coordinate system in which each building's permanent structures (walls, ceiling, and floor) are parallel to one of the principal planes of the coordinate system.To use the proposed scheme, it is necessary to transform the point cloud into the mentioned coordinate system.This process can be done manually with the help of a point cloud processor software like "CloudCompare ® ".Afterward, an automatic two-stepped procedure is proposed to detect doors from the point cloud.In the first step, a raster will be created from the point cloud whose Digital Numbers (DN) are related to ceiling height.Then by segmentation of this raster, door candidates are detected.In the second step, the point cloud corresponding to the vertical column of each candidate segment is extracted and individually investigated to determine whether it is a door or not.The details of these two steps are described in sections 3.1 and 3.2.

Door candidates detection
In this step, the door candidates are detected with the help of image processing techniques.Hence, this step starts with creating a raster from the point cloud.It should be mentioned that the proposed method assumes the Z-axis of the coordinates is exactly vertical.So, with the help of thresholding in Z, the point cloud will be separated into several non-overlapping layers.These layers are numbered with consecutive positive integer numbers so that the lowest layer is indexed by one, and the index for the upper layer equals the number of layers.Then, a binary raster (a grid) is created for each layer.The columns and the rows of this raster correspond to the X and the Y axis of the point cloud's coordinates system respectively.The DN of a layer raster's cell will be one if and only if at least one point inside the cell margins is detected in that layer.The sequential arrangement of these rasters forms a hypercube.Then, another empty raster of the same size as grids will be created.Hereinafter, this raster will be called Layer Numbers Map (LNM).For each cell of LNM, the maximum layer ID in the hypercube whose DN on the mentioned cell is one, is allocated to the LNM's cell as DN. Figure 1.shows how LNM is created.As LNM stores the top layer for each cell, it is expected that the DNs of the raster correspond to the ceiling height.Because the ceilings are almost horizontal, a sudden and constant decrease in their height would signify a place where a door might be.So, to detect these regions, the LNM will be segmented based on its DNs.In the segmentation process, a segmentation matrix which is a raster whose DNs show cells' segment IDs, will be created.After that, unique values of DNs will be detected.Then, a mask (a binary image) will be produced for each unique value (i: 1 ≤ i ≤ number of layers-1).The value of this mask would be one only for those pixels with DNs in the range of [i, i+1].An erosion operator is employed on the masks to remove small parts, most of which belong to noises.Then, the pixels with value one in the masks will be labelled.In the labelling process, if there is at least a way between a pair of pixels, and this way only passes through pixels of one value, both pixels of the pair will be labelled with the same value.However, if this condition is not met, these two pixels' labels differ.Figure 2 shows an example of how a mask will be labelled.In this figure, the pixels in yellow and green show two different labels, and the white pixels do not belong to any label.Mask (b).Labelled mask Then, each pair of segments from two consecutive masks with a strong intersection (more than 10% of the smaller segment is shared between two segments) will be merged in Segmentation matrix.Also, the rest of segments will also be added to the Segmentation matrix as new labels.Figure 3 shows how labels will be merged.As shown in figure 3, the blue and yellow pixels that satisfy 10% overlap have been merged and formed a larger label.In contrast, the blue and green labels, which provide overlap of a single pixel, have not been merged.As a result, four labels shown in figure 3a and figure 3b have been converted into three labels shown in figure 3c.It should be mentioned that the overlap area between labels with a weak intersection has been allocated to the larger label.Also, Figure 4 shows the diagram of the segmentation process.
After the segmentation process, each segment whose mean height is a local minimum is considered a door candidate.In fact, this criterion investigates whether the main idea of the proposed method is met or not.To do so, the marginal pixels of the segments will be detected through Eq. ( 1).

1) ( 𝑚 𝑖 = (S 𝑖 ⊕ 𝑂) − S 𝑖
where mi= marginal pixels around segment i O = true matrix of size 3×3 Si= logical matrix showing the pixels of segment i ⊕= sign for dilation operator Then, those marginal pixels that do not belong to any segment will be removed from mi, providing a fairer evaluation.Finally, if DNs of LNM for more than 80% of the remained marginal pixels are more than the average of DNs of the segment's pixels, that segment can meet the mentioned criterion and is considered a door candidate.
Creating the mask (i) (mask = i < LNM < i+1) Labeling the mask which creates Labels

Labelling the door candidates
This step analyses the part of the point cloud corresponding to each door candidate independently and decides whether it is a door or not.Hereinafter, this part of the point cloud is called a candidate's cloud.A door frame is an empty cubic shape inside the point cloud consisting of two horizontal and two parallel vertical planes.The door itself is also a vertical plane that its orientation about the frames' vertical planes could be parallel, perpendicular, or neither.So, detecting the door itself could be problematic, which is why our method tries to detect doors using the door frame's planes only and based on the histogram of the candidates' cloud coordinates.Figure 5 compares two opened and closed doors and highlights the mentioned planes.This figure highlights the door fames' horizontal and vertical planes in green and red.Also, the door itself is shown in blue.As mentioned before, the point cloud is transformed into a coordinate system described at the beginning of section 3.
Therefore, Eq. ( 2) and Eq. ( 3) express the analytical form of the vertical (walls) and horizontal (ceiling and the floor) planes respectively.
2) Furthermore, as the space inside a door frame is empty, the values recorded in the histograms between each pair of peaks must be lower than normal.Figure 6a shows three histograms of coordinates corresponding to a door frame.As can be seen, all these histograms have the mentioned characteristics and a similar shape.From now on, any shape like figure 6a that corresponds to a histogram of a door frame are called Door Frame Histogram (DFH).To detect DFH automatically, a continuum removal form of the histogram is used.Eq. ( 4) shows how this form is calculated.In this equation, the convex hull of the smoothed histogram which is calculated using an average filter is used.1-The deviations in the height of the floor must be less than a certain threshold.2-The distance between the two consecutive ones (peaks) must be in the range of the standard dimension of a door.3-The average value for the CRF between the two peaks must be less than a certain threshold.The floor height for two rooms connected by a door must be similar, this fact is investigated by the first condition.Moreover, as a door's vertical and horizontal dimension differs, two different thresholds should be established for vertical and horizontal components.Also, the third condition investigates how strong the gap between the two consecutive peaks is.Finally, if and only if a CRDFH in the Z component and another in the X or Y component are detected, the candidate is a door.

DATASETS
The proposed scheme has been evaluated with the help of two datasets provided in the ISPRS benchmark on indoor modelling (Khoshelham et al., 2017).As TUB2 dataset has scanned two floors connected by a staircase and the proposed method can be implemented on single-story datasets, only one of the stories of the building is evaluated.The part of the point cloud corresponding to this storey is manually extracted in "CloudCompare ® " software.The details for the datasets are described in table 1.Also, figure 7. shows the indoor model of the scanned buildings created by the data provider.This figure removes the roofs to reach a better visual interpretation.

IMPLEMENTATION AND RESULTS
As mentioned in section 3, the proposed method starts with the production of LNM.The grid size and the distance between two adjacent layers are set to be 5 and 2.5 cm respectively.The experimental results show that these figures satisfy the method's requirements and prevent the proposed scheme from becoming time-consuming.Moreover, the other parameters controlling the segmentation and candidate detection processes are reported in table 2. It should be mentioned that the standard width for a door is chosen so that both single-door and double-doors can be detected.3 shows a report of the proposed method's performance.In this table, the numbers of initial candidates that could not meet the mentioned conditions are reported.It should be mentioned that if a candidate cannot meet one condition, it will not be tested by the rest of the conditions and the order of applying the conditions to candidates is similar to the order shown in table 3.
Figure 8 shows the candidates and the doors detected in each dataset.In this figure, the candidates that labelled as door and those labelled as not-door are shown in green and red respectively.Also, the whole point cloud is shown by blue dots.As mentioned before, the proposed method is specifically designed to detect the doors connecting two scanned rooms.Table 4 shows the accuracy in detecting this kind of doors in the form of confusion matrixes.However, the proposed method has detected some marginal doors as well.So, the results of such doors are also reported in table 5.
As shown in table 4 and table 5, the proposed method could detect 90 % and 92% of inner doors in TUB 1 and TUB 2 datasets respectively.Also, 65% of marginal doors are correctly detected.It seems that because of the erosion operator in the segmentation process, the doors located at the boundaries of the point cloud might be affected.So, the proposed scheme was less successful in determining them as door candidates.However, the experimental results have shown that this operator dramatically reduces the number of wrong door candidates, which means using erosion in the proposed procedure is a must.Moreover, three candidates are wrongly detected as doors.However, all three are connections between different rooms and can be considered openings.Also, one inner door in each dataset is not detected at all.In fact, these doors are not selected as candidates.

CONCLUSION
This paper proposed an automatic procedure based on MWA to detect inner doors from LiDAR point cloud.With the help of image processing, this method tries to extract points related to the ceiling and highlight places where a reduction in the ceiling height has happened.Then, through coordinates histogram analysis, these places are labelled by either door or not-door.The proposed scheme does not need any additional data such as the scanner's trajectory or position and also locations of building permanent structures, which is the main advantage of this method compared to the existing approaches.While the results obtained from our method in detecting inner doors was promising, the existence of an erosion operator in the method reduces its ability to detect marginal doors.Hence, improving the performance of the proposed approach in marginal doors detection is a topic that needs to be studied more.

Figure 1 .
Figure 1.How to create LNM

Figure 2 .
Figure 2.An example of how a mask will be labelled.(a).Mask (b).Labelled mask

Figure 5 .
Figure 5. Door frames' planes.(a).Opened (b).Closed existence of a permanent structure results in a peak in the histogram of X, Y, or Z components.Hence, a door frame consists of a pair of peaks in the histogram of the Z component and another pair in the histogram of X or Y components.
Figure 6b shows the Continuum Removal of DFH (CRDFH) shown in figure 6a.In CRH, the values for the local maximums of the histograms are equal to one, and the other values are in the range of [0, 1).So, the space between two consecutive ones in CRH (local peaks in the histogram) might correspond to a CRDFH.However, to detect strong CRDFHs, three following conditions must be met.

Figure 7 .
Figure 7. Interior models of the scanned building created by the data provider.(a).TUB1.(b) TUB2

Table 1 .
Specifications of datasets

Table 2 .
Parameters controlling door candidate detection

Table 3 .
A report of the proposed method performance

Table 4 .
Confusion matrices showing accuracy in detecting inner doors

Table 5 .
Confusion matrices showing accuracy in detecting marginal doors