Campsite patrol route planning method and system based on unmanned aerial vehicle

By acquiring 3D point cloud data to identify the surface of the mesh fence and filtering low-texture background areas, a virtual line-of-sight vector and inverse optical axis are constructed to optimize the drone patrol path. This solves the problem that traditional drones have difficulty accurately identifying fence features in complex backgrounds, and improves the accuracy and stability of patrols.

CN122200427APending Publication Date: 2026-06-12HUBEI JIFANG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUBEI JIFANG TECH CO LTD
Filing Date
2026-03-05
Publication Date
2026-06-12

Smart Images

  • Figure CN122200427A_ABST
    Figure CN122200427A_ABST
Patent Text Reader

Abstract

A campsite patrol route planning method and system based on a UAV, in the method, by analyzing the three-dimensional point cloud data around the fence of the campsite, first, the surface of the mesh fence is identified, and the low-texture background area is screened out by using the normal vector variance feature. For each monitoring point on the fence, search for an unobstructed area center in the low-texture background area as a background target anchor point, and establish a virtual line-of-sight vector from the background anchor point to the monitoring point. Based on this line-of-sight vector, the reverse optical axis is generated by extending outside the fence, and the optimal shooting flight point is determined in combination with the preset imaging depth. The application is used to improve the accuracy of automatic defect recognition based on a UAV.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of image recognition and path planning, and in particular relates to a method and system for planning camp patrol routes based on drones. Background Technology

[0002] Construction camps for power facilities are increasingly being established in remote, wilderness areas. These camps typically store large quantities of valuable materials such as towers and cables, as well as construction machinery. Because these camps are often located in complex, unpredictable terrain with large and irregular perimeters, traditional security measures rely primarily on regular, manual foot patrols. This method is not only labor-intensive but also suffers from limited visibility at night or in rainy or foggy weather, making it difficult to detect hidden safety hazards in blind spots or obscured by materials. Consequently, it fails to meet the actual needs of construction camps for 24 / 7, high-density security.

[0003] Among related technologies, a drone-based automatic patrol technology based on full-coverage path planning is widely adopted. This technology pre-defines the boundary range of the camp and uses the "ox-plowing method" or spiral search algorithm to generate a continuous flight path that can cover the entire target area of ​​the camp. When performing the mission, the drone maintains the preset flight altitude and gimbal pitch angle, flies back and forth along the generated path, and continuously collects images, thereby realizing rapid and automated monitoring of the camp's interior and perimeter areas, improving the coverage and standardization of patrol operations.

[0004] However, camp perimeters are typically constructed of metal mesh fences, while the ground environment where camps are located is often a mixture of gravel, weeds, and piled-up construction waste, exhibiting extremely high texture complexity and color diversity. When drones use fixed flight altitudes and a single gimbal pitch angle in related technologies to cover and photograph the perimeter fence, the path planning stage only considers the field of view coverage. As a result, in many frames, the perforated features of the mesh fence are directly superimposed on the equally complex gravel or weed background. This spatial overlap causes a high degree of confusion between the foreground and background in terms of texture features and grayscale distribution, reducing the contrast and clarity of target edges in the image. It makes it difficult to accurately extract the structural features of the fence from complex background noise, increasing the computational burden on feature extraction algorithms and reducing the accuracy of automated defect identification. Summary of the Invention

[0005] This application provides a method and system for planning camp patrol routes based on drones, which can improve the accuracy of automated defect identification based on drones.

[0006] In the first aspect, this application provides a method for planning camp patrol routes based on drones, which acquires three-dimensional point cloud data including the camp fence and the preset range of the camp fence;

[0007] Based on spatial topological relationships, the surface data of the mesh fence in the 3D point cloud data is identified, and the point cloud set located inside and above the surface of the mesh fence is determined as the environmental background data.

[0008] Calculate the normal vector variance of each local region based on environmental background data;

[0009] Regions with normal vector variance less than a preset smoothing threshold are defined as low-texture background reference areas;

[0010] The coordinates of the monitoring points to be inspected are determined from the surface data of the mesh fence, and the center of the area in the low-texture background reference area where there are no obstructions between the coordinates of the monitoring points is searched, which is used as the background target anchor point corresponding to the coordinates of the monitoring points.

[0011] Construct a virtual line-of-sight vector that starts from the background target anchor point and points to the coordinates of the monitoring point;

[0012] The virtual line-of-sight vector extends from the coordinates of the monitoring point towards the outer normal direction of the mesh fence surface, generating a reverse optical axis;

[0013] On the reverse optical axis, a point whose Euclidean distance from the coordinates of the monitoring point conforms to the preset imaging depth of field is selected as the optimal shooting waypoint of the monitoring point corresponding to the coordinates of the monitoring point.

[0014] Based on the spatial distribution order of each monitoring point on the surface of the mesh fence, the optimal shooting waypoints corresponding to each monitoring point are connected sequentially to generate the drone patrol flight path.

[0015] By employing the aforementioned technical solution, environmental background data is determined by identifying the surface of the mesh fence and its inner side and above. A low-texture background reference area is then selected based on the normal vector variance calculation. Suitable background target anchor points are found for each monitoring point. Based on this, a virtual line-of-sight vector is constructed and a reverse optical axis is generated, thereby determining the optimal shooting waypoint. This allows the shooting perspective to simultaneously include the monitoring point and the low-texture background area within the field of view. This background-reference-based waypoint planning method improves the imaging quality of mesh fence inspection images and reduces the interference of background clutter on target detection. Determining the shooting position within a preset depth of field improves the clarity and stability of image acquisition. Connecting waypoints according to the spatial distribution order of monitoring points on the fence surface to generate a flight path improves the accuracy of automated defect identification based on UAVs.

[0016] In conjunction with some implementation methods of the first aspect, in some implementation methods, the normal vector variance of each local region is calculated based on environmental background data, specifically including:

[0017] Using each laser point in the environmental background data as the center, search for the set of neighborhood points within the preset sampling radius by Euclidean distance to construct a local sampling sphere;

[0018] The least squares method is used to fit a plane to all points within the local sampling sphere, resulting in the fitting plane and the normal vector of the fitting plane corresponding to the local sampling sphere.

[0019] Calculate the vertical distance of each point within the local sampling sphere relative to the fitting plane, and determine the arithmetic mean of the vertical distances as the roughness index of the local region;

[0020] The cosine of the angle between the normal vector of all points within the local sampling sphere and the normal vector of the fitted plane is calculated.

[0021] The variance of the normal vector of a local region is generated by weighting the roughness index and the cosine of the included angle.

[0022] By employing the above technical solution, a local sampling sphere is constructed centered on each laser point. The least squares method is used for plane fitting and the normal vector is calculated. Simultaneously, the roughness index is calculated by combining the perpendicular distance from the point to the fitted plane, and the cosine of the angle between the point's normal vector and the fitted plane's normal vector, generating a more comprehensive and accurate normal vector variance index. This multi-dimensional feature fusion calculation method improves the accuracy of describing regional surface characteristics and enhances the ability of the normal vector variance to characterize the smoothness of local areas. By introducing a weighted calculation of perpendicular distance and the cosine of the angle, the adaptability of the normal vector variance to different types of surface features is improved, reducing the probability of misjudgment during background area identification.

[0023] In conjunction with some implementations of the first aspect, in some implementations, the center of a region in the low-texture background reference area where there are no occluding obstacles between the monitoring point coordinates and the region is searched, and used as the background target anchor point corresponding to the monitoring point coordinates, specifically including:

[0024] Several candidate anchor points are generated in the low-texture background reference area, and for each candidate anchor point, a virtual cone visual channel is constructed with the monitoring point coordinates as the vertex and the candidate anchor point as the center of the bottom surface.

[0025] Obtain the side wall tilt angle of the virtual cone's visual channel, and filter out the set of interference point clouds located between the monitoring point coordinates and the candidate anchor points based on the side wall tilt angle;

[0026] Calculate the projected distance from each point in the interference point cloud set to the central axis connecting the coordinates of the monitoring point and the candidate anchor point;

[0027] If the interference point cloud set is empty, or the projection distance of all points in the interference point cloud set is greater than the preset safe perspective threshold, then it is determined that the virtual cone's visual channel is not obstructed.

[0028] Candidate anchor points corresponding to the unobstructed visual channel of the virtual cone are selected as background target anchor points corresponding to the monitoring points.

[0029] By employing the aforementioned technical solution, a virtual cone-shaped visual channel is constructed with the monitoring point as the vertex and the candidate anchor point as the center of the base. This channel, combined with the sidewall tilt angle, filters the set of interfering point clouds and calculates the projection distance of the interfering point cloud to the central axis for occlusion determination. This ensures that the selected background target anchor point maintains good visibility with the monitoring point. This anchor point filtering method based on spatial geometry improves the rationality of background area selection and enhances the visual contrast between the monitoring point and the background. By pre-setting a safe perspective threshold to control the influence range of the interfering point cloud, the reliability of background target anchor point selection is improved, and the probability of the background area being interfered with by local occlusions is reduced.

[0030] In conjunction with some implementations of the first aspect, in some implementations, after sequentially connecting the optimal shooting waypoints corresponding to each monitoring point according to the spatial distribution order of each monitoring point on the surface of the mesh fence to generate the UAV patrol flight path, the method further includes:

[0031] Obtain the edge contour range of the low-texture background reference area;

[0032] Construct a line-of-sight envelope space with the coordinates of the monitoring points as vertices and covering the edge contour range;

[0033] Determine the waypoint constraint plane that contains the optimal shooting waypoint and is perpendicular to the inverse optical axis;

[0034] Calculate the overlapping region between the line-of-sight envelope space and the waypoint constraint plane, and define the overlapping region as the visual tolerance constraint domain;

[0035] Based on the visual tolerance constraint domain corresponding to each monitoring point, curve fitting is performed on the UAV patrol flight path to generate a smooth patrol path that ensures the UAV's onboard camera line of sight is always within the low-texture background reference area when the UAV flies over each optimal shooting waypoint.

[0036] By employing the aforementioned technical solution, the edge contour range of the low-texture background reference area is obtained, a line-of-sight envelope space covering this range is constructed, and the overlapping area with the waypoint constraint plane is used as the visual tolerance constraint domain. Based on this, curve fitting is performed on the flight path, ensuring that the onboard camera's line of sight remains within the low-texture background area when the UAV flies over each optimal shooting waypoint. This path optimization method considering visual tolerance improves the smoothness of the flight trajectory and enhances the stability of image acquisition during UAV patrols. By ensuring that the camera's line of sight is always aligned with the low-texture background area, the background consistency of fence patrol images is improved, and image quality fluctuations caused by background changes during flight are reduced.

[0037] In conjunction with some implementation methods of the first aspect, in some implementation methods, curve fitting is performed on the UAV patrol flight path based on the visual tolerance constraint domain corresponding to each monitoring point, specifically including:

[0038] Following the extension direction of the drone's patrol flight path, the edges of adjacent visual tolerance constraint domains are connected sequentially to construct a virtual flight corridor in three-dimensional space.

[0039] Using the optimal shooting waypoint as the initial control point, an initial spline curve is generated;

[0040] Given that the initial spline curve exceeds the spatial boundary of the virtual flight corridor, an iterative algorithm is used to converge the coordinates of the control points in the excess portion toward the central axis of the virtual flight corridor until a smooth patrol track is generated that ensures the onboard camera's line of sight remains within the low-texture background reference area when the UAV flies over each optimal shooting waypoint.

[0041] By employing the aforementioned technical solution, a virtual flight corridor is constructed by sequentially connecting the edges of adjacent visual tolerance constraint domains, providing a clear spatial constraint range for the UAV's flight path. Based on this, spline curves are generated using the optimal waypoints as initial control points. An iterative algorithm then converges control points exceeding the virtual flight corridor towards the central axis, ensuring that the generated patrol track maintains both the camera's line of sight within a low-texture background area as the UAV flies over each waypoint and exhibits good smoothness. This path planning method, based on virtual flight corridors and iterative optimization, improves the continuity of the UAV's patrol track, reduces sharp turns during flight, and lowers the UAV's energy consumption during patrol missions. Since the generated track curves are always confined within the visual tolerance constraint domain, the stability of the shooting background is improved, enhancing the quality of image acquisition during the patrol process.

[0042] In conjunction with some implementations of the first aspect, in some implementations, after determining the overlapping region as the visual tolerance constraint domain, the method further includes:

[0043] Calculate the path curvature of the line connecting adjacent waypoints based on the spatial distribution order of each optimal shooting waypoint;

[0044] Regions where the path curvature exceeds a preset threshold are identified as abrupt turning zones.

[0045] For the visual tolerance constraint domain corresponding to the monitoring point in the turning change zone, perform asymmetric preservation processing on the centrifugal side to generate a corrected visual tolerance constraint domain.

[0046] By employing the aforementioned technical solution, and by calculating the path curvature of the lines connecting adjacent waypoints and identifying abrupt turning zones, the visual tolerance constraint domains within these regions can be optimized in a targeted manner. Asymmetric preservation processing on the centrifugal side is applied to the visual tolerance constraint domains corresponding to monitoring points within the abrupt turning zones, resulting in a generated trajectory with greater maneuverability at turns. This curvature-based constraint domain correction method improves the smoothness of the trajectory in large-angle turning regions, reducing attitude fluctuations during UAV maneuvers. Because the constraint domain space on the outer side of the turn is preserved, the UAV can complete heading changes with a larger turning radius, reducing centrifugal loads during flight and improving flight stability during high-speed cruise.

[0047] In conjunction with some implementations of the first aspect, in some implementations, asymmetric preservation processing on the centrifugal side is performed on the visual tolerance constraint domain corresponding to the monitoring point within the turning abrupt change region, specifically including:

[0048] Determine the inside and outside directions of the turning abrupt change zone;

[0049] Within the visual tolerance constraint domain, the area located on the inside of the turn is defined as the background pollution risk zone based on the optimal shooting waypoint;

[0050] The background contamination risk area is removed from the visual tolerance constraint domain, and only the area located on the outside of the turn is retained as the modified visual tolerance constraint domain.

[0051] By adopting the above technical solution, and by identifying and removing the background contamination risk area on the inside of the turn within the visual tolerance constraint domain, retaining only the outside area as the corrected visual tolerance constraint domain, the UAV can maintain better background observation results when performing turns. This directional constraint domain pruning method improves the visual reliability of the background area during turns and reduces background interference caused by changes in aircraft attitude. Since the corrected visual tolerance constraint domain avoids unfavorable observation areas on the inside of the turn, it improves the effectiveness of image acquisition during patrols and enhances target detection performance during large-angle turns. By rationally planning the constraint space of the turn segment, it reduces image quality fluctuations caused by background switching, improving the continuity and reliability of patrol tasks.

[0052] Secondly, embodiments of this application provide a UAV-based campsite patrol route planning system, which includes: one or more processors and a memory; the memory is coupled to one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and one or more processors call the computer instructions to cause the system to perform the method described in the first aspect and any possible implementation thereof.

[0053] Thirdly, embodiments of this application provide a computer-readable storage medium including instructions that, when executed on a system, cause the system to perform the method described in the first aspect and any possible implementation thereof.

[0054] Fourthly, embodiments of this application provide a computer program product that, when run on a system, causes the system to execute the method described in any possible implementation of the first aspect.

[0055] One or more technical solutions provided in the embodiments of this application have at least the following technical effects or advantages:

[0056] 1. This application provides a method for planning camp patrol routes based on unmanned aerial vehicles (UAVs). By identifying the surface of a mesh fence and determining environmental background data on its inner side and above, and combining this with normal vector variance calculation to filter out low-texture background reference areas, suitable background target anchor points are found for each monitoring point. Based on this, a virtual line-of-sight vector is constructed and an inverse optical axis is generated, thereby determining the optimal shooting waypoint. This allows the shooting angle to simultaneously include the monitoring point and the low-texture background area within the field of view. This background-reference-based waypoint planning method improves the imaging quality of mesh fence patrol images and reduces the interference of background clutter on target detection. By determining the shooting position within a preset depth of field, the clarity and stability of image acquisition are improved. Connecting waypoints according to the spatial distribution order of monitoring points on the fence surface to generate a flight path improves the accuracy of automated defect identification based on UAVs.

[0057] 2. This application provides a method for planning camp patrol routes based on unmanned aerial vehicles (UAVs). By obtaining the edge contour range of a low-texture background reference area, a line-of-sight envelope space covering this range is constructed. The overlapping area between this envelope and the waypoint constraint plane is then used as a visual tolerance constraint domain. Based on this, curve fitting is performed on the flight path, ensuring that the UAV maintains the onboard camera's line of sight within the low-texture background area while flying over optimal waypoints. This path optimization method considering visual tolerance improves the smoothness of the flight trajectory and enhances the stability of image acquisition during UAV patrols. By ensuring that the camera's line of sight is always aligned with the low-texture background area, the background consistency of fence patrol images is improved, and image quality fluctuations caused by background changes during flight are reduced. Attached Figure Description

[0058] Figure 1 This is a flowchart illustrating a method for planning camp patrol routes based on unmanned aerial vehicles (UAVs) in an embodiment of this application.

[0059] Figure 2 This is another flowchart illustrating a method for planning camp patrol routes based on unmanned aerial vehicles (UAVs) in an embodiment of this application.

[0060] Figure 3 This is a schematic diagram of the physical device structure of a camp patrol route planning system based on unmanned aerial vehicles (UAVs) provided in an embodiment of this application. Detailed Implementation

[0061] The terminology used in the following embodiments of this application is for the purpose of describing particular embodiments only and is not intended to be limiting of this application. As used in the specification and appended claims of this application, the singular expressions “a,” “an,” “the,” “the,” “the,” and “this” are intended to include the plural expressions as well, unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this application refers to any or all possible combinations including one or more of the listed items.

[0062] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.

[0063] The following example is used in conjunction with Figure 1 This application describes a method for planning camp patrol routes based on unmanned aerial vehicles (UAVs) in an embodiment of the present application:

[0064] Please see Figure 1 This is a flowchart illustrating a method for planning a camp patrol route based on a drone, as described in this application.

[0065] S101. Obtain three-dimensional point cloud data including the camp fence and the preset range of the camp fence;

[0066] A campsite fence refers to a physical barrier structure used to isolate, protect, or define a specific campsite area. It typically takes the form of a mesh, fence, or solid wall; in this embodiment, it mainly refers to a three-dimensional isolation facility with a mesh structure. The preset range of the campsite fence refers to a specific spatial distance extending inwards and outwards from the physical location of the campsite fence. The specific value of this distance is not limited and can be five meters, ten meters, or a value set according to the effective detection range of the sensors carried by the UAV. Three-dimensional point cloud data refers to a data set composed of massive spatial coordinate points acquired through LiDAR or photogrammetry technology. Each point contains three-dimensional coordinate (X, Y, Z) information and may include attribute information such as color (RGB) and reflection intensity. When the system performs the acquisition operation, it controls a UAV equipped with a LiDAR or oblique camera to scan and fly over and around the campsite, collecting raw data. The system converts the collected raw signals into a digital spatial point cloud model, which completely covers the fence body, the background area inside the fence, and the potential flight area outside. During the acquisition process, the system ensures that the data density meets the requirements of subsequent feature recognition, and all point cloud data are unified in the same spatial coordinate system, such as the WGS84 coordinate system or the transformed local Cartesian coordinate system.

[0067] One specific method for acquiring 3D point cloud data is through airborne LiDAR scanning technology. The system controls a drone equipped with a multi-beam LiDAR sensor, flying along a predetermined route. The sensor emits high-frequency laser pulses and receives the echoes. The distance to the target point is calculated using the Time-of-Flight (ToF) method. Combined with attitude and position data from an Inertial Measurement Unit (IMU) and a Global Positioning System (GPS / RTK), high-precision 3D point coordinates are calculated. Another method is oblique photogrammetry. The system controls a drone to capture multiple overlapping images of the camp fence and its surroundings at different heights and angles. Using the Structure of Motion (SfM) algorithm and the Multi-View Stereo Vision (MVS) algorithm, a 3D point cloud model containing texture information is generated through feature point matching, sparse reconstruction, and dense reconstruction processes. Both methods can effectively construct a digital environment, providing fundamental data support for subsequent fence recognition and path planning.

[0068] S102. Identify the surface data of the mesh fence in the three-dimensional point cloud data based on spatial topological relationships, and determine the set of point clouds located inside and above the surface of the mesh fence as environmental background data.

[0069] Spatial topological relationships refer to the positional relationships of points or sets of points in point cloud data in three-dimensional space, such as adjacency, inclusion, and intersection. Mesh fence surface data refers to the subset of point clouds extracted from a cluttered point cloud scene, representing only the physical structure of the fence. Its characteristics include a certain degree of vertical continuity and a linear or closed-loop distribution on the horizontal cross-section, while also exhibiting mesh-like perspective. Environmental background data refers to the area data that serves as the fence background from the shooting perspective. Specifically, it is defined as the set of point clouds located within the fence enclosure and above the fence height. This data typically represents the background of buildings, ground, vegetation, or sky within the camp. The system first analyzes the overall point cloud, using the spatial geometric features of the fence structure (such as verticality and height consistency) to separate the fence point cloud. Subsequently, based on the closed or semi-closed boundaries formed by the fence, the system uses ray casting or bounding box detection to determine the internal and external positional relationships of the remaining point clouds relative to the fence surface. The system merges point clouds located inside the fence area and those higher than the top of the fence, marking them as environmental background data for subsequent calculation of background texture complexity.

[0070] The system can identify mesh fence surface data using a density-based clustering algorithm combined with planar fitting. First, the system projects a 3D point cloud onto a 2D horizontal grid, calculating the height difference and density of points within each grid. Due to the fence's significant vertical height and narrow horizontal width, the system selects grid regions that match the fence's geometric characteristics. Next, the system uses the Random Sample Consensus (RANSAC) algorithm to fit the selected candidate point clouds to a vertical plane or surface, identifying the point set whose distance fit model falls within a preset threshold range as the mesh fence surface data. Alternatively, a deep learning-based semantic segmentation technique can be used. The system uses a pre-trained point cloud neural network model (such as PointNet++ or RandLA-Net), trained on a large amount of labeled fence and background point cloud data. The system inputs the acquired 3D point cloud data into the network, which automatically extracts local and global features of the points and outputs semantic labels for each point (e.g., "fence," "ground," "building"). The system directly extracts the mesh fence surface data based on these labels and divides the background data into inner and upper layers based on spatial coordinates.

[0071] S103. Calculate the normal vector variance of each local region based on environmental background data;

[0072] The system calculates the normal vector variance of each local region based on environmental background data. Specifically, it includes: searching for a set of neighborhood points within a preset sampling radius using Euclidean distance, centered on each laser point in the environmental background data, to construct a local sampling sphere; performing plane fitting on all points within the local sampling sphere using the least squares method to obtain the fitting plane and its normal vector; calculating the vertical distance of each point within the local sampling sphere relative to the fitting plane, and determining the arithmetic mean of the vertical distances as the roughness index of the local region; calculating the cosine of the angle between the point normal vector of all points within the local sampling sphere and the normal vector of the fitting plane; and generating the normal vector variance of the local region based on the weighted sum of the roughness index and the cosine of the angle.

[0073] A local region refers to a spherical or cylindrical spatial area defined by an arbitrary target point and a specific spatial distance as its radius within the environmental background data. The normal vector variance is a statistical indicator measuring the consistency of the geometric surface orientation within this local region; a smaller variance indicates a smoother surface, while a larger variance indicates a rougher surface or more complex texture. The preset sampling radius is a distance threshold used to define the size of the local region; this threshold is not fixed and can be set according to the point cloud density and environmental scale. The local sampling sphere is a geometric search space constructed based on this radius. The fitting plane is an ideal plane calculated using mathematical methods that best approximates the distribution trend of all points within the local sampling sphere. The roughness index refers to the degree of dispersion of the distance from a point to the fitting plane. The cosine value of the angle is the cosine function value of the angle between the point's normal vector and the fitting plane's normal vector, used to quantify directional deviation. The system traverses every point in the environmental background data, establishing a KD-Tree or octree index structure to accelerate neighborhood search. The system performs plane fitting on each neighborhood point set, calculates the distance deviation and normal vector angle deviation, and finally obtains the normal vector variance of the local region through weighted calculation. This value directly reflects the visual texture complexity of the background.

[0074] The specific process for calculating the normal vector variance of each local region is as follows: First, the system uses Principal Component Analysis (PCA) to process the point set within the local sampling sphere. The system calculates the covariance matrix of the point set and performs eigenvalue decomposition on the covariance matrix to obtain three eigenvalues ​​and their corresponding eigenvectors. The eigenvector corresponding to the smallest eigenvalue is the normal vector of the fitted plane. The system uses the plane equation Ax + By + Cz + D = 0 to describe the fitted plane, calculates the perpendicular distance d_i from each point (x_i, y_i, z_i) within the sampling sphere to this plane, and calculates the arithmetic mean of all d_i as the roughness index. Simultaneously, the system calculates the dot product of the estimated normal vector of each point within the sampling sphere (which can be pre-calculated using neighborhood PCA) and the normal vector of the fitted plane to obtain the cosine of the included angle. The system sets weighting coefficients and linearly weights the normalized roughness index value with the statistical measure (such as variance or mean) of the included angle cosine value to obtain the final normal vector variance. Another approach is to directly solve for the plane parameters using the least squares method. The system constructs an error sum-of-squares function and solves for the plane parameters by finding that the partial derivatives are zero. Subsequently, the system not only calculates the distance variance but also the spherical harmonic coefficients of the distribution of the normal vectors at points in the neighborhood. The energy distribution of the low-order coefficients is used to characterize the dispersion of the normal vectors, serving as a higher-level expression for the normal vector variance. This method is more accurate when dealing with complex curved surface backgrounds.

[0075] S104. Regions with normal vector variance less than a preset smoothing threshold are defined as low-texture background reference areas;

[0076] The preset smoothing threshold is a numerical boundary used to distinguish the complexity of background texture. This threshold is set according to actual shooting needs and environmental characteristics, without specific limitations. For example, it can be set to a normalized value such as 0.05 or 0.1. A normal vector variance less than this threshold means that the point cloud surface in this area is flat, with little undulation and consistent orientation. In optical images, this typically manifests as low-texture features such as the sky, a flat wall, calm water, or flat ground. The low-texture background reference area is a subset of point clouds that meets this condition. These areas are suitable as a background to complement foreground targets (fences), minimizing background clutter interference with foreground identification. The system iterates through the normal vector variance value of each point calculated in step S103 and compares it with the preset smoothing threshold. The system marks all points that meet the condition as candidate points and clusters these points into several continuous region blocks based on spatial adjacency. The system then performs area filtering on these region blocks, eliminating fragmented areas that are too small to serve as effective backgrounds. The large, smooth areas that remain are ultimately determined as the low-texture background reference area.

[0077] One implementation method for determining the low-texture background reference region is a threshold-based region growing algorithm. The system first selects points with minimal normal variance (much smaller than the threshold) as seed points and adds them to the seed queue. The system then removes seed points from the queue and checks their neighboring points. If the normal variance of a neighboring point is less than a preset smoothing threshold, it merges it into the current region and adds it to the seed queue for further growth. This process is repeated until no further expansion is possible, thus forming a connected low-texture region. Another implementation method is an adaptive thresholding segmentation technique based on histogram analysis. The system statistically analyzes the histogram of the distribution of normal variances of all background points and uses the Otsu algorithm (maximum inter-class variance method) to automatically find the optimal segmentation threshold to distinguish between "smooth" and "coarse" regions. If the automatically calculated threshold is less than a preset hard upper limit, the automatic threshold is used; otherwise, the preset smoothing threshold is used. The system performs binarization classification of the point cloud based on the determined threshold and removes noise through morphological opening operations (erosion followed by dilation), connecting broken smooth regions to obtain a high-quality low-texture background reference region.

[0078] S105. Determine the coordinates of the monitoring points to be inspected in the surface data of the mesh fence, and search for the center of the area in the low-texture background reference area where there are no obstructions between the monitoring point coordinates, and use it as the background target anchor point corresponding to the monitoring point coordinates.

[0079] The system searches for the center of an area in a low-texture background reference area where there are no obstructions between the monitoring point coordinates and the monitoring point coordinates. This area is used as the background target anchor point corresponding to the monitoring point coordinates. Specifically, this involves: generating several candidate anchor points in the low-texture background reference area; constructing a virtual cone-shaped visual channel with the monitoring point coordinates as the vertex and the candidate anchor point as the center of the base for each candidate anchor point; obtaining the side wall tilt angle of the virtual cone-shaped visual channel and filtering out a set of interference point clouds located between the monitoring point coordinates and the candidate anchor points based on the side wall tilt angle; calculating the projection distance from each point in the interference point cloud set to the central axis connecting the monitoring point coordinates and the candidate anchor points; if the interference point cloud set is empty, or the projection distance of all points in the interference point cloud set is greater than a preset safe perspective threshold, then the virtual cone-shaped visual channel is determined to be unobstructed; and selecting the candidate anchor point corresponding to the unobstructed virtual cone-shaped visual channel as the background target anchor point corresponding to the monitoring point.

[0080] Monitoring point coordinates refer to specific spatial locations on the surface of the mesh fence that require focused drone inspection. These points can be evenly distributed at fixed intervals or represent key areas suspected of having defects. Background target anchor points refer to a selected point within a low-texture background reference area, which serves as the background center in the shooting view, guiding the drone's shooting direction. The virtual cone visual channel refers to a three-dimensional geometric space constructed with the monitoring point as the vertex and candidate anchor points and their surrounding area within the background region as the base, used to simulate the camera's field of view (FOV). Obstructions refer to point cloud data located within this visual channel that are neither part of the background nor the fence itself, but rather non-background elements that block the view. The preset safe perspective threshold refers to the distance standard for determining whether the view is obstructed. The system first identifies a series of monitoring points on the fence. For each monitoring point, the system generates multiple candidate anchor points within the low-texture background reference area. For each candidate anchor point, the system constructs a virtual cone connecting the monitoring point and that anchor point. The system detects whether interfering point clouds exist within this cone. If the cone is empty inside, or if any existing point is far enough from the center axis of the view (greater than the safe perspective threshold), then the view is considered transparent. The system selects the candidate point with the most transparent view and located at the center of a low-texture area as the final background target anchor point.

[0081] The specific implementation of the system's search for background target anchor points includes the following steps: First, the system generates a set of candidate anchor points in a low-texture background reference area using a grid sampling method, setting a sampling interval (e.g., 1 meter). For a given monitoring point P_m and a candidate anchor point P_a, the system constructs a cone with its vertex at P_m and its base center at P_a. The base radius is calculated based on the camera's field of view and the background distance. The system calculates the equations of the cone's sidewalls and traverses the spatial point cloud index to filter out points located within the cone's bounding box. Using the formula for the distance from a point to a line, the system calculates the perpendicular projection distance from these points to the line segment P_m-P_a. If the projection distance of all points is greater than a preset safe perspective threshold (i.e., all points are outside the safe radius of the line of sight), then the candidate anchor point is valid. Another implementation method is to use a ray projection collision detection algorithm. The system emits multiple rays (simulating camera beams) from the monitoring point to the candidate anchor point and detects whether the rays intersect with the bounding box of the point cloud of non-background objects (such as trees or utility poles) in the environment. The system counts the proportion of rays that do not collide. If the proportion is higher than a preset visibility threshold (e.g., 95%), it is determined that there is no obstruction in that direction. The system scores all valid candidate anchor points based on criteria including the distance from the anchor point to the edge of the area (the closer to the center, the better) and the transparency of the line of sight. The highest scorer is selected as the background target anchor point.

[0082] S106. Construct a virtual line-of-sight vector that starts from the background target anchor point and points to the coordinates of the monitoring point;

[0083] The virtual line-of-sight vector is a geometric quantity with direction and length. Its starting point is defined as the background target anchor point determined in step S105, and its ending point is defined as the coordinates of the monitoring point on the fence surface. Physically, this vector represents the ideal shooting optical axis direction, i.e., the direction the camera lens should be pointing, so that the monitoring point is located at the center of the foreground, and the background target anchor point is located at the center of the background. The construction process involves algebraic operations on three-dimensional spatial vectors. The system reads the three-dimensional coordinates of the background target anchor point and the three-dimensional coordinates of the monitoring point. The system generates the original vector pointing from the anchor point to the monitoring point through coordinate subtraction. Subsequently, the system usually normalizes this vector, converting it into a unit vector to facilitate subsequent calculations of the inverse extension distance and direction control. This step establishes the "composition axis" during UAV shooting, ensuring that the "clean background - fence target - camera" are collinear.

[0084] The specific implementation method for constructing the virtual line-of-sight vector is as follows: The system uses a linear algebra library for vector operations. Let the background target anchor point position vector be the starting point and the monitoring point position vector be the ending point. The system calculates the difference vector obtained by subtracting the starting point coordinates from the ending point coordinates. Next, the system calculates the magnitude of this difference vector, i.e., the Euclidean distance between the two points. Finally, the system divides the difference vector by its magnitude to obtain the unit direction vector. This unit vector is the virtual line-of-sight vector. Another implementation method is to use a spherical coordinate system. The system calculates the azimuth and pitch angles of the monitoring point relative to the background anchor point. The system calculates these two angle values ​​using inverse trigonometric functions, constructing the line-of-sight direction in a local spherical coordinate system with the monitoring point as the origin. This method facilitates subsequent verification in conjunction with the rotation angle limitations of the UAV gimbal. If the calculated vector angle exceeds the physical pitch range of the UAV gimbal, the system can promptly provide feedback and request a reselection of the anchor point.

[0085] S107. Extend the virtual line of sight vector from the coordinates of the monitoring point to the outer normal direction of the mesh fence surface to generate a reverse optical axis;

[0086] The reverse optical axis refers to a ray that originates from the monitoring point and extends infinitely outward from the fence along the direction of the virtual line-of-sight vector. The outer normal direction of the mesh fence surface is perpendicular to the fence fitting plane and points outward from the fence (i.e., the drone's flight area). Although the virtual line-of-sight vector points from the background to the monitoring point, geometrically, the reverse optical axis is collinear with this vector and has the same direction, meaning it passes through the background and the monitoring point before heading towards the drone. The purpose of generating this axis is to find a suitable shooting position along it. The system defines this ray in three-dimensional space with the monitoring point coordinates as the origin and the direction of the virtual line-of-sight vector as the axis direction. This axis not only determines the camera's displacement path but also implicitly contains the camera's attitude information, meaning the camera's optical axis should coincide with this axis (in the opposite direction).

[0087] The system generates the reverse optical axis using parametric equations. Given the coordinates of the monitoring point and the unit direction vector calculated in step S106, the system constructs the parametric equations for the ray, which includes an extension distance parameter, whose value must be greater than zero. The system instantiates this ray object in memory for subsequent distance interception. Another implementation method utilizes a homogeneous transformation matrix. The system constructs a local coordinate system with the monitoring point as the origin and a certain axis coinciding with the virtual line-of-sight vector. The system calculates the rotation matrix and translation vector of this local coordinate system relative to the world coordinate system. The reverse optical axis is then expressed in the world coordinate system as the positive half-axis of the corresponding axis in this local coordinate system. This method facilitates subsequent alignment calculations between the UAV's body coordinate system and the shooting axis.

[0088] S108. On the reverse optical axis, select a point whose Euclidean distance from the coordinates of the monitoring point conforms to the preset imaging depth range, and use it as the optimal shooting waypoint of the monitoring point corresponding to the coordinates of the monitoring point.

[0089] The preset imaging depth of field range refers to the target distance range that the camera can clearly image. This range is determined by the camera's focal length, aperture, sensor size, and expected image resolution (i.e., ground sampling distance). This range is usually defined as a minimum distance boundary and a maximum distance boundary. The optimal shooting waypoint refers to the spatial coordinate point where the UAV hovers or passes during the shooting mission. On the inverse optical axis generated in step S107, the system calculates the Euclidean distance from each point on the axis to the monitoring point. Based on the preset imaging depth of field range, the system extracts a line segment on the axis and selects an optimal point (usually the midpoint or the point closest to the safe flight distance) from this line segment as the optimal shooting waypoint. This waypoint ensures that the monitoring point is located near the focal plane to obtain a clear image, that the background is in a low-texture area and moderately blurred (if the depth of field is properly controlled), and that the UAV maintains a safe distance from the fence.

[0090] The system determines the optimal shooting waypoint in the following ways: First, based on the image resolution and camera parameters required for the patrol task, the system calculates the ideal shooting distance in reverse. The system then verifies whether this ideal shooting distance is within the preset imaging depth of field and whether it is greater than the UAV's minimum safe flight distance. If the conditions are met, the system directly sets the extension distance parameter to the ideal shooting distance in the parametric equation of the inverse optical axis, calculating the corresponding coordinate point as the optimal shooting waypoint. Another implementation method is adaptive cropping considering environmental constraints. The system performs discrete sampling within the depth of field along the inverse optical axis. For each sampling point, the system detects whether there are obstacles in its vicinity and calculates the expected image quality score at that point. The system selects the sampling point farthest from the obstacle and with the highest image quality score as the optimal shooting waypoint.

[0091] S109. According to the spatial distribution order of each monitoring point on the surface of the mesh fence, connect the optimal shooting waypoints corresponding to each monitoring point in sequence to generate the drone patrol flight path.

[0092] The spatial distribution order of monitoring points on the mesh fence surface refers to the sequence in which the monitoring points are arranged along the perimeter of the fence or according to a specific patrol logic (such as from left to right or from top to bottom). The UAV patrol flight path refers to a series of ordered three-dimensional coordinate points during the UAV's mission, including waypoint coordinates, flight speed, hovering time, and gimbal orientation. After determining the optimal shooting waypoints for all monitoring points, the system needs to connect these discrete waypoints into a continuous, smooth, and efficient flight trajectory. The system sorts the optimal shooting waypoints according to the physical distribution order of the monitoring points and then connects these points sequentially. During the connection process, the system considers the UAV's kinematic constraints, such as maximum turning radius and maximum climb rate, to ensure the path is flyable.

[0093] The system can generate drone patrol flight paths using a path smoothing algorithm based on spline interpolation. First, the system arranges the optimal waypoints for shooting into an ordered list according to the order of the monitoring points (e.g., counter-clockwise along a fence). The system then fits these discrete waypoints using cubic B-spline curves or Bézier curves. Transition points are inserted between adjacent waypoints, allowing the drone to glide smoothly over them and complete the shooting without completely stopping to zero speed (if a dynamic shooting mode is used). Another approach is to solve a variation of the Traveling Salesman Problem. If the order of the monitoring points is not strictly defined, the system can treat all optimal waypoints as nodes in a graph, with the distance between nodes considered as weights. The system uses a genetic algorithm or ant colony algorithm to find a loop that traverses all waypoints with the shortest total path length. After determining the order, the system generates straight paths between waypoints and adds circular transition segments (Dubins curves) at turns to generate the final flight path.

[0094] In the above embodiments, by identifying the surface of the mesh fence and determining the environmental background data inside and above it, and combining the normal vector variance calculation to screen out a low-texture background reference area, suitable background target anchor points are found for each monitoring point. Based on this, a virtual line-of-sight vector is constructed and a reverse optical axis is generated, thereby determining the optimal shooting waypoint, so that the shooting angle can simultaneously include the monitoring point and the low-texture background area in the field of view. This waypoint planning method based on background reference improves the imaging quality of mesh fence inspection images and reduces the interference of background clutter on target detection. By determining the shooting position within a preset depth of field, the clarity and stability of image acquisition are improved. Connecting waypoints according to the spatial distribution order of monitoring points on the fence surface to generate a flight path improves the accuracy of automated defect identification based on UAVs.

[0095] After completing the aforementioned background-reference-based waypoint planning, to further optimize the UAV's patrol flight path and improve its practicality, this application also provides another UAV-based camp patrol route planning method. This method, while ensuring the camera's line of sight remains within a low-texture background area, optimizes the connection paths between waypoints by introducing the concept of a visual tolerance constraint domain, enabling the UAV to complete the patrol task more smoothly. The following section combines... Figure 2 Another method for planning camp patrol routes based on drones in this application embodiment is described below:

[0096] Please see Figure 2 This is another flowchart illustrating a method for planning camp patrol routes based on unmanned aerial vehicles (UAVs) in an embodiment of this application.

[0097] S201. Obtain the edge contour range of the low-texture background reference area;

[0098] The low-texture background reference area refers to the point cloud region identified in previous steps that has a smooth surface and a texture complexity below a preset threshold, such as the sky, a flat wall, or an open ground. The edge contour range refers to the boundary line or set of boundary points that defines the geometry of this region; it describes the maximum extension limit of the effective background region in three-dimensional space. When performing this step, the system aims to extract continuous closed or open boundary features from discrete background point cloud data. The system first reads a subset of point cloud data labeled "low-texture background" from memory. Since the point cloud data is irregularly distributed, the system needs to determine which points are located at the outermost layer of the point cloud clusters using geometric analysis algorithms. Obtaining the edge contour range involves more than just simple coordinate extraction; it also includes denoising and smoothing the contour to ensure that the generated boundary accurately reflects the physical shape of the background region and avoids boundary distortion caused by outliers. The system connects the identified edge points in an orderly manner to form a contour model described by polygons or spline curves. This model will serve as the base for subsequently constructing the view envelope space.

[0099] The system can acquire the edge contour range of a low-texture background reference area using the AlphaShapes (α-shape) algorithm. The system projects the 3D point cloud of the low-texture background reference area onto a 2D plane parallel to its fitting plane, or performs calculations directly in 3D space. The system sets a rolling circle radius parameter α, allowing this virtual circle to roll outside the point cloud. When α is sufficiently small, the rolling circle can penetrate deep into the point cloud; when α is moderate, the rolling circle cannot pass through the gaps inside the point cloud, and its rolling trajectory constitutes the edge contour of the point cloud. The system records all boundary points touched by the rolling circle and generates edge contour lines in the order of connection. Another implementation method is to use rasterization-based image processing technology. The system projects the background point cloud onto a 2D plane and performs rasterization processing to generate a binary mask image, where pixels with background points are set as foreground and pixels without points are set as background. Subsequently, the system uses the Canny edge detection operator or the Sobel operator to extract edges from the binary image and identify pixel-level contour chain codes. Finally, the system uses inverse projection transformation to map the contour pixel coordinates on the two-dimensional image back to three-dimensional space, thereby recovering the edge contour range in the three-dimensional environment.

[0100] S202. Construct a line-of-sight envelope space with the coordinates of the monitoring points as vertices and covering the edge contour range;

[0101] The monitoring point coordinates are the locations of the target points to be observed on the surface of the mesh fence, serving as the vertices of the view envelope space in the geometric construction. The edge contour range is the boundary of the background area determined in step S201, forming the bottom surface of the envelope space. The view envelope space is a three-dimensional geometric body in the shape of a cone or a cone-like shape. Its physical meaning is that as long as the camera is located inside this space and the lens is aimed at the monitoring point, its view background (i.e., the extension line of the field of view center) will necessarily fall within the range of the low-texture background reference area. The process of constructing this space by the system is actually establishing a geometric model of a "safe shooting area". The system reads the three-dimensional coordinates of the monitoring point and the coordinate sequence of all discrete points on the background edge contour. Through geometric calculations, the system generates rays starting from the monitoring point and passing through each edge point. These rays constitute the side edges of the envelope space. The closed or semi-closed entity enclosed by these side edges and the bottom surface of the background contour is the view envelope space. This space defines the maximum spatial range of movement that the camera can have while ensuring background purity.

[0102] The system can construct the view envelope space using a geometric sweep method. The system defines a ray originating from a monitoring point and moves its other end along the background edge contour. The trajectory of the ray forms a surface, which serves as the sidewall of the view envelope space. The system instantiates the volume enclosed by this sidewall, the background area plane, and the monitoring point as a polyhedron object. If the background contour is a convex polygon, the generated space is a pyramid; if the contour is arbitrary, a generalized pyramid is generated. Another implementation is based on an approximate construction using a convex hull. The system merges the monitoring point coordinates with all points on the background edge contour into a single point set. The system uses a fast convex hull algorithm to calculate the minimum convex hull of this point set. Although the convex hull may slightly expand the actual range (if the background contour is concave), in most engineering applications, it provides a computationally efficient approximate solution while ensuring spatial continuity. The system uses the generated convex polyhedron as the mathematical expression of the view envelope space for subsequent intersection detection.

[0103] S203. Determine the waypoint constraint plane that is the location of the optimal shooting waypoint and is perpendicular to the reverse optical axis;

[0104] The optimal shooting waypoint is a point calculated in the previous steps that meets the depth-of-field requirements from the monitoring point and lies on the ideal optical axis. The inverse optical axis is a ray pointing from the monitoring point to the optimal shooting waypoint. The waypoint constraint plane is a virtual two-dimensional plane that passes through the optimal shooting waypoint, and its normal vector is parallel to the inverse optical axis (i.e., the plane is perpendicular to the optical axis). The purpose of defining this plane is to restrict the UAV's degrees of freedom of movement, constraining it to a specific tangent. Moving on this plane results in relatively small changes in the distance between the UAV and the monitoring point, thus ensuring a relatively stable imaging distance. The system determines the mathematical equation of this plane using analytical geometry. The system obtains the coordinates of the optimal shooting waypoint and the direction vector of the inverse optical axis. Based on the point normal equation principle, the system uses the three components of the direction vector as coefficients of the plane, combined with the coordinates of the points passing through it, to establish the linear equation of the plane. This plane cuts through the three-dimensional space, and subsequent calculations will mainly be performed on this plane.

[0105] The system can determine the waypoint constraint plane using a plane construction method from linear algebra. First, the system normalizes the direction vector of the inverse optical axis. Then, using this normalized vector as the plane's normal and the optimal waypoint as a fixed point on the plane, it constructs the plane object. In computer graphics or geometry libraries, this plane is typically represented as an array of four coefficients, defining the plane's position and orientation in 3D space. The system stores these plane parameters for subsequent cross-sectional calculations with the envelope space. Alternatively, a local coordinate system can be constructed. The system uses the optimal waypoint as the origin and the inverse optical axis as the vertical axis (e.g., the Z-axis) to construct an orthogonal local coordinate system. By calculating the rotation matrix and translation vector from the world coordinate system to this local coordinate system, the system implicitly defines the waypoint constraint plane. In this local coordinate system, the constraint plane is the plane with a vertical axis coordinate of zero. This method facilitates the subsequent transformation of the 3D cross-sectional problem into a 2D planar geometry problem, simplifying computational complexity.

[0106] S204. Calculate the overlapping area between the line-of-sight envelope space and the waypoint constraint plane, and determine the overlapping area as the visual tolerance constraint domain.

[0107] The line-of-sight envelope space is a three-dimensional cone, and the waypoint constraint plane is a two-dimensional infinite plane. Their geometric intersection is a two-dimensional closed shape (usually a polygon) on the plane. The overlapping region is this two-dimensional shape, representing the maximum range of lateral or longitudinal movement the camera can make at the current shooting distance, while ensuring the line-of-sight background remains within the low-texture reference area. The visual tolerance constraint domain is the defined name of this overlapping region. When the system performs this step, it is actually calculating the cross-section of the cone and the plane. The system uses computational geometry algorithms to find the intersection points of each side edge of the line-of-sight envelope space with the waypoint constraint plane. Since the vertices (monitoring points) of the envelope space are located on one side of the plane, and the base (background outline) is located on the other side (usually), the side edges must intersect the plane. The system connects all intersection points in the adjacent order of the side edges, forming a closed polygon, which is the visual tolerance constraint domain. This region provides a "floating" margin for the UAV's path planning.

[0108] One implementation of the system for calculating the visual tolerance constraint domain is the ray-plane intersection algorithm. The system traverses all side-edge rays in the viewpoint envelope space. For each ray, the system simultaneously solves its parametric equations with the linear equations of the waypoint constraint plane. The system solves this system of equations to obtain the ray parameter values. If the intersection point is located between the monitoring point and the background, then this intersection point is a vertex of the constraint domain. After calculating all vertices, the system connects them sequentially to generate polygons. Another implementation is the projection clipping method. If the viewpoint envelope space is described by a regular geometry (such as a square pyramid), the system can transform the waypoint constraint plane into a reference plane (such as the XY plane), and then calculate the equations of the intercepts of each face of the pyramid on the reference plane. The system determines the two-dimensional region that satisfies all constraints by solving a system of linear inequalities (each face represents a half-space constraint). This method is particularly efficient when dealing with complex convex polyhedral sections defined by a large number of inequalities.

[0109] S205. Calculate the path curvature of the line connecting adjacent waypoints based on the spatial distribution order of each optimal shooting waypoint.

[0110] The spatial distribution order of optimal shooting waypoints refers to the sequence in which the UAV passes through the corresponding waypoints of each monitoring point during the patrol process. Path curvature is a physical quantity describing the degree of curvature of a curve. In discrete path points, it reflects the degree to which the UAV needs to change its flight direction when passing a certain point. The greater the curvature, the smaller the turning radius and the more rapid the flight trajectory; the smaller the curvature, the straighter the trajectory. After obtaining the optimal shooting waypoints corresponding to all monitoring points, the system treats them as the vertices of a polygonal path. The system traverses every node on this path (except for the first and last points), using the coordinates of its predecessor, current node, and next node to calculate the geometric curvature of that local road segment. The purpose of this step is to identify "sharp turns" in the path, because sharp turns not only increase the UAV's energy consumption but may also cause the gimbal camera to produce blurred images or lose targets when rotating rapidly.

[0111] One specific implementation of the system for calculating path curvature is the three-point circumcircle method (Menger curvature). For three consecutive points on the path, the system constructs a unique circle passing through these three points. The radius of this circle is called the radius of curvature, and its reciprocal is the discrete curvature at the intermediate point. The system uses the triangle area formula (such as Heron's formula) to calculate the area of ​​the triangle formed by the three points, and combines this with the lengths of the three sides to obtain the circumcircle radius through geometric relationships, thus obtaining the curvature. Another implementation method is based on an approximate calculation of the vector angle. The system calculates the vector entering the current point and the vector leaving the current point. The system calculates the angle between these two vectors. The system combines the average length of the two vector segments and uses the ratio of the angle change to the arc length to estimate the curvature. This method has low computational cost and can intuitively reflect the degree of change in direction, making it very suitable for real-time path analysis.

[0112] S206. Identify areas where the path curvature exceeds a preset threshold as turning abrupt change zones.

[0113] The preset threshold is a numerical standard used to distinguish between "smooth flight" and "sharp turns." This threshold is set based on the UAV's maneuverability parameters (such as maximum turning angular velocity and minimum turning radius). Abrupt turning zones refer to road sections with abnormally high curvature and drastic changes in direction, typically appearing at fence corners or areas where monitoring point distribution changes abruptly. The system iterates through the curvature values ​​of each waypoint calculated in step S205 and compares them to the preset threshold. If the curvature value of a point or several consecutive points exceeds the threshold, the system marks these points and the transition sections before and after them as abrupt turning zones. The purpose of identifying these zones is to perform targeted path optimization for these specific difficult road sections in subsequent steps, preventing the UAV from overshooting or losing background in these areas.

[0114] One implementation method for identifying abrupt turning zones is a threshold-based binarization segmentation method. The system establishes a Boolean state array of the same length as the waypoint sequence. It iterates through the curvature sequence; if the curvature value of a point is greater than a preset threshold, the corresponding position is marked as a valid state. Subsequently, the system performs morphological dilation on the state array, marking the adjacent points before and after the high curvature point (e.g., extending several points before and after) as valid as well, thus covering the buffer zones for entering and exiting turns. All consecutive segments with valid states are identified as abrupt turning zones. Another implementation method is cosine similarity detection based on vector dot products. The system calculates the dot product of the direction vectors of adjacent line segments on the path. If the dot product result is less than a specific value (corresponding to an angle greater than a specific angle), the vertex is directly determined as a turning point. The system records the index of this turning point and defines its local index range as the turning turning zone.

[0115] S207. Perform asymmetric preservation processing on the centrifugal side on the visual tolerance constraint domain corresponding to the monitoring point in the turning abrupt change zone to generate the corrected visual tolerance constraint domain.

[0116] For the visual tolerance constraint domain corresponding to the monitoring point in the turning abrupt change zone, asymmetric retention processing on the centrifugal side is performed to generate a corrected visual tolerance constraint domain. Specifically, this includes: determining the inside and outside directions of the turning abrupt change zone; defining the area located in the inside direction of the turning within the visual tolerance constraint domain based on the optimal shooting waypoint as the background pollution risk zone; removing the background pollution risk zone from the visual tolerance constraint domain, and retaining only the area located in the outside direction of the turning as the corrected visual tolerance constraint domain.

[0117] The inner direction of the turning abrupt change zone refers to the direction of the center of the UAV's flight path when turning (centripetal direction), while the outer direction (centrifugal direction) is the opposite direction to the center. The background contamination risk zone refers to the area located within the visual tolerance constraint domain but close to the inner side of the turn. It's called a risk zone because when a UAV makes a sharp turn, it tends to "cut the inner curve" to smooth the path. If the UAV cuts into the inner curve, its camera's viewing angle will deflect to maintain focus on the monitoring point. This deflection can easily cause the background to shift beyond the boundary of the low-texture area and into the high-texture interference area (i.e., background contamination). Asymmetric preservation processing means that the system does not uniformly shrink the constraint domain, but selectively removes the inner risk zone while retaining the outer area. The system first calculates the geometric features of the turn to determine the inner and outer sides. Then, within the constraint domain (polygon), the portion located on the inner side is marked as a risk zone and removed. The final retained area, biased towards the outer side, is the corrected visual tolerance constraint domain. This forces the UAV to take the "outer circle" when turning, which, although the path is longer, ensures that the camera's viewing angle always points towards a safe background center.

[0118] The specific implementation of the centrifugal side asymmetric retention processing by the system includes the following steps: First, the system uses vector operations to determine the turning direction. The system calculates the cross product of the entry and departure vectors. The direction of the cross product vector, combined with coordinate system rules, indicates the inside of the turn. On the waypoint constraint plane, the system draws a dividing line perpendicular to the angle bisector through the optimal shooting waypoint. This dividing line divides the visual tolerance constraint domain into an "inner half" and an "outer half". The system directly discards the polygonal portion of the "inner half", retaining only the "outer half" as the corrected constraint domain. Another implementation method is dynamic clipping based on distance weights. The system calculates the distance from each vertex in the constraint domain to the turning curvature center (instantaneous center). The system sets a distance threshold, pushing vertices closer to the center (i.e., located inside) outwards, or directly deleting these vertices and reconstructing the polygon boundary. This method allows for more precise control over the shape of the retained area, making it crescent-shaped or fan-shaped on the outside.

[0119] S208. Based on the corrected visual tolerance constraint domain corresponding to each monitoring point, curve fitting is performed on the UAV patrol flight path to generate a smooth patrol track that ensures the UAV's onboard camera line of sight is always within the low-texture background reference area when the UAV flies over each optimal shooting waypoint.

[0120] The system performs curve fitting on the UAV patrol flight path based on the visual tolerance constraint domain corresponding to each monitoring point. Specifically, it includes: connecting the edges of adjacent visual tolerance constraint domains in sequence according to the extension direction of the UAV patrol flight path to construct a virtual flight corridor in three-dimensional space; generating an initial spline curve with the optimal shooting waypoint as the initial control point; and, when the initial spline curve exceeds the spatial boundary of the virtual flight corridor, using an iterative algorithm to converge the coordinates of the control points exceeding the limit towards the central axis of the virtual flight corridor until a smooth patrol path is generated that ensures the UAV's onboard camera line of sight is always within the low-texture background reference area when the UAV flies over each optimal shooting waypoint.

[0121] The virtual flight corridor is a tubular passage formed by connecting a series of continuous spatial polygons (i.e., the corrected visual tolerance constraint domains). The initial spline curve is a preliminary smooth path obtained by directly connecting each optimal waypoint. The iterative algorithm refers to the process of gradually satisfying the constraint conditions by continuously adjusting the position of the curve control points. After obtaining a series of corrected visual tolerance constraint domains, the system arranges these two-dimensional regions in three-dimensional space according to the order of the monitoring points, forming a virtual "tunnel". The goal of the system is to generate a three-dimensional spline curve that not only passes through this tunnel (i.e., the curve passes through the corresponding constraint domain at each monitoring point) but is also as smooth as possible (small curvature change). The system first generates a basic B-spline curve that passes through all optimal waypoints. Then, the system checks whether the curve is within the corresponding constraint domain at each node. If the curve exceeds the boundary of the constraint domain at a certain point, the system calculates the deviation vector and pulls the corresponding control point towards the center or boundary of the constraint domain. After multiple iterations, the curve will completely converge inside the flight corridor. The final generated curve is the smooth patrol track. Since every point on the track is within the visual tolerance constraint domain, it ensures that the camera's line of sight always falls on the low-texture background area.

[0122] The specific implementation of curve fitting in the system can employ a constrained B-spline optimization algorithm. The system constructs an optimization objective function containing smoothing and constraint terms. The smoothing term typically consists of the integrals of the first and second derivatives (representing length and energy) of the curve; the constraint term is a penalty function that incurs a large penalty when the curve's control points are outside the constraint domain and zero when they are inside. The system uses gradient descent or quadratic programming to solve for the minimum value of this objective function, thus obtaining the optimal control point sequence. Another implementation method is a variant of the elastic band method. The system simulates the path as an elastic rubber band passing through a series of loops (constraint domain). The rubber band itself has a tension that causes it to straighten (smoothing force), while the boundaries of the loops exert a repulsive force on the rubber band (constraint force). The system simulates this physical process, allowing the path to naturally balance under the influence of these forces, ultimately forming a trajectory that is both smooth and located within the channel.

[0123] In the above embodiments, by obtaining the edge contour range of the low-texture background reference area, a line-of-sight envelope space covering this range is constructed, and the overlapping area with the waypoint constraint plane is used as the visual tolerance constraint domain. Based on this, curve fitting is performed on the flight path to ensure that the UAV keeps the onboard camera's line of sight within the low-texture background area when flying over each optimal shooting waypoint. This path optimization method considering visual tolerance improves the smoothness of the flight trajectory and enhances the stability of image acquisition during UAV patrol. By ensuring that the camera's line of sight is always aligned with the low-texture background area, the background consistency of the fence patrol image is improved, and image quality fluctuations caused by background changes during flight are reduced.

[0124] The system in the embodiments of this invention is described below from the perspective of hardware processing. Please refer to [link / reference needed]. Figure 3 This is a schematic diagram of the physical device structure of a camp patrol route planning system based on unmanned aerial vehicles (UAVs) provided in an embodiment of this application.

[0125] It should be noted that, Figure 3 The structure of the system shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.

[0126] like Figure 3 As shown, the system includes a Central Processing Unit (CPU) 301, which can perform various appropriate actions and processes based on a program stored in Read-Only Memory (ROM) 302 or a program loaded from storage portion 308 into Random Access Memory (RAM) 303, such as executing the methods described in the above embodiments. The RAM 303 also stores various programs and data required for system operation. The CPU 301, ROM 302, and RAM 303 are interconnected via a bus 304. An Input / Output (I / O) interface 305 is also connected to the bus 304.

[0127] The following components are connected to I / O interface 305: input section 306 including a camera, infrared sensor, etc.; output section 307 including a liquid crystal display (LCD) and speakers, etc.; storage section 308 including a hard disk, etc.; and communication section 309 including a network interface card such as a LAN (Local Area Network) card and a modem, etc. Communication section 309 performs communication processing via a network such as the Internet. Drive 310 is also connected to I / O interface 305 as needed. Removable media 311, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 310 as needed so that computer programs read from them can be installed into storage section 308 as needed.

[0128] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing computer programs for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 309, and / or installed from removable medium 311. When the computer program is executed by central processing unit (CPU) 301, it performs the various functions defined in the present invention.

[0129] It should be noted that the computer-readable medium shown in the embodiments of the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. The transmitted data signal can take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof.

[0130] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. Each block in a flowchart or block diagram may represent a module, segment, or portion 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 indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated 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 a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0131] In another aspect, the present invention also provides a computer-readable storage medium, which may be included in the system described in the above embodiments; or it may exist independently and not assembled into the system. The storage medium carries one or more computer programs that, when executed by a processor of a system, cause the system to implement the methods provided in the above embodiments.

[0132] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

[0133] As used in the above embodiments, depending on the context, the term "when..." can be interpreted as "if...", "after...", "in response to determining...", or "in response to detecting...". Similarly, depending on the context, the phrase "when determining..." or "if (the stated condition or event) is interpreted as "if determining...", "in response to determining...", "when (the stated condition or event) is detected", or "in response to detecting (the stated condition or event)".

[0134] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely 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 this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can 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) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state drive), etc.

[0135] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.

Claims

1. A method for planning camp patrol routes based on unmanned aerial vehicles (UAVs), characterized in that, include: Acquire three-dimensional point cloud data including the camp fence and the preset range of the camp fence; Based on spatial topological relationships, the surface data of the mesh fence in the three-dimensional point cloud data is identified, and the set of point clouds located inside and above the surface of the mesh fence is determined as the environmental background data. Calculate the normal vector variance of each local region based on the aforementioned environmental background data; The region whose normal vector variance is less than a preset smoothing threshold is defined as a low-texture background reference region; The coordinates of the monitoring point to be inspected are determined from the surface data of the mesh fence, and the center of the area in the low-texture background reference area where there are no obstructions between the coordinates of the monitoring point is searched, which is used as the background target anchor point corresponding to the coordinates of the monitoring point. Construct a virtual line-of-sight vector that starts from the background target anchor point and points to the coordinates of the monitoring point; The virtual line-of-sight vector is extended from the coordinates of the monitoring point toward the outer normal direction of the surface of the mesh fence to generate a reverse optical axis; A point on the reverse optical axis whose Euclidean distance from the coordinates of the monitoring point conforms to a preset imaging depth of field range is selected as the optimal shooting waypoint for the monitoring point corresponding to the coordinates of the monitoring point. According to the spatial distribution order of each monitoring point on the surface of the mesh fence, the optimal shooting waypoints corresponding to each monitoring point are connected in sequence to generate the drone patrol flight path.

2. The method according to claim 1, characterized in that, The calculation of the normal vector variance of each local region based on the environmental background data specifically includes: Using each laser point in the environmental background data as the center, search for a set of neighborhood points within a preset sampling radius using Euclidean distance to construct a local sampling sphere; The least squares method is used to fit a plane to all points within the local sampling sphere, resulting in the fitting plane corresponding to the local sampling sphere and the normal vector of the fitting plane. Calculate the vertical distance of each point within the local sampling sphere relative to the fitting plane, and determine the arithmetic mean of the vertical distances as the roughness index of the local region; The cosine of the angle between the normal vector of all points within the local sampling sphere and the normal vector of the fitting plane is calculated. The normal vector variance of the local region is generated based on the weighted sum of the roughness index and the cosine of the included angle.

3. The method according to claim 1, characterized in that, The step of searching for the center of the region in the low-texture background reference area where there are no obstructions between it and the coordinates of the monitoring point, and using it as the background target anchor point corresponding to the coordinates of the monitoring point, specifically includes: Several candidate anchor points are generated within the low-texture background reference area, and for each candidate anchor point, a virtual cone visual channel is constructed with the monitoring point coordinates as the vertex and the candidate anchor point as the center of the bottom surface. Obtain the side wall tilt angle of the virtual cone's visual channel, and filter out the set of interference point clouds located between the monitoring point coordinates and the candidate anchor points based on the side wall tilt angle; Calculate the projected distance from each point in the interference point cloud set to the central axis connecting the coordinates of the monitoring point and the candidate anchor point; If the interference point cloud set is empty, or the projection distance of all points in the interference point cloud set is greater than the preset safe perspective threshold, then it is determined that the virtual cone's visual channel is not obstructed. Candidate anchor points corresponding to the unobstructed visual channel of the virtual cone are selected as background target anchor points corresponding to the monitoring points.

4. The method according to claim 1, characterized in that, After generating the drone patrol flight path by sequentially connecting the optimal shooting waypoints corresponding to each monitoring point according to the spatial distribution order of each monitoring point on the surface of the mesh fence, the method further includes: Obtain the edge contour range of the low-texture background reference area; Construct a line-of-sight envelope space with the coordinates of the monitoring point as the vertex and covering the range of the edge contour; Determine the waypoint constraint plane that contains the optimal shooting waypoint and is perpendicular to the reverse optical axis; Calculate the overlapping region between the line-of-sight envelope space and the waypoint constraint plane, and determine the overlapping region as the visual tolerance constraint domain; Based on the visual tolerance constraint domain corresponding to each monitoring point, curve fitting is performed on the UAV patrol flight path to generate a smooth patrol track that ensures the UAV's onboard camera line of sight is always within the low-texture background reference area when the UAV flies over each of the optimal shooting waypoints.

5. The method according to claim 4, characterized in that, The step of curve fitting the UAV patrol flight path based on the visual tolerance constraint domain corresponding to each monitoring point specifically includes: Following the extension direction of the UAV patrol flight path, the edges of adjacent visual tolerance constraint domains are connected sequentially to construct a virtual flight corridor in three-dimensional space. Using the optimal shooting waypoint as the initial control point, generate an initial spline curve; If the initial spline curve exceeds the spatial boundary of the virtual flight corridor, the coordinates of the control points exceeding the boundary are converged towards the central axis of the virtual flight corridor through an iterative algorithm until a smooth patrol track is generated that ensures the UAV's onboard camera line of sight is always within the low-texture background reference area when the UAV flies over each of the optimal shooting waypoints.

6. The method according to claim 4, characterized in that, After determining the overlapping region as the visual tolerance constraint domain, the method further includes: Calculate the path curvature of the line connecting adjacent waypoints based on the spatial distribution order of the optimal shooting waypoints. Regions where the path curvature exceeds a preset threshold are identified as abrupt turning zones. For the visual tolerance constraint domain corresponding to the monitoring point in the turning abrupt change zone, perform asymmetric preservation processing on the centrifugal side to generate a corrected visual tolerance constraint domain.

7. The method according to claim 6, characterized in that, The asymmetric preservation process on the centrifugal side is performed on the visual tolerance constraint domain corresponding to the monitoring point within the turning abrupt change region, specifically including: Determine the inner and outer directions of the turning abrupt change zone; Within the visual tolerance constraint domain, the area located on the inside of the turn is defined as the background pollution risk zone based on the optimal shooting waypoint; The background pollution risk area is removed from the visual tolerance constraint domain, and only the area located on the outside of the turn is retained as the modified visual tolerance constraint domain.

8. A camp patrol route planning system based on unmanned aerial vehicles (UAVs), characterized in that, The system includes: One or more processors and a memory; the memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, the one or more processors invoking the computer instructions to cause the system to perform the method as described in any one of claims 1-7.

9. A computer-readable storage medium comprising instructions, characterized in that, When the instructions are executed on the system, the system performs the method as described in any one of claims 1-7.

10. A computer program product, characterized in that, When the computer program product is run on the system, the system performs the method as described in any one of claims 1-7.