Building inspection waypoint automatic generation method and system based on three-dimensional point cloud
By using an automated waypoint generation method based on 3D point clouds, the problems of low automation and insufficient accuracy in UAV building inspection are solved. It achieves dynamic adaptation of safe distance and accuracy of sensor orientation, thereby improving the efficiency and safety of UAV inspection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI LIONWEI INTELLIGENT TECH CO LTD
- Filing Date
- 2026-04-10
- Publication Date
- 2026-06-05
AI Technical Summary
In existing technologies, waypoint planning for UAV building inspections relies on manual operation, resulting in low automation, poor matching between waypoints and the actual outlines of buildings, insufficient precision in controlling safe distances, difficulty in dynamic adjustment, and sensor orientation deviations affecting data acquisition quality and flight safety.
Based on 3D point cloud data, the ground point cloud is segmented using the RANSAC algorithm, the DBSCAN algorithm is improved for clustering, and geometric contours are extracted using adaptive hierarchical and morphological processing. This generates a sequence of inspection waypoints that are associated with safe location points and target detection points, and the attitude angles are calculated collaboratively to output standardized waypoint data.
It has achieved full automation of the process from 3D point cloud to waypoint, significantly improving planning efficiency and accuracy, reducing the risk of UAV collisions, and improving the efficiency and safety of data acquisition.
Smart Images

Figure CN122149490A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of autonomous navigation and path planning of unmanned aerial vehicles (UAVs). Specifically, it relates to a method and system for automatically generating inspection flight points of buildings based on 3D point clouds. Background Art
[0002] With the integrated development of UAV technology and lidar mapping technology, using UAVs equipped with lidar or high-definition cameras to conduct inspections on the external structures of buildings has become an efficient solution to replace manual inspections. The core of such inspection tasks is that the UAV needs to set a safe flight path along the perimeter of the building, while maintaining a constant safe distance, and making the on-board sensors always对准 the building surface to obtain complete and clear detection data.
[0003] However, the flight point planning methods in the prior art mostly rely on manual marking in 3D models or 2D maps, or generating paths based on CAD models and simplified 3D meshes, and do not directly utilize the original 3D point cloud data containing millimeter-level accuracy geometric features of the building surface, resulting in low automation of flight point planning, time-consuming and laborious, and prone to missing inspection areas. At the same time, due to the lack of full utilization of the native geometric information of the point cloud, the matching degree between the flight points and the true contour of the building is poor, the control accuracy of the safe distance is insufficient, it is difficult to dynamically adjust according to the concave and convex shape of the building surface, and the attitude angles of the flight points usually need to be calculated separately, and cannot be联动 optimized with the flight point positions, resulting in sensor orientation deviation and affecting the data acquisition quality and flight safety.
[0004] Therefore, there is an urgent need for a technical solution that can directly process 3D point cloud data,实现 automatic generation of flight points, dynamically adapt the safe distance, and协同 calculate the attitude angles to solve the problems of low efficiency, poor accuracy and insufficient协同性 in the prior art. Summary of the Invention
[0005] Based on this, in view of the above problems, this application provides a method and system for automatically generating inspection flight points of buildings based on 3D point clouds, which can实现 the full-process automation of building inspection flight point planning, and significantly improve the planning efficiency, the control accuracy of the safe distance and the accuracy of the sensor orientation.
[0006] In the first aspect, this application provides a method for automatically generating inspection flight points of buildings based on 3D point clouds, which is characterized in that the method includes: Construct the geometric contour information of the target building; Generate an inspection flight point sequence according to the geometric contour information, and each inspection flight point in the inspection flight point sequence is associated with a safe position point and a target detection point; Calculate the attitude angle of each inspection flight point based on the spatial position relationship between the safe position point and the target detection point; The output includes the coordinates of the safe location and the inspection waypoint data of the attitude angle.
[0007] Optionally, in this embodiment of the application, before constructing the geometric contour information of the target building, the method further includes: Acquire 3D point cloud data of the area to be inspected; The RANSAC algorithm is used to fit the ground plane, and the three-dimensional point cloud data is divided into ground point cloud and non-ground point cloud. The maximum Z coordinate of the ground point cloud is extracted as the height reference. The filtering threshold is calculated based on the height reference and the preset ground detection distance threshold to filter out low-lying interference points with Z coordinates less than the filtering threshold, so as to retain the target point cloud of the building. Furthermore, the construction of the geometric contour information of the target building includes: determining the geometric contour information of the target building based on the target point cloud.
[0008] Optionally, in this embodiment of the application, the method further includes: An improved DBSCAN algorithm is used to cluster the target point cloud, wherein the neighborhood radius is adaptively calculated based on the point cloud density; Align the bounding box with the calculation axis for each cluster and obtain the Z-axis span of the bounding box as the cluster height; Sort by cluster height in descending order and select the top N clusters as target buildings to achieve priority screening of multiple buildings; Furthermore, the construction of the geometric contour information of the target building includes: determining the geometric contour information of the target building based on the target point cloud of the target building after priority filtering.
[0009] Optionally, in this embodiment of the application, constructing the geometric contour information of the target building includes: Adaptive height layering is performed on the target building along the Z-axis to generate several layer height intervals; Perform XY plane projection on the point cloud within each height range to form a two-dimensional point set; Map the two-dimensional point set to a binary image, and perform morphological dilation and erosion operations to fill gaps and smooth edges; The edge detection algorithm extracts continuous polygonal contours from the processed binary image, which serve as the geometric contour information of the layer.
[0010] Optionally, in this embodiment of the application, generating a patrol waypoint sequence based on geometric contour information includes: Calculate the external normal vector of each vertex of the geometric contour information, and translate it along the direction of the external normal vector by a preset safe distance to obtain the safe position point; Target detection points are generated by uniformly sampling along the geometric contour information using arc length parameterization. The nearest point iteration algorithm is used to achieve rigid matching between the set of safe location points and the set of target detection points, ensuring that each safe location point is associated with a unique target detection point and forming an ordered sequence of inspection waypoints.
[0011] Optionally, in this embodiment of the application, generating the inspection waypoint sequence based on the geometric contour information further includes: Set the layer thickness parameter, calculate the number of layers based on the building cluster height, and if the number of layers is less than the preset minimum value, recalculate the layer thickness to ensure vertical coverage integrity. Assign the Z-axis height of the layer to each inspection waypoint to form three-dimensional waypoint coordinates.
[0012] Optionally, in this embodiment of the application, the attitude angle of each inspection waypoint is calculated based on the spatial relationship between the safe location point and the target detection point, including: Calculate the direction vector from the safe location point to the target detection point; Calculate the angle between the projection of the direction vector onto the XY plane and the true north direction, and use it as the yaw angle; Calculate the angle between the direction vector and the XY plane, and use it as the pitch angle; Among them, the yaw angle and pitch angle are used to control the orientation of the UAV's onboard sensors.
[0013] Optionally, in this embodiment of the application, the output of inspection waypoint data including the coordinate information and attitude angle of the safe location point includes: Convert waypoint data to CSV, KML, JSON, and drone industry standard formats; The output should include at least the following data fields: waypoint number, safe location coordinates, target detection point coordinates, yaw angle, pitch angle, safe distance, floor number, and building ID. Generate a 3D visualization file containing point clouds, contours, waypoints, and attitude vectors.
[0014] In the aforementioned implementation process, the entire process from 3D point cloud input to standardized waypoint output was automated, significantly improving the efficiency, accuracy, and safety of building inspection. By combining point cloud standardization preprocessing, RANSAC ground segmentation, and an improved DBSCAN clustering algorithm, automatic identification, interference removal, and priority selection in multi-building scenarios were achieved, solving the problems of low efficiency and easy omissions in manual planning. Through adaptive layering, morphological contour extraction, and a waypoint generation mechanism based on external normal vector translation and ICP pairing, accurate matching between waypoints and the actual contours of buildings was ensured, significantly reducing the risk of UAV collisions. Attitude angle collaborative calculation ensured that the airborne sensors were always aligned with the surface. Simultaneously, the combination of multi-format compatible output lowered the engineering application threshold and improved overall planning efficiency.
[0015] Secondly, this application also provides an automatic waypoint generation system for building inspection based on 3D point clouds, including: The contour construction module is used to construct the geometric contour information of the target building; A waypoint generation module is used to generate a sequence of inspection waypoints based on the geometric contour information, wherein each inspection waypoint in the sequence is associated with a safe location point and a target detection point. The attitude calculation module is used to calculate the attitude angle of each inspection point based on the spatial positional relationship between the safe location point and the target detection point; The data output module is used to output inspection waypoint data containing the coordinate information of the safe location point and the attitude angle.
[0016] Thirdly, embodiments of this application provide an electronic device, which includes a memory and a processor. The memory stores program instructions, and when the processor reads and runs the program instructions, it executes the steps in any of the above implementation methods.
[0017] This invention acquires 3D point cloud data of the area to be inspected and processes it to extract target point cloud data of the target building. By utilizing native geometric information, it overcomes the planning deviations caused by the reliance on simplified models in traditional methods. Based on this, it constructs geometric contour information and generates a sequence of inspection waypoints associated with safe location points and target detection points. Based on the spatial relationship between safe location points and target detection points, it collaboratively calculates attitude angles, ensuring accurate matching between waypoints and the actual contours of buildings and dynamic adaptation of safe distances, thereby achieving precise control of safe distances. Finally, it outputs standardized inspection waypoint data containing coordinates and attitude angles, realizing full automation from point cloud input to waypoint output. This not only significantly reduces the risk of UAV collisions and improves data acquisition efficiency but also greatly enhances planning efficiency, significantly improving the safety, accuracy, and engineering practicality of building inspections. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of this application or the conventional technology, the drawings used in the description of the embodiments or the conventional technology will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a flowchart of the automatic generation method for building inspection waypoints based on 3D point clouds provided in the embodiments of this application; Figure 2 This is a schematic diagram of the components of the building inspection waypoint automatic generation system based on 3D point cloud provided in the embodiments of this application; Figure 3 This is a schematic diagram of the composition structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0020] The technical solutions of the embodiments of this application will now be described with reference to the accompanying drawings. For example, the flowcharts and block diagrams in the drawings illustrate the architecture, functions, and operations of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagram may represent a module, program segment, or part of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or can be implemented using a combination of dedicated hardware and computer instructions. In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0021] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating the automatic generation method for building inspection waypoints based on 3D point clouds provided in this embodiment. To ensure the effective execution of the method, this embodiment first constructs the corresponding hardware and software operating environment.
[0022] In terms of hardware environment, the electronic devices used in this embodiment include: an Intel Core i7-12700H processor (14 cores and 20 threads, 2.7GHz), 32GB DDR5 4800MHz memory, 1TB NVMe SSD storage, and an NVIDIA RTX 3060 graphics card (6GB GDDR6); the operating system is Windows 10 Professional (64-bit) or Ubuntu 20.04LTS.
[0023] In terms of the software environment, this embodiment is developed based on the Python 3.9 programming language, and the core libraries it depends on include: Open3D 0.17.0 (for point cloud processing and visualization), GDAL 3.6.2 (for LAS / LAZ format parsing), pyproj 3.6.1 (for coordinate transformation), NumPy 1.24.3 (for numerical calculation), and OpenCV 4.8.0 (for image processing).
[0024] Based on the above environment, the method includes the following steps: S100: Acquire 3D point cloud data of the area to be inspected.
[0025] Specifically, the area to be inspected is the spatial region where the target building or large structure is located. The three-dimensional point cloud data originates from raw data collected by LiDAR scanning equipment or other photogrammetric systems, which contains geometric features of the building surface with millimeter-level precision.
[0026] In this embodiment, loading 3D point cloud files in various formats is supported, including PCD (Point Cloud Data), PLY (Polygon File Format), XYZ text format, and LAS / LAZ (LiDAR point cloud standard format). Corresponding loading and preprocessing strategies are adopted for different file formats: For PCD, PLY, and XYZ format files, they can be read directly using the Open3D library; For LAS / LAZ format files, the file header information is parsed using the GDAL library to extract geographic coordinate parameters (such as UTM coordinate system information) and then converted into PCD format for subsequent unified processing.
[0027] As a specific implementation example, this embodiment loads a LAS format point cloud file containing UTM coordinate system information, with an initial point cloud quantity of approximately 800,000. After parsing the file header information using the GDAL library, geographic coordinate parameters are extracted, and the LAS format file is converted to PCD format as standardized input data for subsequent steps. This method achieves unified acquisition of multi-source heterogeneous point cloud data, laying the foundation for subsequent point cloud processing and waypoint generation.
[0028] S200: Process the three-dimensional point cloud data, remove interfering data, and extract the target point cloud of the target building.
[0029] In this embodiment, the loaded 3D point cloud data is first subjected to standardization preprocessing to eliminate noise and unify data density. Specifically, statistical outlier removal is used to remove noisy points. For example, the number of neighborhood points k=20 and the standard deviation threshold σ=1.0 are set to remove outliers that are too far from the average neighborhood distance. Subsequently, voxel grid downsampling is used to unify the point cloud density. For example, the voxel size is set to 0.05m×0.05m×0.05m to reduce the amount of data while maintaining geometric features. Finally, the normal vector of each point is calculated based on the covariance matrix eigenvalue decomposition method, and the neighborhood search radius r=0.3m is set to provide directional information for subsequent contour extraction. As an example, for an initial LAS format point cloud of 800,000 points, after converting the format to PCD format, approximately 30,000 noisy points are removed by statistical outlier removal, and then the number of points is reduced to 200,000 by voxel downsampling to obtain standardized 3D point cloud data.
[0030] Furthermore, to eliminate ground interference, this embodiment uses the Random Sample Consensus (RANSAC) algorithm for ground segmentation. The RANSAC plane fitting parameters are initialized as follows: distance threshold d = 0.2m, maximum number of iterations N = 1000, and confidence level α = 0.99. The algorithm randomly samples three non-collinear points to construct an initial plane model, calculates the distance from all points to the plane, and identifies points with a distance less than d as interior points. The plane model is iteratively optimized until the proportion of interior points stabilizes or the maximum number of iterations is reached, ultimately segmenting the point cloud into a ground point cloud (the set of interior points) and a non-ground point cloud (the set of exterior points). Simultaneously, the maximum Z-coordinate Zmax of the ground point cloud is extracted as the baseline threshold for subsequent height filtering. In this example, the segmentation yields 350,000 ground point clouds and 450,000 non-ground point clouds, with the highest ground point having a maximum Z-coordinate Zmax of 23.5m.
[0031] After obtaining the non-ground point cloud, this embodiment performs adaptive height filtering to further remove low-lying interfering objects. A ground detection distance threshold h is set (configurable range 0.5m~2.0m, default 1.0m in this embodiment), and the filtering threshold Zfilter=Zmax+h is calculated. Points in the non-ground point cloud with Z coordinates less than Zfilter are filtered out, retaining only the target point cloud containing buildings and tall structures, while removing interfering points such as low vegetation and ground-level facilities. After obtaining the filtered target point cloud, the geometric outline information of the buildings can be determined based on this target point cloud. In this embodiment, the filtering threshold Zfilter=24.5m is calculated, retaining 380,000 points in the non-ground point cloud after filtering, and removing approximately 70,000 points of low vegetation interference, ensuring the purity of the target point cloud.
[0032] To extract target buildings in multi-building scenes, this embodiment employs an improved DBSCAN algorithm to cluster the filtered target point cloud. The neighborhood radius eps is adaptively calculated based on the point cloud density ρ, using the following formula: , the minimum number of points Where k is the number of neighborhood points used in the normal vector calculation, in this embodiment k=20, therefore min_points=40. For each cluster, calculate the axis-aligned bounding box (AABB) and obtain the Z-axis span of the bounding box. The cluster height H is used as the target height. Then, the clusters are sorted in descending order by height H, and the top N clusters are selected as target buildings (N is a configurable parameter, default N=5) to achieve priority filtering of multiple buildings. In this implementation example, the point cloud density ρ≈200,000 points / m³, and eps≈0.19m are calculated. Twelve target clusters are obtained. After sorting by height in descending order, the top three clusters (heights of 45m, 32m, and 28m respectively) are selected as target buildings, completing the extraction of the target point cloud for subsequent geometric contour construction. That is, the geometric contour information of the building is determined based on the target point cloud of the target building.
[0033] Through the above processing, this step realizes the automated extraction from the original point cloud to the target building point cloud, effectively eliminating noise, ground and low vegetation interference, and completing the intelligent identification and sorting of multiple buildings, providing a high-quality data foundation for subsequent waypoint generation.
[0034] S300: Construct the geometric contour information of the target building based on the target point cloud; this step aims to transform the three-dimensional discrete target point cloud into a two-dimensional continuous geometric contour that can be used for waypoint planning, specifically including three sub-processes: adaptive height layering, intra-layer point cloud projection, and contour extraction based on morphological processing.
[0035] Specifically, for adaptive height stratification, the target building clusters are first adaptively stratified along the Z-axis to generate several height intervals, ensuring the integrity of inspection coverage in the vertical direction. Specifically, the Z-axis range [Zmin, Zmax] of the axis-aligned bounding box (AABB) of the building clusters is extracted, and the cluster height is calculated. Set the layer thickness parameter t (configurable range 0.5m~2.0m, default value is 1.0m in this embodiment), and calculate the number of layers. To ensure vertical coverage integrity, if the calculated number of layers n is less than a preset minimum value (set to 3 in this embodiment), the layer thickness is recalculated. ,in, To ensure vertical coverage integrity, the recalculated layer thickness is set to n=3. Then, the Z-axis height of each layer is generated: ,in, Let i be the reference height of the i-th layer. The minimum Z-axis value for building clustering, corresponding to the height range of each floor. .
[0036] As a specific implementation example, for the aforementioned extracted cluster of tallest buildings, its AABB Z-axis range is [25.0m, 70.0m], and the cluster height is... Given a layer thickness of t = 1.0m and a calculated number of layers n = 45, satisfying the requirement of n ≥ 3, the Z-axis height of each layer is... That is, the 0th floor corresponds to 25.0m~26.0m, the 1st floor corresponds to 26.0m~27.0m, and so on, until the 44th floor corresponds to 69.0m~70.0m.
[0037] Furthermore, regarding the intra-layer point cloud projection and 2D point set construction, after layering, this embodiment performs XY plane projection on the point cloud within the height range of each layer to form a 2D point set. Specifically, for the i-th layer, points that satisfy... Given a point cloud with conditions, retain its (x,y) coordinates and ignore the Z coordinate to form a two-dimensional point set. As an implementation example, the i=10th floor (corresponding to a Z-axis height of 35.0m~36.0m) is selected for processing. All point clouds within the height range of this floor are projected onto the XY plane to obtain a two-dimensional point set S10, which reflects the horizontal cross-sectional distribution of the building at a height of 35 meters.
[0038] Finally, contour extraction based on morphological processing is performed. Specifically, a two-dimensional mesh image is constructed by setting the grid resolution s=0.05m. Its size is the bounding box's span in the XY directions divided by s. The two-dimensional point set... Mapped onto a mesh image, if a point cloud projection point exists within a mesh cell, that cell is set to 1 (foreground); otherwise, it is set to 0 (background), generating a binary image. Subsequently, morphological dilation and erosion operations are performed on the binary image to fill gaps in the point cloud and smooth edges. This embodiment uses a 3×3 elliptical structuring element. First, a dilation operation is performed (one iteration) to connect broken point cloud regions; then, an erosion operation is performed (one iteration) to restore the original contour size and eliminate edge expansion caused by dilation. Finally, the contour lines are extracted from the processed binary image using the Canny edge detection algorithm to obtain the two-dimensional contour of that floor of the building. Two-dimensional contour A polygonal representation consisting of continuous vertices serves as the geometric contour information for that layer.
[0039] As an implementation example, for the 2D point set of layer 10 A binary image was generated with a grid resolution of 0.05m. After dilation and erosion processing using a 3×3 elliptical structuring element, the gaps caused by the sparse point cloud were effectively filled. Contours were then extracted using Canny edge detection. The outline is a continuous polygon consisting of 120 vertices, accurately reflecting the geometry of the building at a height of 35 meters.
[0040] Through the above steps, this practical step completes the construction of layered geometric contour information from a 3D target point cloud. The generated geometric contour information not only preserves the true geometric features of the building, but also eliminates noise interference through morphological processing, forming continuous closed polygons, providing a precise geometric basis for subsequent contour-based generation of inspection waypoint sequences.
[0041] S400: Generate a sequence of inspection waypoints based on the geometric contour information, wherein each inspection waypoint in the sequence is associated with a safe location point and a target detection point.
[0042] In this embodiment, the safe flight position of the UAV is first calculated based on the extracted two-dimensional contour information. Specifically, for the two-dimensional contour of the i-th layer... It consists of m consecutive vertices, denoted as . This embodiment calculates the contour. Each vertex external normal vector The external normal vector is obtained by cross product of adjacent vertex vectors, and its direction is ensured to be away from the center of the building.
[0043] Set a safety distance D (configurable range 0.3m~3.0m, default is 1.0m in this embodiment), along the outer normal vector. Directional translation vertex Obtain a safe location point The calculation formula is as follows: ,in, This is the magnitude of the normal vector. To avoid flight path oscillations caused by overlapping waypoints, this embodiment uses adjacent safe location points... , Calculate the Euclidean distance. If the distance is less than 0.5D, delete the next waypoint to ensure that the waypoint spacing meets the constraints. .
[0044] To determine the location on the building surface that the drone sensor needs to be aligned with, this embodiment follows the original contour. Target detection points are generated using arc-length parameterized uniform sampling. The sampling interval L is set (configurable range 0.3m~1.5m, default is 0.8m in this embodiment), and the contour is calculated. Total length The number of sampling points k is determined based on the sampling interval L, using the following formula: Where ⌈⋅⌉ represents rounding up. Based on the number of sampling points k, in the contour Generate uniformly distributed target detection points. Each target detection point corresponds to a specific detection location on the building surface.
[0045] Furthermore, due to the set of safe location points With the set of target detection points The numbers may be inconsistent (e.g., due to waypoint de-overlap operations). This embodiment uses the Intermediate Closest Point Iteration (ICP) algorithm to achieve rigid matching between the two sets. The ICP algorithm ensures that each safe location point... Corresponding to a unique target detection point The paired waypoint sequences are arranged in an orderly manner along the contour, either clockwise or counterclockwise. After pairing, a basic association relationship is formed between the inspection waypoint sequences, meaning that each inspection waypoint is associated with a safe location point and a target detection point.
[0046] Finally, to convert waypoints on a two-dimensional plane into flight coordinates in three-dimensional space, this embodiment assigns the Z-axis height of its respective layer to each inspection waypoint. Specifically, if the height range of the i-th layer is... Then assign Z-axis height to all waypoints on this layer. The calculation formula is as follows: This ultimately forms three-dimensional waypoint coordinates. The process of generating the inspection waypoint sequence is completed.
[0047] S500: Calculate the attitude angle of each inspection point based on the spatial relationship between the safe location point and the target detection point.
[0048] In this embodiment, the coordinate system of the waypoint data is first determined. If the input point cloud contains geographic coordinate information (such as the UTM coordinate system), the safe location points are transformed using a coordinate transformation matrix. With target detection point Convert from a local coordinate system or UTM coordinate system to the WGS84 latitude and longitude coordinate system with a conversion accuracy controlled within ≤0.1m. The output coordinate system can be selected through a configuration file, supporting UTM, WGS84, or local Cartesian coordinate systems.
[0049] Further direction vector calculation is performed for each waypoint in the inspection waypoint sequence. Define its safe location point coordinates as The coordinates of the associated target detection points are This embodiment calculates the direction vector from the safe location point to the target detection point. The calculation formula is as follows: This vector represents the spatial direction that the sensor needs to face.
[0050] Then, the yaw angle, pitch angle, and roll angle are calculated or set, where the yaw angle is used to control the horizontal orientation of the UAV's nose. This embodiment uses the direction vector... Projecting onto the XY plane yields the projection vector. Define true north as the positive Y-axis of the coordinate system, and yaw as the projection vector. The angle with due north ranges from -π to π. The calculation formula uses the four-quadrant arctangent function: The calculation result is in radians, which can be converted to degrees (°) upon output. The pitch angle is used to control the vertical pitch of the UAV's onboard sensors. This embodiment calculates the direction vector. The angle between the plane and the XY plane ranges from [−π / 2, π / 2]. The calculation formula is as follows: .
[0051] In this embodiment, the drone maintains horizontal flight by default, so the roll angle is set to 0 by default. However, users can customize the roll angle through the configuration management module to suit specific inspection scenarios.
[0052] S600: Output inspection waypoint data containing the coordinate information of the safe location point and the attitude angle.
[0053] Specifically, this embodiment supports multiple mainstream waypoint data output formats to adapt to the needs of different flight control systems and post-processing software. Supported formats include: CSV format: a general text format suitable for most data processing software and custom script parsing; KML format: suitable for path visualization preview in geographic information software such as Google Earth; JSON format: suitable for web-based display or API interface data transmission; and UAV industry standard formats: including the Waypoint file format for PX4 systems and the Waypoint Pro format for DJI systems, which can be directly imported into the corresponding brand of UAV ground station software. The output format can be selected through a configuration file or a graphical interface; the default output format is CSV.
[0054] For the selected output format, this embodiment encapsulates the inspection waypoint data into a data structure containing the following core fields to ensure the integrity of flight control and mission execution: Waypoint number: a unique index ID that identifies each waypoint; Safe location point coordinates: the three-dimensional coordinates of the actual flight path of the UAV (supporting local X / Y / Z coordinates or latitude / longitude geographic coordinates); Target detection point coordinates: the three-dimensional coordinates of the detection position on the surface of the building corresponding to the waypoint; Attitude angle information: including yaw, pitch, and roll, in degrees (°); Safe distance: the Euclidean distance between the safe location point and the target detection point, in meters (m); Layer number: the vertical layer index to which the waypoint belongs; Building ID: the cluster number of the target building to which the waypoint belongs, used for distinguishing multiple building scenes.
[0055] In addition to standard waypoint data, this embodiment also supports generating 3D visualization files containing geometric information and attitude vectors. Specifically, it generates 3D files in .PLY or .OBJ format, which include: raw point cloud data: using color to distinguish ground, non-ground, and building target point clouds; layered contour lines: using different colors to identify the extracted contours of each layer; waypoint sequence: marking safe location points with spheres; and attitude vectors: displaying the direction from the safe location point to the target detection point in the form of arrow vectors, intuitively reflecting the sensor's orientation. This visualization file can be used for path verification and anomaly detection before mission execution.
[0056] In summary, this implementation method constructs a complete technical system from hardware environment configuration to software algorithm execution. Multi-format point cloud loading and standardized preprocessing eliminate data heterogeneity and noise interference. RANSAC ground segmentation and improved DBSCAN clustering enable automatic identification and priority selection of multiple building targets. Adaptive hierarchical processing and morphological contour extraction ensure the continuity and accuracy of geometric information. Waypoint sequences generated based on external normal vector translation and ICP pairing achieve precise control with a safe distance ≤10cm. Cooperatively calculated attitude angles reduce sensor orientation error to within 0.5°. Finally, through multi-format compatible output and visualization verification, the planning time for a single building is reduced to the second level, improving efficiency by more than 50 times compared to manual methods. Data acquisition efficiency is increased to over 95%, significantly enhancing the automation, safety, accuracy, and engineering practicality of building inspection.
[0057] Please refer to Figure 2 , Figure 2 This application provides an embodiment of an automatic waypoint generation system for building inspection based on 3D point clouds. The system includes a data acquisition module 21, a point cloud processing module 22, a contour construction module 23, a waypoint generation module 24, an attitude calculation module 25, and a data output module 26. Specifically: The data acquisition module 21 is used to acquire 3D point cloud data of the area to be inspected. Specifically, the data acquisition module 21 integrates a multi-format parser, supporting the loading of 3D point cloud files in PCD, PLY, XYZ, and LAS / LAZ formats. For LAS / LAZ format, the module internally calls the GDAL library to parse geographic coordinate information and automatically converts it to PCD format for unified processing by subsequent modules. This module is also responsible for transmitting the loaded raw point cloud data to the point cloud processing module 22.
[0058] The point cloud processing module 22 is used to process the 3D point cloud data, remove interference data, and extract the target point cloud of the target building. The point cloud processing module 22 includes a preprocessing unit 221, used to perform statistical outlier filtering (setting the number of neighborhood points k=20, standard deviation threshold σ=1.0), voxel mesh downsampling (voxel size 0.05m³), and normal vector estimation based on the covariance matrix eigenvalue decomposition method (neighborhood search radius 0.3m). The ground segmentation unit 222 is configured to fit the ground plane based on the RANSAC algorithm (distance threshold 0.2m, maximum iteration count 1000), segmenting the point cloud into ground point clouds and non-ground point clouds, and extracting the maximum Z-coordinate of the ground point cloud. The clustering extraction unit 223 is configured to cluster the filtered target point cloud using an improved DBSCAN algorithm, where the neighborhood radius is adaptively calculated based on the point cloud density. The point cloud processing module 22 outputs the target point cloud data of the target buildings and passes it to the contour construction module. The neighborhood radius is adaptively calculated based on the point cloud density, with a minimum number of points. For each cluster, the axis-aligned bounding box (AABB) is calculated, and the Z-axis span is obtained as the cluster height. The top N clusters are then selected as the target buildings in descending order of height.
[0059] The contour construction module 23 is used to construct the geometric contour information of the target building based on the target point cloud. This module 23 internally includes an adaptive layering unit 231 and a morphological contour extraction unit 232. Specifically, the contour construction module 23 performs adaptive height layering of the target building along the Z-axis (default layer thickness 1.0m, minimum number of layers 3), and performs XY plane projection on the point cloud within each layer's height range to form a two-dimensional point set. Subsequently, the two-dimensional point set is mapped to a binary image, and morphological dilation and erosion operations (3×3 elliptical structuring elements) are performed to fill gaps and smooth edges. Finally, continuous polygonal contours are extracted using the Canny edge detection algorithm as the geometric contour information of that layer. The output of the contour construction module 23 is layered geometric contour data, which is then passed to the waypoint generation module 24.
[0060] The waypoint generation module 24 is used to generate a sequence of inspection waypoints based on the geometric contour information. Each inspection waypoint in the sequence is associated with a safe location point and a target detection point. The waypoint generation module 24 internally includes a safe distance calculation unit 241, a target point sampling unit 242, and an ICP pairing unit 243. Specifically, the waypoint generation module 24 calculates the outward normal vector of the vertices of the geometric contour, and translates it along the direction of the outward normal vector by a preset safe distance (default 1.0m) to obtain the safe location point; it generates target detection points by uniformly sampling along the original contour using arc length parameterization (default interval 0.8m); finally, it uses the nearest point iteration (ICP) algorithm to achieve rigid matching between the set of safe location points and the set of target detection points, ensuring that each safe location point is associated with a unique target detection point, and forming an ordered sequence of inspection waypoints. The output of the waypoint generation module 24 is a waypoint sequence containing the association between safe location points and target detection points, which is passed to the attitude calculation module 25.
[0061] The attitude calculation module 25 is used to calculate the attitude angle of each waypoint based on the spatial relationship between the safe location point and the target detection point. The attitude calculation module 25 integrates a coordinate system transformation engine 251 (supporting bidirectional conversion between UTM and WGS84, with an accuracy ≤0.1m) and an attitude angle precision calculation unit 252. Specifically, the attitude calculation module 25 calculates the direction vector from the safe location point to the target detection point, calculates the yaw angle based on the angle between the projection vector of this direction vector on the XY plane and the true north direction, and calculates the pitch angle based on the angle between this direction vector and the XY plane. The output of the attitude calculation module 25 is complete waypoint data containing coordinate and attitude angle information, which is transmitted to the data output module 26.
[0062] The data output module 26 is used to output inspection waypoint data containing the coordinate information of the safe location points and the attitude angles. The data output module 26 supports converting waypoint data into CSV, KML, JSON, and UAV industry standard formats (such as PX4Waypoint and DJIWaypointPro). The output data fields include at least the waypoint number, safe location point coordinates, target detection point coordinates, yaw angle, pitch angle, safe distance, floor number, and building ID. In addition, this module also supports generating a 3D visualization file (.ply format) containing point clouds, contours, waypoints, and attitude vectors for pre-mission path verification.
[0063] Please refer to Figure 3 Based on the same inventive concept, this application also provides a schematic diagram of the physical structure of an electronic device, such as... Figure 3As shown, the electronic device 50 includes a processor 501, a memory 502, and a bus 503; wherein the processor 501 and the memory 502 communicate with each other through the bus 503; the processor 501 is used to call program instructions in the memory 502 to execute the methods provided in the above-described method embodiments.
[0064] Based on the same inventive concept, embodiments of this application also provide a computer-readable storage medium storing computer program instructions, which, when read and executed by a processor, perform the steps in any of the above implementations.
[0065] The computer-readable storage medium can be any medium capable of storing program code, such as Random Access Memory (RAM), Read-Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), or Electrically Erasable Programmable Read-Only Memory (EEPROM). The storage medium stores the program, and the processor executes the program after receiving an execution instruction. The method executed by the electronic terminal as defined in any embodiment of this invention can be applied to the processor or implemented by the processor.
[0066] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0067] Furthermore, the units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0068] Furthermore, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0069] It can be replaced and can be implemented, wholly or partially, through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented, wholly or partially, in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated.
[0070] The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means.
[0071] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application.
Claims
1. A method for automatically generating waypoints for building inspection based on 3D point clouds, characterized in that, The method includes: Construct the geometric outline information of the target building; A sequence of inspection waypoints is generated based on the geometric contour information, wherein each inspection waypoint in the sequence is associated with a safe location point and a target detection point; Based on the spatial relationship between the safe location point and the target detection point, calculate the attitude angle of each inspection point; The output includes the coordinates of the safe location and the inspection waypoint data of the attitude angle.
2. The method for automatically generating building inspection waypoints according to claim 1, characterized in that, Before constructing the geometric contour information of the target building, the method further includes: Acquire 3D point cloud data of the area to be inspected; The RANSAC algorithm is used to fit the ground plane, and the three-dimensional point cloud data is divided into ground point cloud and non-ground point cloud. The maximum Z coordinate of the ground point cloud is extracted as the height reference. The filtering threshold is calculated based on the height reference and the preset ground detection distance threshold to filter out low-lying interference points with Z coordinates less than the filtering threshold, so as to retain the target point cloud of the building. Furthermore, the construction of the geometric contour information of the target building includes: determining the geometric contour information of the target building based on the target point cloud.
3. The method for automatically generating building inspection waypoints according to claim 2, characterized in that, The method further includes: An improved DBSCAN algorithm is used to cluster the target point cloud, wherein the neighborhood radius is adaptively calculated based on the point cloud density; Align the bounding box with the calculation axis for each cluster and obtain the Z-axis span of the bounding box as the cluster height; Sort by cluster height in descending order and select the top N clusters as target buildings to achieve priority screening of multiple buildings; Furthermore, the construction of the geometric contour information of the target building includes: determining the geometric contour information of the target building based on the target point cloud of the target building after priority filtering.
4. The method for automatically generating building inspection waypoints according to claim 1, characterized in that, The process of constructing the geometric contour information of the target building includes: Adaptive height layering is performed on the target building along the Z-axis to generate several height intervals; Perform XY plane projection on the point cloud within each height range to form a two-dimensional point set; The two-dimensional point set is mapped to a binary image, and morphological dilation and erosion operations are performed to fill gaps and smooth edges. The edge detection algorithm extracts continuous polygonal contours from the processed binary image, which serve as the geometric contour information of the layer.
5. The method for automatically generating building inspection waypoints according to claim 1 or 4, characterized in that, The step of generating the inspection waypoint sequence based on the geometric contour information includes: Calculate the external normal vector of each vertex of the geometric contour information, and translate it along the direction of the external normal vector by a preset safe distance to obtain a safe position point; The target detection points are generated by uniformly sampling along the geometric contour information using arc length parameterization. The nearest point iteration algorithm is used to achieve rigid matching between the set of safe location points and the set of target detection points, ensuring that each safe location point is associated with a unique target detection point and forming an ordered sequence of inspection waypoints.
6. The method for automatically generating building inspection waypoints according to claim 5, characterized in that, The step of generating the inspection waypoint sequence based on the geometric contour information further includes: Set the layer thickness parameter, calculate the number of layers based on the building cluster height, and if the number of layers is less than the preset minimum value, recalculate the layer thickness to ensure vertical coverage integrity. Assign the Z-axis height of the layer to each inspection waypoint to form three-dimensional waypoint coordinates.
7. The method for automatically generating building inspection waypoints according to claim 1, characterized in that, The calculation of the attitude angle of each inspection point based on the spatial relationship between the safe location point and the target detection point includes: Calculate the direction vector from the safe location point to the target detection point; Calculate the angle between the projection vector of the direction vector onto the XY plane and the due north direction, and use it as the yaw angle; Calculate the angle between the direction vector and the XY plane, and use it as the pitch angle; The yaw angle and pitch angle are used to control the orientation of the UAV's onboard sensors.
8. The method for automatically generating building inspection waypoints according to claim 1, characterized in that, The output includes the coordinate information of the safe location point and the inspection waypoint data of the attitude angle, including: Convert waypoint data to CSV, KML, JSON, and drone industry standard formats; The output should include at least the following data fields: waypoint number, safe location coordinates, target detection point coordinates, yaw angle, pitch angle, safe distance, floor number, and building ID. Generate a 3D visualization file containing point clouds, contours, waypoints, and attitude vectors.
9. An automatic waypoint generation system for building inspection based on 3D point clouds, characterized in that, include: The contour construction module is used to construct the geometric contour information of the target building; A waypoint generation module is used to generate a sequence of inspection waypoints based on the geometric contour information, wherein each inspection waypoint in the sequence is associated with a safe location point and a target detection point. The attitude calculation module is used to calculate the attitude angle of each inspection point based on the spatial positional relationship between the safe location point and the target detection point; The data output module is used to output inspection waypoint data containing the coordinate information of the safe location point and the attitude angle.
10. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing program instructions, and the processor executing the steps of the method according to any one of claims 1-8 when running the program instructions.