The Extraction of Roof Feature Lines of Traditional Chinese Village Buildings Based on UAV Dense Matching Point Clouds

: Traditional Chinese buildings serve as a carrier for the inheritance of traditional culture and national characteristics. In the context of rural revitalization, achieving the 3D reconstruction of traditional village buildings is a crucial technical approach to promoting rural planning, improving living environments, and establishing digital villages. However, traditional algorithms primarily tar‑ get urban buildings, exhibiting limited adaptability and less ideal feature extraction performance for traditional residential buildings. As a result, guaranteeing the accuracy and reliability of 3D models for different types of traditional buildings remains challenging. In this paper, taking Jingping Village in Western Hunan as an example, we propose a method that combines multiple algorithms based on the slope segmentation of the roof to extract feature lines. Firstly, the VDVI and CSF algorithms are used to extract the building and roof point clouds based on the MVS point cloud. Secondly, accord‑ ing to roof features, village buildings are classified, and a 3D roof point cloud is projected into 2D regular grid data. Finally, the roof slope is segmented via slope direction, and internal and external feature lines are obtained after refinement through Canny edge detection and Hough straight line detection. The results indicate that the CSF algorithm can effectively extract the roofs of I‑shaped, L‑shaped, and U‑shaped traditional buildings. The accuracy of roof surface segmentation based on slope exceeds 99.6%, which is significantly better than the RANSAC algorithm and the region seg‑ mentation algorithm. This method is capable of efficiently extracting the characteristic lines of roofs in low‑rise buildings within traditional villages. It provides a reference method for achieving the high‑precision modeling of traditional village architecture at a low cost and with high efficiency.


Introduction
In January 2022, the Chinese government introduced "the 14th Five-Year Plan" with the aim of strengthening the digital economy through the integrated development of new smart cities and digital villages.As the most important artificial features, the 3D model of buildings is not only important data support for the planning and construction of smart cities and digital villages but also provides important technical means for the deformation monitoring of buildings [1], the protection of historical buildings [2], as well as virtual reality and augmented reality [3].Therefore, it is crucial to realize accurate and automated 3D reconstruction [4].The storage of the 3D geometric data of real-world buildings in digital models within computer systems has become more important in fields such as urban planning, intelligent buildings [5,6], digital cities, and project management.Currently, more than 200 cities in China, including Beijing and Shanghai, are engaged in the development of 3D models.Nevertheless, the development of accurate 3D models in rural regions of China has been hindered by obstacles such as the complexities of data collecting, exorbitant expenses, and the need for extensive coverage of vast areas.This has presented substantial challenges to the advancement of rural living conditions and the digitalization of rich cultural assets.Rural buildings play a vital role in digital villages, serving as an essential element for in-depth study and interactive operations in this research field.
Due to the rapid advancement of dense matching technology and aerial triangulation methods, the fully automated photogrammetric processing of nadir and oblique imagery obtained from low-altitude unmanned aerial vehicles (UAVs) has become more accurate and intelligent [7].The point clouds generated by multi-view stereo (MVS) have become the main source of 3D geographic information acquisition [8], which provides important support for 3D modeling [9], point cloud segmentation [10], topographic mapping [11], disaster monitoring [12], and resource management [13].Unlike LiDAR point clouds, MVS point clouds have the benefits of being more cost-effective, more efficient, and containing surface texture information [14].Due to their characteristics, these models are wellsuited for creating 3D representations of modest buildings.This offers a possible option for quickly and effectively reconstructing real-world structures in rural regions, particularly when it comes to classic buildings.MVS point clouds provide the opportunity to create very accurate models, allowing for the preservation and depiction of architectural heritage with great precision.This capacity has significant potential for expanding the field of rural spatial documentation and making a valuable contribution to the digital preservation of cultural resources.
At present, significant progress has been made in the research on building structures at both the domestic and international levels, covering the fields of structural analysis [15], mechanical properties [16,17] and structural monitoring [18], and 3D reconstruction.Within the realm of 3D model reconstruction, the process can be primarily categorized into two types: geometric model reconstruction and semantic model reconstruction [19].The process of geometric model reconstruction relies exclusively on the utilization of unprocessed point cloud data, leading to the creation of rudimentary models that contain solely geometric information.On the other hand, semantic model reconstruction not only includes geometric information but also involves the recognition of semantic features, including location, orientation, color, texture, shape, and specific attributes that enable the segmentation of building structures.In semantic model reconstruction, feature line extraction is a key operation in geometric model processing.The feature points, lines, and surfaces of a building are important parameters for describing and reconstructing the building, while the feature lines can be regarded as a link between the feature points and the feature surfaces [20], which contain information about the boundary contours of each slope of the roof.Precisely extracting the roof lines of structures is essential for the precise reconstruction of a 3D model of a building.This has become a pressing issue that requires immediate resolution.
Feature line extraction has two main components: exterior outline lines and internal roof feature lines.The extraction of edge outlines is often dependent on high-resolution remote sensing photos and aerial LiDAR point cloud data from the perspective of data sources.Furthermore, study approaches predominantly encompass a priori knowledge principles and advanced machine learning techniques.The former primarily emphasizes fundamental architectural elements such as spectra, textures, shapes, and spatial interactions to enhance the extraction process [21][22][23].These methods heavily rely on the quality of imagery and point cloud data and demonstrate good detection performance only for specific types or certain regions of buildings.Since the 1980s and 1990s, machine learning technology has seen rapid development and has played an important role in the fields of architectural design [24], feature extraction [25], and structural health monitoring [26,27].Some researchers have achieved notable advancements in classifying different land features by utilizing techniques such as K-nearest neighbors, support vector machines, de-cision trees, and others.These methods have created new opportunities for categorizing land features and have yielded encouraging outcomes.Deep learning has gained significant attention in recent years, leading to a growing interest in neural network models, including Mask R-CNN [28], FCN [29], and PointNet [30].Regardless of whether it is the initial phases of machine learning or the more recent progress in deep learning, there have been notable enhancements in the precision and effectiveness of land feature identification.Nevertheless, these techniques still necessitate extensive labeled datasets in order to train classifiers.Annotating data requires substantial human resources, time, and effort [31], and most datasets available are mostly centered on urban areas, with limited representation of rural regions.This constraint impedes the advancement of efficient and universally applicable models for identifying the terrain features in rural regions.Immediate action is necessary to rectify this deficiency and facilitate the accessibility of varied datasets that encompass rural environments.
Meanwhile, the process of identifying internal feature lines mostly depends on the use of airborne LiDAR point cloud data.This involves several phases, including segmenting the point cloud data related to roofs, fitting planes, extracting contours, and ensuring regularity.Several techniques are employed, such as the Hough transform [32,33], regiongrowing algorithm [34,35], clustering method [36,37], and RANSAC [38,39].However, these algorithms frequently and significantly depend on normal vectors and curvature thresholds, which may lead to false planes and threshold sensitivity [40].In addition, the topological relationship between each plane needs to be judged during plane fitting and contour line extraction.Moreover, research in this field often relies on publicly available datasets such as those provided by ISPRS or airborne LiDAR point cloud data [41].The primary focus of these studies is to meet the requirements for the 3D reconstruction of large urban buildings according to the LoD300 specification.As a result, these datasets and research objectives are not compatible with the modeling requirements of small rural buildings.
Traditional villages serve as significant repositories of historical and cultural memory for the Chinese population.They encapsulate the wisdom of production and existence, the crystallization of vernacular art, and the distinctive qualities of the nation's regions.Therefore, these are essential objectives for digital preservation in the attempts to conserve cultural assets.Liu and Deng introduced digital protection as a novel method for preserving historical and cultural towns and villages [42].However, there have been limited studies conducted on the 3D reconstruction of traditional villages.Although some researchers have utilized UAV tilt photography to accomplish the immediate 3D digital preservation of villages [43], this method faces challenges in producing accurate 3D models due to the intricate architectural designs and the presence of mountains and hills in typical traditional villages.Unlike urban buildings and general rural buildings, traditional villages are affected by the natural environment and social and cultural factors, and most of the ancient dwellings are mainly low-rise buildings with wooden or brick structures.The roofs are divided into dozens of sloping roof forms such as hard hills, hiatus, rolled sheds, etc.Several single buildings are combined to form a triad.Several monolithic buildings are combined to form unique Chinese courtyard structures, such as triple and quadrangle courtyards, with clear internal and external partitions and distinctive spatial layouts.In the western Hunan of China, most of the traditional villages are located in remote areas, and they are mainly ancient buildings of the Ming and Qing dynasties or ethnic minority villages, with one to three-story hard and overhanging roofs, constituting very characteristic one-entry, two-entry, and three-entry courtyards.At present, there are fewer studies on the 3D reconstruction of traditional villages and even fewer on semantic reconstruction.On the one hand, since most of the traditional villages are located in hilly areas, it is difficult to collect remote sensing images and point cloud data, and the publicly available Lidar point cloud datasets are fewer in number and have poorer accuracy.Whether based on images or point clouds, the algorithms described in the previous section are less adaptable to the extraction of the traditional village buildings, making it difficult to accurately identify buildings and their roofs and, even more so, to effectively extract the feature lines.On the other hand, due to the complexity of the building structure, the accuracy of the 3D model automatically generated from the photographs obtained using UAV tilt photography is poor, which makes it difficult to ensure the accuracy and reliability of the 3D models of different types of traditional buildings, and it is not possible to interact with them, which is detrimental to further analyses and processing at a later stage.Considering this, the current study focuses on Jingping Village, a typical traditional village in Western Hunan.The MVS point clouds generated using UAV tilt photography technology are processed using various algorithms, such as the visible-band difference vegetation index (VDVI), cloth simulation filter (CSF), and slope segmentation algorithms.This allows for the isolation and segmentation of building point clouds, roof point clouds, and roof slopes in a sequential manner.Subsequently, the Canny algorithm and Hough transform are employed to extract the roof feature lines.By employing this approach, it is possible to achieve the accurate modeling of different building typologies in traditional village settings.This ensures a basic guarantee for the design of rural living spaces and the establishment of digital village infrastructure, thereby promoting the revival and renewal of rural areas.
In this paper, the second section primarily discusses the technical approach and methods used in this study.The third section showcases the results obtained at each stage using the aforementioned methods and compares our approach with two alternative methods, thereby validating the superiority or inferiority of our proposed method.Finally, the fourth section concludes the paper by highlighting its limitations and suggesting future research directions.

Methods
For the unique traditional Chinese village buildings, the article needs to consider the following 2 challenges: one is to solve the point cloud data problem, and the other is to adopt a new method to compensate for the inability of previous algorithms to accurately delineate the roof surface of low-slope buildings, so as to accurately extract the feature lines.For this reason, we designed the following line of research.Firstly, high-resolution orthophotos and raw color point cloud data were generated by processing the raw data from tilt photography using the aerial triangulation method.Secondly, the building point cloud was extracted using the VDVI and CSF algorithms, and the building morphology was classified into types based on the orthophoto.A single example of each building type was selected for the roof feature line extraction experiment, and then the roof point cloud was extracted using the CSF algorithm.Finally, the roof point cloud was converted into regular grid data, and the slope direction of the different faces was calculated, followed by reclassification to obtain the final roof slope direction.The final roof feature line was obtained using Canny edge detection and Hough line detection.Figure 1 illustrates the technological method.

Building Point Cloud Extraction
The extraction of the building point cloud was achieved using a hierarchical approach that involved progressive classification.The point cloud data was pre-processed, and then the VDVI and CSF algorithms were used to eliminate the vegetation and ground point cloud.Finally the building point cloud is extracted.

VDVI
Wang analyzed the spectral characteristics of green vegetation and non-vegetation on the unmanned aerial vehicle imagery and constructed a vegetation index (VDVI) by observing the differences in reflectance between the bands [44].It combines the reflectance of vegetation in the green light band and the absorption in the red and blue light bands, and its form is similar to that of NDVI, which can better distinguish vegetation from nonvegetation.The index has achieved significant applications in vegetation information extraction based on visible-band UAV remote sensing, such as desert vegetation extraction [45] and wheat cover calculation [46].The value range of the distribution was observed to have clear bimodal features.The segmentation threshold was defined as the minimum value in the valley between the two peaks of the bimodal distribution.Vegetation indices that exceeded the specified threshold were categorized as vegetation, and those that fell below the threshold were classified as non-vegetation.The formula for calculating the VDVI is as follows: where R, G, and B are the red, green, and blue band values, respectively.

CSF Algorithm
The CSF algorithm was proposed by Zhang Wu Ming in 2016 and is widely recognized by scholars for its simple model, few algorithmic parameters, fast iteration speed, and high filtering accuracy [47].On the one hand, some scholars compared the algorithm with traditional point cloud filtering and found that the algorithm has obvious advantages on flat terrain [48].On the other hand, in order to adapt to terrain areas with different degrees of undulation, some scholars combined it with other filtering methods, such as based on irregular triangular mesh [49] and surface interpolation [50], which in turn improved the filtering accuracy.The underlying principle involves modeling a virtual cloth draped over irregular terrain where gravity causes it to change shape and descend, as

Building Point Cloud Extraction
The extraction of the building point cloud was achieved using a hierarchical approach that involved progressive classification.The point cloud data was pre-processed, and then the VDVI and CSF algorithms were used to eliminate the vegetation and ground point cloud.Finally the building point cloud is extracted.

VDVI
Wang analyzed the spectral characteristics of green vegetation and non-vegetation on the unmanned aerial vehicle imagery and constructed a vegetation index (VDVI) by observing the differences in reflectance between the bands [44].It combines the reflectance of vegetation in the green light band and the absorption in the red and blue light bands, and its form is similar to that of NDVI, which can better distinguish vegetation from nonvegetation.The index has achieved significant applications in vegetation information extraction based on visible-band UAV remote sensing, such as desert vegetation extraction [45] and wheat cover calculation [46].The value range of the distribution was observed to have clear bimodal features.The segmentation threshold was defined as the minimum value in the valley between the two peaks of the bimodal distribution.Vegetation indices that exceeded the specified threshold were categorized as vegetation, and those that fell below the threshold were classified as non-vegetation.The formula for calculating the VDVI is as follows: where R, G, and B are the red, green, and blue band values, respectively.

CSF Algorithm
The CSF algorithm was proposed by Zhang Wu Ming in 2016 and is widely recognized by scholars for its simple model, few algorithmic parameters, fast iteration speed, and high filtering accuracy [47].On the one hand, some scholars compared the algorithm with traditional point cloud filtering and found that the algorithm has obvious advantages on flat terrain [48].On the other hand, in order to adapt to terrain areas with different degrees of undulation, some scholars combined it with other filtering methods, such as based on irregular triangular mesh [49] and surface interpolation [50], which in turn improved the filtering accuracy.The underlying principle involves modeling a virtual cloth draped over irregular terrain where gravity causes it to change shape and descend, as illustrated in Figure 2. By adjusting the stiffness of the virtual cloth, the final output can be either a DSM or DTM.The position of each particle on the "cloth" is determined by the internal forces and gravity, resulting in constrained vertical movement, as depicted in Figure 3.In accordance with Figure 3b, the gravitational force first induces particle descent.Once these particles drop below the ground level, they are denoted as immovable and affixed to their respective positions in Figure 3c.Subsequently, inter-particle forces align each point by utilizing neighboring points to exert an upward tension, leading to a vertical displacement of the particles, outlined in Figure 3d.The positional determination of each particle is established definitively through repetitive up and down motions until a target point is achieved.The primary parameters for the CSF algorithm encompass four elements: namely, the grid resolution (GR) for calculating the horizontal distance between the particles, time iteration increments (DT) for particle motion along the gravity axis during the simulation events, softness rigidity value (RI) relative to textile materials, and finally the threshold height (HT) separating the ground points from non-ground after sorting operations take place [51].
Buildings 2024, 14, x FOR PEER REVIEW 6 of 17 illustrated in Figure 2. By adjusting the stiffness of the virtual cloth, the final output can be either a DSM or DTM.The position of each particle on the "cloth" is determined by the internal forces and gravity, resulting in constrained vertical movement, as depicted in Figure 3.In accordance with Figure 3b, the gravitational force first induces particle descent.Once these particles drop below the ground level, they are denoted as immovable and affixed to their respective positions in Figure 3c.Subsequently, inter-particle forces align each point by utilizing neighboring points to exert an upward tension, leading to a vertical displacement of the particles, outlined in Figure 3d.The positional determination of each particle is established definitively through repetitive up and down motions until a target point is achieved.The primary parameters for the CSF algorithm encompass four elements: namely, the grid resolution (GR) for calculating the horizontal distance between the particles, time iteration increments (DT) for particle motion along the gravity axis during the simulation events, softness rigidity value (RI) relative to textile materials, and finally the threshold height (HT) separating the ground points from non-ground after sorting operations take place [51].Buildings 2024, 14, x FOR PEER REVIEW 6 of 17 illustrated in Figure 2. By adjusting the stiffness of the virtual cloth, the final output can be either a DSM or DTM.The position of each particle on the "cloth" is determined by the internal forces and gravity, resulting in constrained vertical movement, as depicted in Figure 3.In accordance with Figure 3b, the gravitational force first induces particle descent.Once these particles drop below the ground level, they are denoted as immovable and affixed to their respective positions in Figure 3c.Subsequently, inter-particle forces align each point by utilizing neighboring points to exert an upward tension, leading to a vertical displacement of the particles, outlined in Figure 3d.The positional determination of each particle is established definitively through repetitive up and down motions until a target point is achieved.The primary parameters for the CSF algorithm encompass four elements: namely, the grid resolution (GR) for calculating the horizontal distance between the particles, time iteration increments (DT) for particle motion along the gravity axis during the simulation events, softness rigidity value (RI) relative to textile materials, and finally the threshold height (HT) separating the ground points from non-ground after sorting operations take place [51].

Roof point Cloud Segmentation 2.2.1. Roof Point Cloud Extraction
The CSF algorithm has gained considerable attention as a widely utilized filtering method, with various experts confirming its exceptional effectiveness.Recent investigations have shown that the approach is effective in precisely dividing point clouds on flatroofed structures.This was proved in Wang et al.'s research on extracting buildings from UAV oblique photography point clouds using a cloth simulation [52].Building upon this encouraging discovery, this work utilized the CSF method to extract sloped roofs on conventional buildings.The experiment solely utilized the CSF algorithm, with modifications applied to its parameters for multiple rounds of trials.

Slope Segmentation
This paper presents a new way to address the limitations of existing algorithms for roof segmentation, which heavily depend on normal vectors and curvature thresholds [53].The proposed method utilizes slope direction features to offset these influences.More precisely, the technique divides the roof surface by utilizing the unique characteristics of the slope direction of building roofs.By mapping the initial point cloud onto a standardized grid and employing a smoothing technique to remove the irregularities, the value assigned to each grid pixel indicates the average value of the corresponding points in the point cloud.In order to streamline the data structure, the procedure of identifying the feature lines shifted from 3D point cloud processing to 2D picture detection.This approach not only effectively integrates with existing picture segmentation algorithms but also improves experimental efficiency.
The study defines the direction of a slope as the angle formed by the horizontal plane and the projection of the normal to the tangent plane of a specific location on the surface.The resulting value is indicated as the cardinal direction at that particular geographical position.The measurement is performed in a clockwise manner, with values ranging from 0 (representing due north) to 360 (still indicating due north), as depicted in Figure 4.If an area is flat and does not have a downward slope, it is assigned a value of −1 to indicate a horizontal surface.In order to determine the direction of the slope for each center unit, a 3 × 3 moving window is utilized, as depicted in Figure 5.The computation formula is presented below: where D e denotes the slope direction of the image element e, α denotes the conversion coefficient between radians and degrees, the specific calculation can be taken as 57.29578, and A and B are the rate of change of the image element e in the x and y direction; the formula is as follows: where a, b, c, d, e, f, g, h, and i are the individual image values.After determining the slope direction, a conversion is carried out to change the slope data into compass direction values using recognized rules.Since the roofs of traditional village buildings typically have double or four-sloped designs, there is no need to perform a detailed analysis of individual raster values in the tests conducted in this work.To simplify, we gathered the slope direction values of similar slopes and adjusted them to produce either two or four different slope directions in the raster.

Feature Line Extraction
The process of extracting feature lines primarily involves identifying the external outlines and internal ridge lines.These lines act as the demarcations for each inclined surface on the roof.The Canny algorithm, introduced by John F. Canny in 1986 [54], is a renowned and sophisticated method for detecting edges in images [55].The Canny operator for edge detection consists of five primary processes: Gaussian smoothing for noise reduction, the computation of pixel gradients, non-maximum suppression, double thresholding to identify prospective edge points, and finally, the tracking of lagging edge points.These steps are performed in the specified order.Recently, some academics have made enhancements to the Canny algorithm, resulting in enhanced accuracy to some degree [56].However, this paper solely employed edge detection on either two or four inclines of the roof, and the image content was very uncomplicated with limited intricacy.Thus, adjusting the size of the Gaussian filter and the high and low thresholds was sufficient to yield better results in the experiments.

Experimental Data
Jingping Village, located in Hunan Province, China, is an ancient settlement with a rich heritage deeply rooted in history and culture.This village has received prestigious distinction as a national key cultural relics protection unit and has been certified as a traditional Chinese village of the fourth batch.It has been meticulously kept for over a thousand years and showcases magnificent clusters of buildings from the Ming and Qing dynasties.Jingping Village showcases a unique combination of water, farmland, and woodlands, demonstrating the harmonious relationship between humans and nature.It also exemplifies the key characteristics of traditional villages in Western Hunan.

Feature Line Extraction
The process of extracting feature lines primarily involves identifying the external outlines and internal ridge lines.These lines act as the demarcations for each inclined surface on the roof.The Canny algorithm, introduced by John F. Canny in 1986 [54], is a renowned and sophisticated method for detecting edges in images [55].The Canny operator for edge detection consists of five primary processes: Gaussian smoothing for noise reduction, the computation of pixel gradients, non-maximum suppression, double thresholding to identify prospective edge points, and finally, the tracking of lagging edge points.These steps are performed in the specified order.Recently, some academics have made enhancements to the Canny algorithm, resulting in enhanced accuracy to some degree [56].However, this paper solely employed edge detection on either two or four inclines of the roof, and the image content was very uncomplicated with limited intricacy.Thus, adjusting the size of the Gaussian filter and the high and low thresholds was sufficient to yield better results in the experiments.

Experimental Data
Jingping Village, located in Hunan Province, China, is an ancient settlement with a rich heritage deeply rooted in history and culture.This village has received prestigious distinction as a national key cultural relics protection unit and has been certified as a traditional Chinese village of the fourth batch.It has been meticulously kept for over a thousand years and showcases magnificent clusters of buildings from the Ming and Qing dynasties.Jingping Village showcases a unique combination of water, farmland, and woodlands, demonstrating the harmonious relationship between humans and nature.It also exemplifies the key characteristics of traditional villages in Western Hunan.

Feature Line Extraction
The process of extracting feature lines primarily involves identifying the external outlines and internal ridge lines.These lines act as the demarcations for each inclined surface on the roof.The Canny algorithm, introduced by John F. Canny in 1986 [54], is a renowned and sophisticated method for detecting edges in images [55].The Canny operator for edge detection consists of five primary processes: Gaussian smoothing for noise reduction, the computation of pixel gradients, non-maximum suppression, double thresholding to identify prospective edge points, and finally, the tracking of lagging edge points.These steps are performed in the specified order.Recently, some academics have made enhancements to the Canny algorithm, resulting in enhanced accuracy to some degree [56].However, this paper solely employed edge detection on either two or four inclines of the roof, and the image content was very uncomplicated with limited intricacy.Thus, adjusting the size of the Gaussian filter and the high and low thresholds was sufficient to yield better results in the experiments.

Experimental Data
Jingping Village, located in Hunan Province, China, is an ancient settlement with a rich heritage deeply rooted in history and culture.This village has received prestigious distinction as a national key cultural relics protection unit and has been certified as a traditional Chinese village of the fourth batch.It has been meticulously kept for over a thousand years and showcases magnificent clusters of buildings from the Ming and Qing dynasties.Jingping Village showcases a unique combination of water, farmland, and woodlands, demonstrating the harmonious relationship between humans and nature.It also exemplifies the key characteristics of traditional villages in Western Hunan.
In August 2019, the author collected precise point cloud data of the village MVS using a Zhonghaida iFly D1 quadcopter UAV.The UAV was equipped with an iCam Q5 mini five-lens tilt camera and a UAV-PPK receiver, which had a high-resolution camera with 120 million effective pixels (24 million × 5).A comprehensive investigation was conducted in the experimental region, deliberately establishing control sites and tactically mapping out pathways.As a result of this endeavor, we were able to obtain orthophotos with a resolution of roughly 1.5 cm, as well as an estimated 320 million point cloud data of the hamlet.The main building area, which included around 180 million building point clouds, measured approximately 0.21 km 2 after the necessary crop.The building point cloud had a density of approximately 900 points per square meter, while the roof point cloud had a density of roughly 400 points per square meter.This indicates a high level of density and accuracy.The flight parameters used for this study are shown in Table 1.

Building Point Cloud Extraction and Typology
Due to the large area covered by Jingping Village and the significant amount of point cloud data, only three specific locations were chosen to identify the buildings.Significantly, when the value of the VDVI became very close to zero, a specific set of CSF algorithm parameters was established using rigorous experimentation: a GR value of 0.5, a DT value of 0.5, a RI value of 1, and an HD value of 0.5, as demonstrated in Figure 6.The act of removing the plants and ground features using the VDVI and CSF techniques resulted in the enhanced accuracy of producing point cloud data in different situations.Nevertheless, there were still some small disturbances, such as a fence and unnecessary points.
In August 2019, the author collected precise point cloud data of the village MVS using a Zhonghaida iFly D1 quadcopter UAV.The UAV was equipped with an iCam Q5 mini five-lens tilt camera and a UAV-PPK receiver, which had a high-resolution camera with 120 million effective pixels (24 million × 5).A comprehensive investigation was conducted in the experimental region, deliberately establishing control sites and tactically mapping out pathways.As a result of this endeavor, we were able to obtain orthophotos with a resolution of roughly 1.5 cm, as well as an estimated 320 million point cloud data of the hamlet.The main building area, which included around 180 million building point clouds, measured approximately 0.21 km 2 after the necessary crop.The building point cloud had a density of approximately 900 points per square meter, while the roof point cloud had a density of roughly 400 points per square meter.This indicates a high level of density and accuracy.The flight parameters used for this study are shown in Table 1.

Building Point Cloud Extraction and Typology
Due to the large area covered by Jingping Village and the significant amount of point cloud data, only three specific locations were chosen to identify the buildings.Significantly, when the value of the VDVI became very close to zero, a specific set of CSF algorithm parameters was established using rigorous experimentation: a GR value of 0.5, a DT value of 0.5, a RI value of 1, and an HD value of 0.5, as demonstrated in Figure 6.The act of removing the plants and ground features using the VDVI and CSF techniques resulted in the enhanced accuracy of producing point cloud data in different situations.Nevertheless, there were still some small disturbances, such as a fence and unnecessary points.
The building arrangements of Jingping Village can be classified into four unique styles: I-shaped, L-shaped (featuring two internal courtyards), U-shaped (comprising three internal courtyards), and "回"-shaped (embodying four internal courtyards), as shown in Figure 7.The building arrangements of Jingping Village can be classified into four unique styles: I-shaped, L-shaped (featuring two internal courtyards), U-shaped (comprising three internal courtyards), and "回"-shaped (embodying four internal courtyards), as shown in Figure 7.

Roof Extraction and Slope Segmentation
During the process of removing the vegetation point cloud, it was discovered that taller trees obscured the local information of the roofs due to limitations in the UAV tilt photography technology.To address this issue, one more complete building from each roof type, as shown in Figure 7, was selected for the feature line extraction experiment.The impact of the GR value on the extraction effect of the roofs in the CSF algorithm was examined and found to have a significant influence.As an example, I-shaped roofs were used, and changing the GR value while keeping the other values constant resulted in the best extraction effect being achieved when the GR was set to 0.1, as demonstrated in Figure 8.This approach was then applied to obtain all types of roof point clouds, presented in Figure 9.However, upon closer examination, a redundant point cloud was noted at the eaves of different roofs.The reason for this is that elevation information in this area cannot be captured during tilt photography, resulting in the absence of clear point cloud data during the aerial triangulation solution.Additionally, the ancestral hall of Jingping Village, depicted in Figure 9d, has higher surrounding walls than the roof, leading to partial voids in the area of the walls.Consequently, the application of the CSF algorithm to extract the roof of the building did not guarantee roof integrity.

Roof Extraction and Slope Segmentation
During the process of removing the vegetation point cloud, it was discovered that taller trees obscured the local information of the roofs due to limitations in the UAV tilt photography technology.To address this issue, one more complete building from each roof type, as shown in Figure 7, was selected for the feature line extraction experiment.The impact of the GR value on the extraction effect of the roofs in the CSF algorithm was examined and found to have a significant influence.As an example, I-shaped roofs were used, and changing the GR value while keeping the other values constant resulted in the best extraction effect being achieved when the GR was set to 0.1, as demonstrated in Figure 8.This approach was then applied to obtain all types of roof point clouds, presented in Figure 9.However, upon closer examination, a redundant point cloud was noted at the eaves of different roofs.The reason for this is that elevation information in this area cannot be captured during tilt photography, resulting in the absence of clear point cloud data during the aerial triangulation solution.Additionally, the ancestral hall of Jingping Village, depicted in Figure 9d, has higher surrounding walls than the roof, leading to partial voids in the area of the walls.Consequently, the application of the CSF algorithm to extract the roof of the building did not guarantee roof integrity.

Roof Extraction and Slope Segmentation
During the process of removing the vegetation point cloud, it was discovered that taller trees obscured the local information of the roofs due to limitations in the UAV tilt photography technology.To address this issue, one more complete building from each roof type, as shown in Figure 7, was selected for the feature line extraction experiment.The impact of the GR value on the extraction effect of the roofs in the CSF algorithm was examined and found to have a significant influence.As an example, I-shaped roofs were used, and changing the GR value while keeping the other values constant resulted in the best extraction effect being achieved when the GR was set to 0.1, as demonstrated in Figure 8.This approach was then applied to obtain all types of roof point clouds, presented in Figure 9.However, upon closer examination, a redundant point cloud was noted at the eaves of different roofs.The reason for this is that elevation information in this area cannot be captured during tilt photography, resulting in the absence of clear point cloud data during the aerial triangulation solution.Additionally, the ancestral hall of Jingping Village, depicted in Figure 9d, has higher surrounding walls than the roof, leading to partial voids in the area of the walls.Consequently, the application of the CSF algorithm to extract the roof of the building did not guarantee roof integrity.

Roof Extraction and Slope Segmentation
During the process of removing the vegetation point cloud, it was discovered that taller trees obscured the local information of the roofs due to limitations in the UAV tilt photography technology.To address this issue, one more complete building from each roof type, as shown in Figure 7, was selected for the feature line extraction experiment.The impact of the GR value on the extraction effect of the roofs in the CSF algorithm was examined and found to have a significant influence.As an example, I-shaped roofs were used, and changing the GR value while keeping the other values constant resulted in the best extraction effect being achieved when the GR was set to 0.1, as demonstrated in Figure 8.This approach was then applied to obtain all types of roof point clouds, presented in Figure 9.However, upon closer examination, a redundant point cloud was noted at the eaves of different roofs.The reason for this is that elevation information in this area cannot be captured during tilt photography, resulting in the absence of clear point cloud data during the aerial triangulation solution.Additionally, the ancestral hall of Jingping Village, depicted in Figure 9d, has higher surrounding walls than the roof, leading to partial voids in the area of the walls.Consequently, the application of the CSF algorithm to extract the roof of the building did not guarantee roof integrity.To mitigate the influence of the threshold setting on the plane segmentation observed in previous studies, we propose a novel approach whereby point cloud data is projected onto a flat raster and smoothed before the slope calculation.Among the four types of roofs mentioned above, the extraction effect of the "回"-shaped roofs was poor, and due to the existence of the mountain wall, it was impossible to segment the slope direction.Therefore, in this paper, based on manually removing the redundant point clouds of the eaves, only three buildings selected from each of the first three types of building roofs were experimented with.These three types of roofs are the main types of building roofs in Jingping Village.The three typical selected roofs have approximate point cloud densities, and only part of the roof is retained to ensure balance between the three datasets.Since the traditional village buildings' roof tiles are concave and convex, our slope direction calculation produced eight initial directions, which were subsequently reclassified into a two-slope or four-slope map.As depicted in Figure 10, the L-shaped roof consists of four slopes, which are further divided into eight directions.Specifically, the west and northwest directions form one slope ranging from 247.5 • to 337.5 • , the east and south-east directions form another slope ranging from 67.5 • to 157.5 • , the southern and south-west directions form a third slope ranging from 157.5 • to 247.5 • , and the north and north-east directions form the fourth slope ranging from 0 • to 67.5 • and 337.5 • to 360 • , as shown in Figure 11.These directions align precisely with the four clustered distributions illustrated in Figure 11.Therefore, by utilizing the angles of 67.5 • , 157.5 • , 247.5 • , and 337.5 • , we could classify and differentiate the four slopes of the L-shaped roof.Nonetheless, the reclassified raster slope directions may contain a small number of misclassified stray points at the edges and intersections, which require additional smoothing and denoising to avoid negatively affecting downstream detection.Our method's segmentation results were compared to those yielded using traditional RANSAC and region segmentation algorithms to verify their effectiveness.To mitigate the influence of the threshold setting on the plane segmentation observed in previous studies, we propose a novel approach whereby point cloud data is projected onto a flat raster and smoothed before the slope calculation.Among the four types of roofs mentioned above, the extraction effect of the "回"-shaped roofs was poor, and due to the existence of the mountain wall, it was impossible to segment the slope direction.Therefore, in this paper, based on manually removing the redundant point clouds of the eaves, only three buildings selected from each of the first three types of building roofs were experimented with.These three types of roofs are the main types of building roofs in Jingping Village.The three typical selected roofs have approximate point cloud densities, and only part of the roof is retained to ensure balance between the three datasets.Since the traditional village buildings' roof tiles are concave and convex, our slope direction calculation produced eight initial directions, which were subsequently reclassified into a twoslope or four-slope map.As depicted in Figure 10, the L-shaped roof consists of four slopes, which are further divided into eight directions.Specifically, the west and northwest directions form one slope ranging from 247.5° to 337.5°, the east and south-east directions form another slope ranging from 67.5° to 157.5°, the southern and south-west directions form a third slope ranging from 157.5° to 247.5°, and the north and north-east directions form the fourth slope ranging from 0° to 67.5° and 337.5° to 360°, as shown in Figure 11.These directions align precisely with the four clustered distributions illustrated in Figure 11.Therefore, by utilizing the angles of 67.5°, 157.5°, 247.5°, and 337.5°, we could classify and differentiate the four slopes of the L-shaped roof.Nonetheless, the reclassified raster slope directions may contain a small number of misclassified stray points at the edges and intersections, which require additional smoothing and denoising to avoid negatively affecting downstream detection.Our method's segmentation results were compared to those yielded using traditional RANSAC and region segmentation algorithms to verify their effectiveness.According to Equations ( 5)-( 7), the R, P, and F of the roof extraction of the three types of buildings in Jingping Village were calculated, and the confusion matrix was plotted, as shown in Figure 12.As can be seen in Figure 12, there are 30,713 pixel points for the Ishaped roof, 6712 pixel points for the L-shaped roof, and 26,728 pixel points for the Ushaped roof, and the three types of roofs achieved 99.59%, 99.30%, and 99.80% and 99.79%, 99.65%, and 99.90% for F and P, respectively.It is worth noting that since the redundant point cloud was manually presented in the previous section, there are no pixel points that are not roofs, and high F and P values were obtained, so the two lower space values of the confusion matrix are both 0 and the R values are both 1.where TP is the number of correctly segmented raster pixels, FN is the number of missed raster pixels, FP is the number of incorrectly segmented raster pixels, R is the recall rate, P is the accuracy rate, and F is the measure.According to Equations ( 5)-( 7), the R, P, and F of the roof extraction of the three types of buildings in Jingping Village were calculated, and the confusion matrix was plotted, as shown in Figure 12.As can be seen in Figure 12, there are 30,713 pixel points for the I-shaped roof, 6712 pixel points for the L-shaped roof, and 26,728 pixel points for the Ushaped roof, and the three types of roofs achieved 99.59%, 99.30%, and 99.80% and 99.79%, 99.65%, and 99.90% for F and P, respectively.It is worth noting that since the redundant point cloud was manually presented in the previous section, there are no pixel points that are not roofs, and high F and P values were obtained, so the two lower space values of the confusion matrix are both 0 and the R values are both 1.
where TP is the number of correctly segmented raster pixels, FN is the number of missed raster pixels, FP is the number of incorrectly segmented raster pixels, R is the recall rate, P is the accuracy rate, and F is the measure.It is noteworthy that, owing to the high precision of the data, the recategorized slope direction raster might exhibit a marginal number of erroneously classified outlying points at the edges and intersections of two slope directions, namely, inaccurately segmented raster pixels.These artifacts may exert a certain impact on the ensuing detection procedures and thus must be subjected to subsequent smoothing and denoising processes.To ascertain the effectiveness of this approach, Figure 13 and Table 2 were produced by comparing its segmentation outcomes with the conventional RANSAC and region segmentation algorithms.
% 100 * 2 P R RP F + = (7) where TP is the number of correctly segmented raster pixels, FN is the number of missed raster pixels, FP is the number of incorrectly segmented raster pixels, R is the recall rate, P is the accuracy rate, and F is the measure.ally roofs but classified as non-roofs.The lower left corner represents the number of grids that are actually non-roofs but classified as roofs, and the lower right corner represents the number of grids that are actually non-roofs and classified as non-roofs.
It is noteworthy that, owing to the high precision of the data, the recategorized slope direction raster might exhibit a marginal number of erroneously classified outlying points at the edges and intersections of two slope directions, namely, inaccurately segmented raster pixels.These artifacts may exert a certain impact on the ensuing detection procedures and thus must be subjected to subsequent smoothing and denoising processes.To ascertain the effectiveness of this approach, Figure 13 and Table 2 were produced by comparing its segmentation outcomes with the conventional RANSAC and region segmentation algorithms.Based on the results presented in Figure 13 and Table 2, our proposed method demonstrates significant improvements over both the RANSAC algorithm and the region segmentation algorithm.Firstly, all three algorithms exhibit comparable performance in terms of computational efficiency due to the small size of the input data.Secondly, regarding segmentation accuracy, neither the RANSAC algorithm nor the region segmentation  Based on the results presented in Figure 13 and Table 2, our proposed method demonstrates significant improvements over both the RANSAC algorithm and the region segmen-tation algorithm.Firstly, all three algorithms exhibit comparable performance in terms of computational efficiency due to the small size of the input data.Secondly, regarding segmentation accuracy, neither the RANSAC algorithm nor the region segmentation algorithm succeeded in accurately segmenting the facets of simple I-shaped or slightly more complex U-shaped roofs.Instead, these algorithms exhibited varying degrees of under and oversegmentation on either type of roof.In addition, based on the point cloud data analysis, the region segmentation algorithm demonstrated a higher tendency toward undersegmentation when compared to the RANSAC algorithm.For instance, as shown in Figure 13, the inner sides of both L-shaped and U-shaped roofs were segmented into single planes, and the resulting segmented roofs showed greater noise due to restricted data accuracy.Furthermore, during the experiment, it was observed that the RANSAC algorithm produced inconsistent results under identical parameter settings, indicating significant deviations and instability.
Using the direction of the slope, the successful segmentation of all slopes was achieved in all three types of roof segmentation, resulting in improved outcomes.Though there were several instances of missegmentation, such occurrences did not adversely affect the overall effects compared to the area segmentation algorithm.Furthermore, after denoising, a complete representation of the various roof slopes was obtained.It should be noted that during experimentation, the first two algorithms were directly based on point cloud segmentation, resulting in neater planar edges.In contrast, slope segmentation relied on raster images after point cloud projection, leading to rougher edge contours due to lower raster resolution.However, this issue could be eliminated by regularization in subsequent feature line extraction.

Feature Line Extraction and Regularisation
The slope direction map was subjected to sequential analysis involving Canny edge detection and Hough line detection.After further refinement and regularization, the resulting feature line extraction map is presented in Figure 14.Our approach offers commendable results in extracting the feature lines of various roof configurations, particularly double-sloped and multi-sloped roofs commonly found in low-rise traditional village buildings.
Buildings 2024, 14, x FOR PEER REVIEW 14 of 17 algorithm succeeded in accurately segmenting the facets of simple I-shaped or slightly more complex U-shaped roofs.Instead, these algorithms exhibited varying degrees of under and oversegmentation on either type of roof.In addition, based on the point cloud data analysis, the region segmentation algorithm demonstrated a higher tendency toward undersegmentation when compared to the RANSAC algorithm.For instance, as shown in Figure 13, the inner sides of both L-shaped and U-shaped roofs were segmented into single planes, and the resulting segmented roofs showed greater noise due to restricted data accuracy.Furthermore, during the experiment, it was observed that the RANSAC algorithm produced inconsistent results under identical parameter settings, indicating significant deviations and instability.
Using the direction of the slope, the successful segmentation of all slopes was achieved in all three types of roof segmentation, resulting in improved outcomes.Though there were several instances of missegmentation, such occurrences did not adversely affect the overall effects compared to the area segmentation algorithm.Furthermore, after denoising, a complete representation of the various roof slopes was obtained.It should be noted that during experimentation, the first two algorithms were directly based on point cloud segmentation, resulting in neater planar edges.In contrast, slope segmentation relied on raster images after point cloud projection, leading to rougher edge contours due to lower raster resolution.However, this issue could be eliminated by regularization in subsequent feature line extraction.

Feature Line Extraction and Regularisation
The slope direction map was subjected to sequential analysis involving Canny edge detection and Hough line detection.After further refinement and regularization, the resulting feature line extraction map is presented in Figure 14.Our approach offers commendable results in extracting the feature lines of various roof configurations, particularly double-sloped and multi-sloped roofs commonly found in low-rise traditional village buildings.

Conclusions
This study focused on the extraction of complex roof feature lines in traditional village buildings.Based on the MVS point cloud data collected in Jingping Village by the authors, a method combining the VDVI, CSF algorithm, and slope-based segmentation was proposed, which ultimately extracted the internal and external feature lines of three typical roofs.The experimental results illustrate the following: (1) This study presents an effective method for extracting the feature lines from traditional Chinese village roofs.The experiments showed that this method can successfully extract the feature lines from different types of traditional buildings, providing a valuable reference for the 3D reconstruction of traditional village architecture in China; (2) The feasibility of the CSF algorithm in extracting the roof slope surfaces of traditional buildings was demonstrated.By adjusting the GR parameter of the algorithm, the

Conclusions
This study focused on the extraction of complex roof feature lines in traditional village buildings.Based on the MVS point cloud data in Jingping Village by the authors, a method combining the VDVI, CSF algorithm, and slope-based segmentation was proposed, which ultimately extracted the internal and external feature lines of three typical roofs.The experimental results illustrate the following: (1) This study presents an effective method for extracting the feature lines from traditional Chinese village roofs.The experiments showed that this method can successfully extract the feature lines from different types of traditional buildings, providing a valuable reference for the 3D reconstruction of traditional village architecture in China; (2) The feasibility of the CSF algorithm in extracting the roof slope surfaces of traditional buildings was demonstrated.By adjusting the GR parameter of the algorithm, the roof point clouds of I-shaped, L-shaped, and U-shaped roofs could be effectively and more comprehensively extracted; (3) The slope-based segmentation algorithm proposed in this study effectively avoids oversegmentation and undersegmentation issues and performs better than the RANSAC algorithm and region-based segmentation algorithm.
However, there are still some unresolved issues in this study that warrant further investigation in future research: (1) The use of the CSF algorithm for extracting roof point clouds is only suitable for simple two-sloped and four-sloped roofs in villages.It still remains a challenge to adapt the method for extracting more complex "回" roofs with gable walls.Further research is needed to address the extraction of different types of building roofs; (2) The accuracy and density of the point cloud data have a greater impact on the segmentation of building roof slope surfaces in this paper.In the case of the same precision, the higher density of point cloud data volume, while it can guarantee the final effect of the experiment, is likely to lead to excessive experimental load, thus affecting the experimental process and vice versa; a lower density may result in insufficient roof details, making it more difficult to ensure that the experiment is carried out.Therefore, exploring the effect of point clouds with different accuracies and densities to this experiment is a worthy consideration afterward; (3) This paper is a practical attempt to reconstruct traditional village monolithic buildings in Western Hunan, and its method is mainly for traditional village I-shaped, L-shaped, and U-shaped roofs, and its applicability to other types of buildings is still to be verified.

Figure 1 .
Figure 1.Technology roadmap.Note: "回" is a Chinese character whose shape is similar to that of a specific courtyard structure in China.The same below.

Figure 1 .
Figure 1.Technology roadmap.Note: "回" is a Chinese character whose shape is similar to that of a specific courtyard structure in China.The same below.

Figure 2 .
Figure 2. Schematic diagram of the CSF algorithm.Note: the CSF algorithm involves modeling a virtual cloth draped over irregular terrain.

Figure 3 .
Figure 3. Movement of particles gradually attached to ground points: (a) stage I: the particles are placed above the laser dot; (b) stage II: the particles start to fall due to gravity, and some of them fall below the laser dot; (c) stage III: the particles below the laser are moved to the surface of the laser spot and are set to be unable to move; (d) stage IV: by the gravitational force between the particles, the movable particles are pulled by the neighboring immovable particles, resulting in movement.

Figure 2 .
Figure 2. Schematic diagram of the CSF algorithm.Note: the CSF algorithm involves modeling a virtual cloth draped over irregular terrain.

Figure 2 .
Figure 2. Schematic diagram of the CSF algorithm.Note: the CSF algorithm involves modeling a virtual cloth draped over irregular terrain.

Figure 3 .
Figure 3. Movement of particles gradually attached to ground points: (a) stage I: the particles are placed above the laser dot; (b) stage II: the particles start to fall due to gravity, and some of them fall below the laser dot; (c) stage III: the particles below the laser are moved to the surface of the laser spot and are set to be unable to move; (d) stage IV: by the gravitational force between the particles, the movable particles are pulled by the neighboring immovable particles, resulting in movement.

Figure 3 .
Figure 3. Movement of particles gradually attached to ground points: (a) stage I: the particles are placed above the laser dot; (b) stage II: the particles start to fall due to gravity, and some of them fall below the laser dot; (c) stage III: the particles below the laser are moved to the surface of the laser spot and are set to be unable to move; (d) stage IV: by the gravitational force between the particles, the movable particles are pulled by the neighboring immovable particles, resulting in movement.

Figure 4 .
Figure 4. Schematic diagram of the slope direction.

Figure 5 .
Figure 5. Moving window for the slope direction calculation.

Figure 5 .
Figure 5. Moving window for the slope direction calculation.

Figure 5 .
Figure 5. Moving window for the slope direction calculation.

Figure 6 .
Figure 6.Extraction results for the building point cloud using the CSF algorithm: (a) scene I; (b) scene II; (c) scene III.

Figure 6 .
Figure 6.Extraction results for the building point cloud using the CSF algorithm: (a) scene I; (b) scene II; (c) scene III.

Buildings 2024 , 17 Figure 6 .
Figure 6.Extraction results for the building point cloud using the CSF algorithm: (a) scene I; (b) scene II; (c) scene III.

Figure 11 .
Figure 11.Frequency distribution of L-shaped roof slope values.

Figure 12 .
Figure 12.Confusion matrix for different roof slope segmentations: (a) I-shpaed, (b) L-shaped, (c) U-shaped.The upper left corner of each of (a-c) represents the number of grids that are actually

Figure 11 .
Figure 11.Frequency distribution of L-shaped roof slope values.

Figure 12 .
Figure 12.Confusion matrix for different roof slope segmentations: (a) I-shpaed, (b) L-shaped, (c) U-shaped.The upper left corner of each of (a-c) represents the number of grids that are actually

Figure 12 .
Figure 12.Confusion matrix for different roof slope segmentations: (a) I-shpaed, (b) L-shaped, (c) Ushaped.The upper left corner of each of (a-c) represents the number of grids that are actually roofs and classified as roofs.The upper right corner represents the number of grids that are actually roofs but classified as non-roofs.The lower left corner represents the number of grids that are actually non-roofs but classified as roofs, and the lower right corner represents the number of grids that are actually non-roofs and classified as non-roofs.

Figure 13 .
Figure 13.Comparison of different types of roof slope surface segmentations: (a) using the RANSAC algorithm leads to misclassification and overclassification; (b) using the region segmentation algorithm leads to overclassification; (c) using the slope segmentation algorithm leads to some noise; (d) using the slope segmentation algorithm and noise removal leads to better results.

Figure 13 .
Figure 13.Comparison of different types of roof slope surface segmentations: (a) using the RANSAC algorithm leads to misclassification and overclassification; (b) using the region segmentation algorithm leads to overclassification; (c) using the slope segmentation algorithm leads to some noise; (d) using the slope segmentation algorithm and noise removal leads to better results.

Table 1 .
Flight parameters of Jingping Village.

Table 1 .
Flight parameters of Jingping Village.

Table 2 .
Comparison of the number of roof slopes segmented using different algorithms.

Table 2 .
Comparison of the number of roof slopes segmented using different algorithms.