• Keine Ergebnisse gefunden

Estimation of the Lines Representing the Walls in 2D

5. Automatic Reconstruction of Indoor Spaces

5.2. Reconstruction of Geometric Models

5.2.4. Estimation of the Lines Representing the Walls in 2D

The skeletonized image is appropriate for the extraction of straight line by means of the Hough transform (Duda and Hart, 1972; Hough, 1962). The idea of the Hough transform is to find all potential lines passing through each point, and select the candidates based on a voting procedure carried out in a parameter space. This work uses a variant of the Hough transform called progressive probabilistic Hough Transform (Matas et al., 2000), implemented by the OpenCV free software library (Bradski, 2000). This variant is an optimization to the standard Hough transform in speed and performance, by minimizing the number of points used in the voting process, while maintaining false positive and false negatives detection rates at the same level of the standard Hough transform. More details are provided in appendix D.

In the Hough transform process, parameters such as minimum allowed number of votes, minimum line length and maximum allowed line gap between points on the same line can be set. However, the parameters have to be suitable enough, so that small structures are not generalized during the line extraction process. Figure 5.9 depicts an example, in which the Hough lines are extracted from the skeletonized image in the previous example. In this example, parameters are selected as follows:

minimum votes of 15 pixels (equivalent to 15cm) on a line, minimum line length of 15 pixels and maximum allowed line gap of 20 pixels (equivalent to 20cm). Although such kind of parameter selection results in the extraction of multiple smaller line segments for each wall, it will preserve almost all significant details and avoids the generalization. The effect of parameter selection on modeling results, as well as the stability of the selected parameters from one example to another is presented in the next chapter.

Figure 5.9 – Extraction of Hough line segments in a skeletonized image.

5.2.4.2. Clustering and Averaging the Line Segments

After the line extraction process, multiple smaller line segments corresponding to each wall have to be identified and averaged. The suggested identification process consists of three hierarchial clustering steps, in which line segments are grouped based on their orientation, distance to the centroid of the image and connectivity, respectively.

The first clustering step groups the line segments based on their orientation. Since the modeling approach is not limited to Manhattan-world scenarios, it takes into account all possible orientations

74 5. Automatic Reconstruction of Indoor Spaces distinguished by a small threshold (angular resolution of the model). The threshold, however, shall be able to tolerate the noise in the orientation of the extracted line segments. Various solutions are proposed for clustering; here the K-means algorithm suggested by Lloyd (1982) is used, which is the most common in the computer science community. The algorithm groups n observations

x , x ,1 2 , xn

into K sets

S , S ,1 2 , SK

, so that the sum of the squared Euclidean distances between the observations and the nearest cluster centroid (mean) is minimized:

i

K 2

i i 1 x S

x x min

 



(5.7)

The solution to the abovementioned equation is an iterative refinement process, in which two steps are repeatedly performed after each other. In the first step, each observation is assigned to the corresponding cluster with the smallest distance to its mean, so that the equation is satisfied. In the next step, a new centroid is computed and assigned to each cluster. The process is iterated until no more change is observed. In this approach, the initial set of centroids is usually selected randomly, and is updated during the process.

The number of clusters has to be pre-defined for the clustering algorithms. Estimation of the optimum number of clusters depends on the noise, distribution, as well as the resolution of the data, and therefore might be sometimes an ambiguous problem. However, in general there are different criterions that suggest the optimum number of clusters based on statistical approaches, many of which are summarized in Kodinariya and Makwana (2013). For instance, using the “elbow methods”

(Thorndike, 1953), one can start the algorithm with one cluster, and increase the number of clusters until no more meaningful cluster is found (the corresponding chart has an elbow shape). This can be measured by the sum of the squared errors within the groups, or by the percentage of the explained variance (a goodness of fit index, equation (5.8)). In the previous example, as depicted in figure 5.10, having more than 3 clusters does not reduce the sum of squared errors within the clusters dramatically, nor does it increase the explained variance significantly. In this example, having 2 clusters results in a Manhattan-world scenario (97.5% percentage of explained variance). However, adding the 3rd cluster, takes the line segment with 70° orientation (highlighted in the figure) into account as well (99.5%

percentage of explained variance). The percentage of explained variance is high in both cases, and both results are acceptable, depending on the required details and the modeling accuracy.

 

 

k

K

2

k k

k 1 K N

2 k ,i k 1 i 1

1 N (x x)

Between groups variance K 1 Explained variance

Total variance 1

(x x)

N 1

  

  

 



(5.8)

In this equation, xk is the centroid (mean) of the kth cluster, x is the grand mean, Nk is the number of observations in the kth cluster, K is the total number of clusters, xk ,i is the ith observation in the kth cluster and N is the total number of observations. The between groups variance measures the variation of group means with respect to the grand mean; increasing the number of clusters, makes the between groups variance closer to the total variance. The explained variance in fact measures how good all the variances are explained, i.e. how good the predicted values fit the outcomes, in multivariate statistics.

In the next step, using a similar clustering process, line segments within each orientation cluster are grouped based on their distance to the origin of the projected image, so that the parallel line segments are distinguished (see figure 5.11). The distance threshold will be set automatically based on the

number of estimated clusters, or alternatively one can set it to a fix value depending on the modeling accuracy.

Line segments on the same direction are not necessarily adjacent; this can be caused by the situation where simply walls are nonadjacent, or due to occlusions in the point cloud that represents the same wall in multiple segments. The two cases are distinguished in the presented approach based on a tolerance according to the maximum expected size of occlusions in the data (except for the large occlusions caused by doors or windows). Therefore, a further clustering process is required to group (distinguish) the line segments laid on the same direction, but separated with a distance larger than the threshold. The threshold is set to 0.5m in the example depicted in figure 5.11.

Figure 5.10 – Clustering the orientation of lines by the K-means algorithm.

0 20 40 60 80 100 120 140

0 5 10 15 20 25 30 35 40 45

Orientations [deg]

Index of sorted line orientations

96342

2282 681 588 0

20000 40000 60000 80000 100000 120000

1 2 3 4

Sum of squared errors within the clusters [deg2]

Number of clusters

96.5 97.0 97.5 98.0 98.5 99.0 99.5 100.0

2 3 4

Percentage of explained variance (%)

Number of clusters

76 5. Automatic Reconstruction of Indoor Spaces

Figure 5.11 – Clustering the line segments (groups are distinguished by colors). Left to right: clustering based on the orientations, distinguishing parallel line segments laid on the same direction and finally distinguishing

nonadjacent line segments laid on the same direction.

Figure 5.12 – Averaging the line segments corresponding to individual walls.

After the assignment of the line segments to individual wall groups, they can be averaged within the groups. Averaging is realized by sampling the line segments (converting them to points), calculating the linear regression passing through the samples and cropping the resulting line according to the start and end points in the samples. Figure 5.12 depicts the averaging results for the same example.