## 4 The M_HERACLES Toolbox
### From Edifices to Architectural Elements (2): Automatic Segmentation of Building Framework  
This section describes an ongoing work on the automatic detection of beams in building frameworks. The rationale of this research path is the importance of building frames in the context of historical buildings, as they encapsulate the core of the construction knowledge and know-how of the builders [69]. The recent burning of Notre-Dame de Paris cathedral in April 2019 also emphasized importance in the documentation of the timber framework of other similar structures [70]. The automatic parametric modeling of wooden beams has been addressed in another research conducted by our group, as presented in [55]. However, in that research, the authors relied on total station measurements to automatically create parametric models of wooden beams. The idea between this particular part of M_HERACLES is to benefit from the availability of point cloud data, which is much faster to acquire and provides more data than traditional total station measurements. Although one might even argue for over-abundance of data in point clouds, the ease of acquisition of points clouds compared to traditional surveying is undeniable. Another similar work of automatic parametric modeling of wooden beams was presented in [71; 72]; indeed, the algorithm described in this section took inspiration from their approach. Contrary to the developments in Sections 4.1-4.3 where a 2.5D approach was taken, wooden beams present a truly 3D environment where a 2.5D approach was insufficient to solve. The algorithm described in this section therefore takes a departure from the previous lines of reasoning by considering the problem as a 3D one, while still taking notes from the previous algorithms. The idea behind the developed function is to first decompose the beam point clouds into facets. Afterwards, several geometric constraints were applied to extract the point cloud of individual beams from those of the facets. The functions were created to reach this point of the segmentation process. However, an optional third party library also enables the creating of parametric best-fit cuboids from the segmented beams. The overall workflow of the developed approach is described in Figure 12. The facet detection was performed using the region growing method. The theoretical primer of the region growing method is well known, and, in this case, we used the same approach as the Point Cloud Library (PCL) [73] but implemented it in Matlab\({}^{\copyright\). This implementation employs point cloud normals and curvatures as constraints, as opposed to the function pcsegdist in Matlab\({}^{\copyright\) which uses Euclidean distance as the principal constraint. Figure 11: Histogram representation of the quality parameters for the Valentino dataset comparing the results of [36] against M_HERACLES for the column class. The use of normals and curvature as constraints is important in order to distinguish the different facets. However, the use of a greedy region growing algorithm, implemented in all points, takes too much resource and computing time and is therefore impractical. A solution to this problem is a slight tweak in the algorithm to perform the region growing on octree bins instead of the points themselves [29]. A similar implementation of this algorithm was the fast-marching approach described in [74]. From our observations, this octree-based region growing has shown to increase the computing time up to a factor of 10. The post-segmented point cloud creates clusters of facets. However, in the case of L or Y-shaped facets, additional segmentation was necessary in order to segment the faces properly for each beam. In our approach, the facet cluster was projected into a 2D binary image via PCA (Principal Component Analysis) transformation, an approach similar to [44; 72]. Afterwards, a Hough Transform analysis was performed on the binary image in order to detect the edges.