A method and device for segmenting and extracting roof surfaces
By generating dense point cloud data and classifying ground and building points, combined with region growing segmentation and K-means clustering methods, the problems of uncontrollable remote sensing image resolution and high lidar cost in roof segmentation are solved, and the detailed assessment and automatic design and layout of rooftop photovoltaic resources are achieved.
Patent Information
- Application Number
- CN202311254811.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-26
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2043-09-26
AI Technical Summary
Existing technologies for rooftop segmentation have problems such as uncontrollable remote sensing image resolution, lack of three-dimensional information, susceptibility to shadows and image deformation, and high cost of lidar sensors. These problems lead to unstable rooftop segmentation effects and cannot meet the needs of rooftop photovoltaic resource assessment and automatic design and layout.
Dense point cloud data is generated by collecting roof images based on aircraft. After preprocessing, ground and building point classification is performed. Two plane extractions are performed using the region growing segmentation algorithm and K-means clustering to generate roof surface point cloud files. The files are converted into vector files containing spatial information such as slope, aspect, and relative elevation.
It achieves a stable roof segmentation effect, which is suitable for the detailed evaluation and automatic design and arrangement of rooftop photovoltaic resources, improves the accuracy and applicability of segmentation, and reduces costs.
Smart Images

Figure CN117274292B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image segmentation and extraction, and in particular to a method and device for segmenting and extracting a roof surface. Background Art
[0002] County-level rooftop data is a key area of development. Currently, building roof image recognition methods are primarily categorized into two approaches: image-based roof segmentation and three-dimensional morphology-based roof segmentation. Image-based roof segmentation typically utilizes high-resolution satellite remote sensing data to build machine learning-based model algorithms to identify regional building roofs. The effectiveness of this method is related to the resolution of the remote sensing data, while the speed of recognition is related to the model algorithm. The classification results of this method are unstable and susceptible to factors such as shadows and image distortion. Furthermore, due to the lack of three-dimensional information in the image data, it is impossible to perform detailed roof segmentation on a single building roof, nor can it obtain data such as the slope and aspect of the roof surface.
[0003] At the same time, roof segmentation based on three-dimensional morphology mainly uses the relatively high-cost lidar technology to obtain three-dimensional point cloud data. The data is processed using single point cloud processing algorithms such as the Random Sampling Consensus Plane Segmentation algorithm (RANSAC) and the region growing algorithm. The applicability of roof segmentation is poor. At present, most roof segmentation methods focus on the acquisition of building topology information and three-dimensional reconstruction of buildings. The resulting data is still in the three-dimensional point cloud data format and cannot be applied to application fields such as rooftop photovoltaic resource assessment and rooftop photovoltaic automatic design and layout.
[0004] In order to overcome the above-mentioned defects of the existing technology, this field urgently needs a method and device for segmenting and extracting roof surfaces to solve the problems of uncontrollable resolution of remote sensing images, lack of three-dimensional information, susceptibility to shadows and image deformation, and high cost of lidar sensors, so as to achieve better roof segmentation effects and be suitable for application fields with high requirements for image extraction and segmentation, such as the detailed assessment of rooftop photovoltaic resources and automatic design and arrangement of rooftop photovoltaics. Summary of the Invention
[0005] The following is a brief summary of one or more aspects to provide a basic understanding of these aspects. This summary is not an exhaustive overview of all conceivable aspects and is neither intended to identify key or critical elements of all aspects nor to define the scope of any or all aspects. Its sole purpose is to present some concepts of one or more aspects in a simplified form as a prelude to the more detailed description that will be provided later.
[0006] In order to overcome the above-mentioned defects of the prior art, the present invention provides a method for segmenting and extracting roof surfaces, comprising: generating dense point cloud data based on roof images collected by an aircraft, and preprocessing the dense point cloud data; performing ground point classification and building point classification on the processed point cloud data in sequence, extracting building points based on spatial relationships, thereby generating a building point cloud file with a single building as a unit; and traversing the building point cloud file, performing two plane extractions on each building point cloud file, wherein the segmentation threshold of the first plane extraction is greater than that of the second plane extraction, thereby obtaining a roof surface point cloud file of each building.
[0007] In one embodiment, preferably, the method may further include: converting the obtained roof point cloud files of the respective buildings into vector files, wherein the vector files include a vector data attribute table.
[0008] In one embodiment, preferably, the obtained roof point cloud files of each building are converted into vector files, including: projecting the point cloud data in the roof point cloud file to a horizontal plane to convert the point cloud data into raster data, thereby generating a roof raster file; and generating a roof vector file based on the roof raster file, filling the roof space information into the vector data attribute table, and the roof space information includes slope and direction, relative elevation, actual area, and longitude and latitude.
[0009] In one embodiment, preferably, the first plane extraction may include: using a region growing segmentation algorithm to search for a set of points within a preset radius in the neighborhood of each point in the building point cloud file, and calculating the normal vector and curvature value of the plane corresponding to each point; sorting the points according to the curvature value, selecting seed points, establishing a seed point set, using the point with the smallest curvature value as the initial seed point, and finding multiple neighboring points of the seed point; calculating the angle between the normal of each neighboring point and the normal of the current seed point, if it is less than a preset angle threshold, adding the neighboring point to the area where the current seed point is located and determining that the two belong to the same plane; judging whether the curvature value of each neighboring point is less than a preset curvature threshold, if so, deleting the current seed point from the seed point set, and adding the neighboring point to the seed point set as a new seed point; and if the seed point set is empty, starting again from the initial seed point, and repeating the iteration until all seed points are traversed.
[0010] In one embodiment, preferably, the second plane extraction may include: calculating the normal vector of each point in the building point cloud file, searching for the neighboring point set of each point with a preset search radius; performing multiple K-means clustering on the normal vector of each point, where K is a positive integer in the range of [1,9], and calculating the sum of squared errors (SSE) corresponding to different K values; calculating the SSE ratio (SSE) corresponding to adjacent K values. i :SSE i+1, where 1≤i<9, the i value corresponding to the first time the SSE ratio is less than the preset value is used as the K value corresponding to the K-means clustering for building point cloud clustering; and the normal vectors of each point in the building point cloud file are clustered using K-means clustering, and each cluster point set in the clustering result is density clustered. Based on the standardized average distance of the point cloud, the neighborhood radius distance and the minimum cluster point set size are selected, and the density clustering results and the intercept equation parameters of the corresponding plane are saved in sequence. Each cluster corresponds to an independent point cloud file, thereby obtaining the roof point cloud file of each building.
[0011] In one embodiment, preferably, the dense point cloud data is generated based on the roof image collected by the aircraft, and preprocessing the point cloud data may include: performing three-dimensional reconstruction based on the roof image collected by the aircraft to generate dense point cloud data; using a statistical filter to reduce noise on the dense point cloud data; and using voxel downsampling to perform downsampling on the denoised point cloud data.
[0012] In one embodiment, preferably, performing ground point classification may include: extracting ground point cloud data based on the classification code, generating a digital elevation model (DEM) based on the ground point cloud data; generating a digital surface model (DSM) based on the preprocessed point cloud data; and calculating a normalized digital surface model (nDSM) according to the following formula:
[0013] nDSM=DSM—DEM
[0014] In one embodiment, preferably, performing building point classification may include: extracting building point cloud data based on the classification code; projecting the building point cloud data onto a horizontal plane to generate a building grid file; generating a building outline vector file based on the building grid file, calculating the area of each building vector surface, and filling and eliminating holes in the vector surface; extracting building point clouds based on individual building vector elements, and generating the building point cloud files one by one. Each building point cloud file includes all building points within the building vector element; and smoothing the data in the building point cloud file using the least moving squares method.
[0015] Another aspect of the present invention further provides a rooftop segmentation and extraction device, comprising: a memory; and a processor coupled to the memory, wherein the processor is configured to execute any of the rooftop segmentation and extraction methods described above.
[0016] The present invention also provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the method for segmenting and extracting a roof surface as described in any one of the above items. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The above features and advantages of the present invention will be better understood after reading the detailed description of the embodiments of the present disclosure in conjunction with the following drawings. In the drawings, the components are not necessarily drawn to scale, and components with similar related properties or characteristics may have the same or similar reference numerals.
[0018] Figure 1 1 is a schematic diagram of a method flow for segmenting and extracting a roof surface according to an embodiment of one aspect of the present invention;
[0019] Figure 2A is a schematic diagram of the results of roof image extraction and segmentation in the data preprocessing step according to an embodiment of the present invention;
[0020] Figure 2B 2. It is a schematic diagram of the result of roof image extraction and segmentation in the step of extracting the roof of a building point cloud according to an embodiment of the present invention;
[0021] Figure 2C 1 is a schematic diagram illustrating the results of roof image extraction and segmentation in the roof data vectorization step according to an embodiment of the present invention;
[0022] Figures 3A to 3D is a schematic diagram illustrating the effects of vectorization of various typical roofs according to an embodiment of the present invention; and
[0023] Figure 4 FIG. 4 is a schematic diagram of the structure of a device for segmenting and extracting a roof surface according to an embodiment of another aspect of the present invention. DETAILED DESCRIPTION
[0024] The following specific embodiments illustrate the embodiments of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. Although the description of the present invention will be introduced in conjunction with the preferred embodiment, this does not mean that the features of this invention are limited to this embodiment. On the contrary, the purpose of introducing the invention in conjunction with the embodiment is to cover other options or modifications that may be extended based on the claims of the present invention. In order to provide a deep understanding of the present invention, the following description will include many specific details. The present invention can also be implemented without using these details. In addition, in order to avoid confusion or blurring the focus of the present invention, some specific details will be omitted in the description.
[0025] In the description of the present invention, it should be noted that, unless otherwise expressly specified or limited, the terms "mounted," "connected," and "connected" should be understood in a broad sense. For example, they may refer to fixed, detachable, or integral connections; mechanical or electrical connections; direct or indirect connections through an intermediate medium; and internal communication between two components. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on the specific circumstances.
[0026] Furthermore, the terms "upper," "lower," "left," "right," "top," "bottom," "horizontal," and "vertical" used in the following description should be understood to refer to the orientations depicted in that section and the accompanying drawings. These relative terms are used solely for convenience of description and do not necessarily imply that the devices described herein must be manufactured or operated in a specific orientation. Therefore, they should not be construed as limiting the present invention.
[0027] It will be understood that although the terms "first," "second," "third," etc. may be used herein to describe various components, regions, layers, and / or portions, these components, regions, layers, and / or portions should not be limited by these terms, and these terms are merely used to distinguish different components, regions, layers, and / or portions. Thus, a first component, region, layer, and / or portion discussed below may be referred to as a second component, region, layer, and / or portion without departing from some embodiments of the present invention.
[0028] In order to overcome the above-mentioned defects of the prior art, the present invention provides a method and device for segmenting and extracting roof surfaces, which solves the problems of uncontrollable resolution of remote sensing images, lack of three-dimensional information, susceptibility to shadows and image deformation, and high cost of lidar sensors, and achieves better roof segmentation effect. It can be applied to application fields with high requirements for image extraction and segmentation, such as the detailed assessment of rooftop photovoltaic resources and automatic design and arrangement of rooftop photovoltaics.
[0029] Figure 1 FIG. 4 is a flow chart of a method for segmenting and extracting a roof surface according to an embodiment of the present invention.
[0030] Please refer to Figure 1 The roof segmentation and extraction method 100 provided by the present invention may include:
[0031] Step 101: Generate dense point cloud data based on the roof image captured by the aircraft, and pre-process the dense point cloud data.
[0032] In a preferred embodiment, the dense point cloud data is generated based on the roof image collected by the aircraft, and the preprocessing of the point cloud data may further include: performing three-dimensional reconstruction based on the roof image collected by the aircraft to generate dense point cloud data; using a statistical filter to reduce noise on the dense point cloud data; and using voxel downsampling to perform downsampling on the denoised point cloud data.
[0033] Statistical filters and voxel downsampling can be used to perform point cloud denoising and downsampling, respectively, to standardize point cloud data collected by different aircraft models and flight parameters into point cloud data with a resolution of 0.15m. For example, first, dense point cloud data can be generated using drone aerial 3D reconstruction software such as DJI Zhitu, ContextCapture, and Photoscan. Second, a statistical filter can be used to denoise the point cloud data. The filter parameters can be set to: number of domain points k = 10, standard deviation multiple std_ratio = 1.0, and the denoised point cloud data can be calculated. Subsequently, the denoised point cloud data can be downsampled using voxel downsampling, setting the voxel size voxel_size = 0.15. The voxel sampling method uses the average coordinates of all points within the voxel as the voxel coordinate. Finally, point cloud data downsampled to 0.15m is calculated.
[0034] Please continue to refer to Figure 1 The roof segmentation and extraction method 100 provided by the present invention may further include:
[0035] Step 102: Perform ground point classification and building point classification on the processed point cloud data in sequence, extract building points based on spatial relationships, and thus generate a building point cloud file with a single building as the unit.
[0036] Furthermore, in a preferred embodiment, performing ground point classification may include: extracting ground point cloud data based on the classification code, generating a digital elevation model (DEM) based on the ground point cloud data; generating a digital surface model (DSM) based on the preprocessed point cloud data; and calculating a normalized digital surface model (nDSM) according to the following formula:
[0037] nDSM=DSM-DEM
[0038] For example, you can use the ClassifyLasGround function in the Python extension package arcpy to classify ground points in point cloud data. The ground point classification code is 2.
[0039] Then, ground points are extracted to generate a normalized digital surface model (nDSM). Specifically, all points with a classification code of 2 are first extracted from the point cloud data to generate the ground point cloud data. Based on this data, a digital elevation model (DEM) with a resolution of 0.3m is generated. A digital surface model (DSM) is then generated from the normalized raw point cloud data, and finally the nDSM is calculated using the formula nDSM = DSM - DEM.
[0040] Similarly, in a preferred embodiment, performing building point classification may include: extracting building point cloud data based on the classification code; projecting the building point cloud data onto a horizontal plane to generate a building grid file; generating a building outline vector file based on the building grid file, calculating the area of each building vector face, and filling and eliminating holes in the vector face; extracting building point clouds based on individual building vector elements, generating building point cloud files one by one, wherein each building point cloud file contains all building points within the building vector element; and smoothing the data in the building point cloud file using the least moving squares method.
[0041] For example, to extract building points and generate a building point cloud file with a single building as the unit, first extract all points with a classification code of 6 from the point cloud data to generate building point cloud data; then project the building point cloud data onto a horizontal plane to generate a building grid file with a resolution of 0.5m; then, generate a building outline vector file based on the building grid file, calculate the area of each building vector surface, filter and extract building vectors with an area greater than 20㎡, and fill and eliminate holes in the vector surface; then, extract building point clouds with a single building vector element as the unit, and generate building point cloud files one by one. Each point cloud file contains all the building points within the building vector element; finally, use the least moving squares method to smooth the building point cloud file, where the algorithm parameters can be set as: using a second-order polynomial to fit the plane and a domain point search radius of 0.6m.
[0042] Figure 2A FIG. 1 is a schematic diagram illustrating the results of roof image extraction and segmentation in the data preprocessing step according to an embodiment of the present invention.
[0043] Figure 2A The diagram shows the effect of the roof image after preprocessing, ground point classification, and roof building point classification. The rightmost image is a zoomed-in view after building point classification. After the algorithm, the green point cloud in the lower right image represents a smooth roof.
[0044] Please return Figure 1 The roof segmentation and extraction method 100 provided by the present invention may further include:
[0045] Step 103: traverse the building point cloud files and perform two plane extractions on each building point cloud file, wherein the segmentation threshold of the first plane extraction is greater than that of the second plane extraction, thereby obtaining the roof point cloud files of each building.
[0046] It should be noted that, the building point cloud files with a single building as a unit obtained by traversing step 102 are subjected to two plane extractions in turn for each building point cloud file using the region growing segmentation algorithm, K-means clustering and density clustering fusion algorithm. The purpose of the first plane extraction is to simplify complex problems and divide the complex roof into several general complex roofs, so that the effect of the second plane extraction is better. When the region growing segmentation algorithm is used for the first extraction, the threshold setting can be set larger. For example, when setting the normal vector angle of the adjacent points and the curvature threshold, a larger value than the general selection is selected to avoid the over-segmentation caused by the small threshold setting when some solutions in the prior art only extract the building roof once, and divide the points in one plane into two or more planes.
[0047] When performing the second plane extraction, the adjacent planes with smaller angles that were not successfully identified in the first plane extraction can be segmented and extracted. Preferably, the sum of the squared errors (SSE) can be calculated by the elbow method to automatically determine the K-means clustering K value, and the density clustering domain distance (eps) parameter can be determined based on the point cloud density of the original standardized data, thereby achieving automated parameter setting during the second plane extraction. At the same time, density clustering can avoid the situation where roof extraction cannot distinguish between mathematically coplanar surfaces, that is, the situation where the normal vectors are consistent but not in the same position in three-dimensional space, thereby improving the roof extraction effect and the versatility of the algorithm.
[0048] Further, preferably, the first plane extraction may include: using a region growing segmentation algorithm to search for a set of points within a preset radius in the neighborhood of each point in the building point cloud file, and calculating the normal vector and curvature value of the plane corresponding to each point; sorting the points according to the curvature value, selecting seed points, establishing a seed point set, taking the point with the smallest curvature value as the initial seed point, and finding multiple neighboring points of the seed point; calculating the angle between the normal of each neighboring point and the normal of the current seed point, if it is less than a preset angle threshold, adding the neighboring point to the area where the current seed point is located and determining that the two belong to the same plane; judging whether the curvature value of each neighboring point is less than a preset curvature threshold, if it is less than, deleting the current seed point from the seed point set, and adding the neighboring point to the seed point set as a new seed point; and if the seed point set is empty, starting again from the initial seed point, and repeating the iteration until all seed points are traversed.
[0049] For example, when using the region growing segmentation algorithm for the first plane extraction of a building point cloud, a k-dtree can be established to search for all points within a 0.6m radius for each point in the building point cloud, or the 50 closest points within that point set. The normal vector and curvature corresponding to each point are calculated by generating a covariance matrix from the points in the neighborhood of each point. The eigenvalues of this covariance matrix are calculated and sorted from smallest to largest as: h1, h2, h3, where the normal vector is (h1, h2, h3) and the curvature is the absolute value of h3 / (h1+h2+h3).
[0050] Next, sort the points according to their curvature values. Preferably, the point with the smallest curvature can be selected as the initial seed point and added to the seed point set, because the point with the smallest curvature is located in a flat area, and growing from the flattest area can reduce the total number of segmentations. After finding the neighboring points of the seed point, for example the nearest 30 points, perform the following calculations on each seed point and its neighboring points:
[0051] (1) Calculate the angle between the normal of each neighboring point and the normal of the current seed point. If the angle is less than the threshold of 4°, the current point is added to the area where the current seed is located and belongs to the same plane;
[0052] (2) Then, the curvature value of each neighboring point is judged. If the curvature is less than the threshold value of 1.0, the point is added to the seed point set as a new seed;
[0053] (3) Delete the current seed from the seed point set.
[0054] If the seed point set is empty, you need to start from the beginning and select the point with the smallest curvature as the seed point for calculation. Repeat the iteration until all seed points have been traversed.
[0055] As for the second plane extraction, in a preferred embodiment, the second plane extraction may include: calculating the normal vector of each point in the building point cloud file, searching for the neighboring point set of each point with a preset search radius; performing multiple K-means clustering on the normal vector of each point, where K is a positive integer in the range of [1,9], and calculating the square error sum SSE corresponding to different K values; calculating the SSE ratio SSE corresponding to adjacent K values i :SSE i+1, where 1≤i<9, the i value corresponding to the first time the SSE ratio is less than the preset value is used as the K value corresponding to the K-means clustering for building point cloud clustering; and the normal vectors of each point in the building point cloud file are clustered using K-means clustering, and each cluster point set in the clustering result is density clustered. Based on the standardized average distance of the point cloud, the neighborhood radius distance and the minimum cluster point set size are selected, and the density clustering results and the intercept equation parameters of the corresponding plane are saved in sequence. Each cluster corresponds to an independent point cloud file, thereby obtaining the roof point cloud file of each building.
[0056] For example, in one embodiment, based on the building point cloud data obtained in step 102, when using the K-means clustering and density clustering fusion algorithm to perform the second building point cloud plane extraction, the normal vector of each point can be calculated first, where the search radius is 2m and the maximum number of neighboring point sets is set to 200 points.
[0057] Next, perform multiple K-means clustering on the normal vector corresponding to each point in the point cloud data, where the K value is a positive integer in the range [1, 9]. Calculate the sum of squared errors (SSE) for different K values. The SSE calculation formula is as follows:
[0058]
[0059] Where k is the K-means clustering K value, p is the sample point, C i is the i-class point set, m i is the centroid of the i-class point set.
[0060] Then, by calculating the SSE ratio corresponding to adjacent K values (SSEi:SSEi+1,1≤i<9), when the ratio is less than 1.5 for the first time, i is the corresponding K value when using K-means clustering to cluster the building point cloud.
[0061] Then, K-means clustering is used to cluster the normal vectors of the building point cloud. Each cluster point set in the clustering result is density clustered. Based on the standardized average spacing of the point cloud, the field radius distance eps is set to 1.5m (10 times of 0.15m), and the minimum cluster point set is 200 points. If applied to rooftop photovoltaic resource assessment, fragmented planes that cannot be used for photovoltaic arrangement can be screened out. Finally, the density clustering results and the intercept equation parameters of the corresponding plane (A, B, C, D in Ax+By+Cz=D) are saved in sequence. Each cluster corresponds to an independent point cloud file.
[0062] Figure 2B FIG. 1 is a schematic diagram illustrating the results of performing two plane extraction and segmentation operations on a roof image in the step of extracting the roof from a building point cloud according to an embodiment of the present invention.
[0063] like Figure 2B As shown, the right side is a partial enlarged view of three places in the roof image on the left. Among them, the red-blue gradient in the "actual elevation" diagram indicates that the corresponding elevation changes from large to small, and the displayed roof corresponds to the incompletely segmented roof in the "first segmentation" diagram. The red and blue in the "second segmentation" diagram represent the segmented roof, that is, the final result after performing a secondary segmentation on the roof that was incompletely segmented for the first time. Each small square box represents the effect of the same roof at different image processing stages. It can be seen that in the roof segmentation and extraction method provided by the present invention, the secondary plane extraction algorithm has a better roof segmentation and extraction effect than the single plane extraction algorithm, and the roof segmentation is more complete.
[0064] In a preferred embodiment, the method for segmenting and extracting roof surfaces provided by the present invention may further include: converting the obtained point cloud files of the roof surfaces of the respective buildings into vector files, wherein the vector files include a vector data attribute table.
[0065] Furthermore, in a preferred embodiment, converting the obtained roof point cloud files of each building into vector files may include: projecting the point cloud data in the roof point cloud file onto a horizontal plane to convert the point cloud data into raster data, thereby generating a roof raster file; and generating a roof vector file based on the roof raster file, filling the roof space information into the vector data attribute table, wherein the roof space information includes slope and direction, relative elevation, actual area, and longitude and latitude.
[0066] Traverse the building roof point cloud file obtained in step 103, convert it into a vector file, and write spatial information such as slope and aspect, relative elevation, actual area, longitude and latitude into its vector data attribute table. For example, in the application scenario of rooftop photovoltaic resource assessment, all the information required for the rooftop distributed photovoltaic resource assessment can be written into the vector data attribute table, so that subsequent resource assessment and photovoltaic automatic design and layout programs can directly read and use it, which further brings convenience.
[0067] For example, you can first project the roof point cloud data onto a horizontal plane to generate a roof raster file with a resolution of 0.3m. Then, generate a roof vector file based on the roof raster file. Then, write the spatial information into the roof vector file attribute table. The attribute table fields are shown in the following table:
[0068]
[0069]
[0070] Where build_ID comes from the ID corresponding to the single building vector element obtained in step 102, plane_ID1 comes from the roof number generated by the first plane extraction in step 103, plane_ID2 comes from the roof number generated by the second plane extraction in step 103, plane_a, plane_b, plane_c, and plane_d come from the plane equation parameters obtained in step 103, and slope comes from the calculation formula: Where A, B, and C are plane_a, plane_b, and plane_c respectively, and aspect is derived from the calculation formula:
[0071] if a>=0 and b>0:
[0072] aspect=arctan(abs(a / b))*180 / Π
[0073] elif a>=0 and b==0:
[0074] aspect=90
[0075] elif a>=0 and b<0:
[0076] aspect=arctan(abs(a / b))*180 / Π+90
[0077] elif a<=0 and b<0:
[0078] aspect=arctan(abs(a / b))*180 / Π+180
[0079] elif a<=0 and b==0:
[0080] aspect=270
[0081] elif a<=0 and b>0:
[0082] aspect = arctan(abs(a / b))*180 / π+270. lon and lat are derived from the coordinates of the roof vector center point, height is derived from the nDSM data obtained in roof vector sampling step 102, area is derived from the roof vector space calculation, and r_area is derived from the calculation formula: r_area = area / cos(slope). Based on this, building roof vector data that can be used for rooftop PV resource assessment is obtained.
[0083] Figure 2CFIG. 4 is a schematic diagram illustrating the results of roof image extraction and segmentation in the roof data vectorization step according to an embodiment of the present invention.
[0084] like Figure 2C As shown, vector surface elements of different colors represent the roof segmentation results. Since vector data has geographic coordinate information, the result data of roof segmentation extraction provided by the present invention has the advantage of being easy to perform post-processing operations such as resource evaluation and automatic layout design.
[0085] Figures 3A to 3D FIG. 1 is a schematic diagram illustrating the effects of vectorization of various typical roofs according to an embodiment of the present invention.
[0086] in, Figure 3A Shown are flat roofs and gable roofs. Figure 3B For flat roofs with complex obstacles, Figure 3C It is a composite gable roof. Figure 3D The roof extraction and segmentation method provided by the present invention is superior and has wide versatility, as can be seen from the vectorized renderings of these typical roofs.
[0087] Although the above methods are illustrated and described as a series of acts for simplicity of explanation, it is to be understood and appreciated that these methods are not limited by the order of the acts, as some acts may occur in a different order and / or concurrently with other acts from those illustrated and described herein or not illustrated and described herein but understandable to those skilled in the art according to one or more embodiments.
[0088] Figure 4 FIG. 4 is a schematic diagram of the structure of a device for segmenting and extracting a roof surface according to an embodiment of another aspect of the present invention.
[0089] According to another aspect of the present invention, an embodiment of a device 400 for segmenting and extracting a roof surface is also provided.
[0090] like Figure 4 As shown, the rooftop segmentation and extraction device 400 provided in this embodiment may include a memory 401 and a processor 402 coupled to the memory 401. The processor 402 may be configured to implement any of the above-mentioned rooftop segmentation and extraction methods.
[0091] According to another aspect of the present invention, an embodiment of a computer storage medium is also provided herein.
[0092] The computer storage medium stores a computer program which, when executed by a processor, can implement the steps of any of the above-mentioned methods for segmenting and extracting roof surfaces.
[0093] Those skilled in the art will further appreciate that the various illustrative logic blocks, modules, circuits, and algorithmic steps described in conjunction with the embodiments disclosed herein can be implemented as electronic hardware, computer software, or a combination of the two. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps are generally described above in terms of their functionality. Whether such functionality is implemented as hardware or software depends on the specific application and the design constraints imposed on the overall system. A skilled person may implement the described functionality in different ways for each specific application, but such implementation decisions should not be interpreted as resulting in a departure from the scope of the present invention.
[0094] The processors described herein can be implemented using electronic hardware, computer software, or any combination thereof. Whether such processors are implemented as hardware or software will depend on the specific application and the overall design constraints imposed on the system. By way of example, the processors, any portion of a processor, or any combination of processors presented in this disclosure can be implemented using a microprocessor, microcontroller, digital signal processor (DSP), field programmable gate array (FPGA), programmable logic device (PLD), state machine, gated logic, discrete hardware circuits, and other suitable processing components configured to perform the various functions described throughout this disclosure. The functionality of the processors, any portion of a processor, or any combination of processors presented in this disclosure can be implemented using software executed by a microprocessor, microcontroller, DSP, or other suitable platform.
[0095] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software module may reside in RAM memory, flash memory, ROM memory, EPROM memory, EEPROM memory, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art. An exemplary storage medium is coupled to the processor so that the processor can read and write information from / to the storage medium. In an alternative, the storage medium may be integrated into the processor. The processor and storage medium may reside in an ASIC. The ASIC may reside in a user terminal. In an alternative, the processor and storage medium may reside in a user terminal as discrete components.
[0096] The previous description of the disclosure is provided to enable any person skilled in the art to make or use the disclosure. Various modifications to the disclosure will be apparent to those skilled in the art, and the general principles defined herein may be applied to other variations without departing from the spirit or scope of the disclosure. Thus, the disclosure is not intended to be limited to the examples and designs described herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for segmenting and extracting a roof surface, comprising: generating dense point cloud data based on the roof image collected by the aircraft, and preprocessing the dense point cloud data; The processed point cloud data is sequentially classified into ground point classification and building point classification, and building points are extracted based on spatial relationships, thereby generating a building point cloud file with a single building as the unit; and traversing the building point cloud files, performing two plane extractions on each building point cloud file, wherein the first building point cloud plane extraction is performed using a region growing segmentation algorithm, and the segmentation threshold of the first plane extraction is greater than that of the second plane extraction, thereby obtaining a roof point cloud file of each building; The second plane extraction includes: calculating the normal vector of each point in the building point cloud file, searching for the neighboring point set of each point with a preset search radius; performing multiple K-means clustering on the normal vector of each point, where K is a positive integer in the range of [1,9], and calculating the error sum of squares SSE corresponding to different K values; calculating the SSE ratio SSEi:SSEi+1 corresponding to adjacent K values, where 1≤i<9, and taking the i value corresponding to the first time the SSE ratio is less than the preset value as the K value corresponding to the building point cloud clustering using K-means clustering; and clustering the normal vectors of each point in the building point cloud file using K-means clustering, performing density clustering on each cluster point set in the clustering results, selecting the neighborhood radius distance and the minimum cluster point set size based on the standardized point cloud average spacing, and sequentially saving the density clustering results and the intercept equation parameters of the corresponding plane, each cluster corresponds to an independent point cloud file, thereby obtaining the roof point cloud file of each building; The performing of ground point classification includes: extracting ground point cloud data based on the classification code, generating a digital elevation model (DEM) based on the ground point cloud data; generating a digital surface model (DSM) based on the preprocessed point cloud data; and calculating a normalized digital surface model (nDSM) according to the following formula: nDSM=DSM-DEM; The execution of building point classification includes: extracting building point cloud data based on the classification code; projecting the building point cloud data onto a horizontal plane to generate a building grid file; generating a building outline vector file based on the building grid file, calculating the area of each building vector surface, and filling and eliminating holes in the vector surface; extracting building point clouds based on a single building vector element and generating the building point cloud files one by one; each building point cloud file contains all building points within the building vector element; and smoothing the data in the building point cloud file using the least moving squares method.
2. The segmentation and extraction method according to claim 1, wherein: Also includes: The obtained roof point cloud files of the respective buildings are converted into vector files, wherein the vector files include a vector data attribute table.
3. The segmentation and extraction method according to claim 2, wherein: The step of converting the obtained roof point cloud files of each building into vector files includes: projecting the point cloud data in the roof point cloud files onto a horizontal plane to convert the point cloud data into raster data, thereby generating a roof raster file; and generating a roof vector file based on the roof raster file, and filling the roof space information into the vector data attribute table, wherein the roof space information includes slope and aspect, relative elevation, actual area, and longitude and latitude.
4. The segmentation and extraction method according to claim 2, wherein: The first plane extraction includes: using a region growing segmentation algorithm to search for a point set within a preset radius in the neighborhood of each point in the building point cloud file, and calculating the normal vector and curvature value of the plane corresponding to each point; sorting the points according to the curvature value, selecting seed points, establishing a seed point set, taking the point with the smallest curvature value as the initial seed point, and finding multiple neighboring points of the seed point; calculating the angle between the normal of each neighboring point and the normal of the current seed point, if it is less than a preset angle threshold, adding the neighboring point to the area where the current seed point is located and determining that the two belong to the same plane; judging whether the curvature value of each neighboring point is less than a preset curvature threshold, if so, deleting the current seed point from the seed point set, and adding the neighboring point to the seed point set as a new seed point; and if the seed point set is empty, starting again from the initial seed point, and repeating the iteration until all seed points are traversed.
5. The segmentation and extraction method according to claim 1, wherein: The method generates dense point cloud data based on the roof image collected by the aircraft and preprocesses the point cloud data, including: performing three-dimensional reconstruction based on the roof image collected by the aircraft to generate dense point cloud data; using a statistical filter to reduce noise on the dense point cloud data; and using voxel downsampling to perform downsampling on the denoised point cloud data.
6. A device for segmenting and extracting a roof surface, comprising: Memory; and a processor coupled to the memory, wherein the processor is configured to execute the roof surface segmentation and extraction method according to any one of claims 1 to 5.
7. A computer-readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for segmenting and extracting a roof surface according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Airborne Lidar point cloud building top surface gradual extraction method based on classifying and laying
CN105139379A
Roof segmentation method, system and device based on multi-resolution three-dimensional statistical information
CN109242855A