Labyrinth map construction and path planning algorithm under unmanned aerial vehicle perspective

By using real-time image processing from UAVs and improved algorithms, an accurate maze grid map is constructed and the path of the unmanned vehicle is planned, solving the problem of connecting UAV visual information with unmanned vehicle navigation and improving the safety and efficiency of maze exploration.

CN122237571APending Publication Date: 2026-06-19NANJING UNIV OF SCI & TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NANJING UNIV OF SCI & TECH
Filing Date
2026-03-20
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

In existing technologies, the integration of drone visual information utilization with the navigation needs of unmanned vehicles is insufficient, resulting in blurred map information for unmanned vehicles and path planning that is not adapted to the movement state of unmanned vehicles, thus increasing the risk of collisions.

Method used

The system uses real-time image processing from UAVs to generate wall mask maps, and combines edge detection, perspective transformation, and adaptive cropping to construct a maze grid map. YOLO is used to identify target types and an improved search algorithm is used to plan paths. Obstacle distance and turning penalty mechanisms are introduced, and dynamic programming algorithm is used to optimize the access order of multiple targets.

Benefits of technology

It enables timely map updates and coordinate matching, reduces collision risks, optimizes the safety and efficiency of path planning, adapts to the motion state of autonomous vehicles, and has portability and engineering applicability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122237571A_ABST
    Figure CN122237571A_ABST
Patent Text Reader

Abstract

A maze map construction and path planning algorithm from an UAV perspective belongs to the interdisciplinary field of UAV visual perception and unmanned vehicle path planning. The steps include: the UAV acquires a real-time streaming video stream of the maze and preprocesses the captured single-frame images to generate a wall mask map; edge detection, perspective transformation, and adaptive cropping are performed on the preprocessed images to construct a maze grid map containing rescue and dangerous targets; target types are identified using YOLO, and paths are planned based on an improved search algorithm; a dynamic programming algorithm is used to solve the traveling salesman problem, optimizing the access order of multiple targets and sending the path to the unmanned vehicle. Advantages: Firstly, it adopts a real-time image processing mechanism based on UAV RTSP streams, achieving timely map updates through real-time image capture and rapid preprocessing; secondly, it enhances the recognizability of wall boundaries and target areas, ensuring that map coordinates match real-world coordinates.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the interdisciplinary field of UAV visual perception and unmanned vehicle path planning, specifically involving a maze map construction and path planning algorithm from the perspective of a UAV. Background Technology

[0002] In engineering applications such as warehouse inspection, emergency rescue, and industrial sorting, maze exploration tasks often rely on mobile robots. Unmanned vehicles (UAVs) are the core execution vehicle for these tasks, requiring accurate environmental maps and path guidance adapted to their own movement patterns to navigate the maze. Unmanned aerial vehicles (UAVs), with their high-altitude, top-down perspective, can acquire global visual information about the maze, which can be used to construct environmental maps and provide data support for UAV path planning. The collaboration between these two technologies is crucial for advancing maze exploration tasks, fully leveraging the synergistic advantages of aerial and ground robots to improve operational efficiency in complex environments. However, current technology still faces challenges in bridging the gap between UAV visual information utilization and UAV navigation requirements, hindering the full realization of their respective roles in maze exploration.

[0003] In recent years, with the rapid development of drone technology, drone vision-based mapping methods have gradually become a research hotspot. Traditional drone-perspective mapping schemes utilize the drone's high-altitude view to quickly capture a global image of the maze, convert the acquired visual information into a raster map through image processing technology, and then transmit it to unmanned vehicles for path planning. However, such schemes still have the following technical problems in practical applications: On the one hand, drone image processing only reaches the simple binarization stage, without targeted optimization for the core features of the maze scene (such as passage width, wall edges, and intersection structures). This coarse-grained processing method results in incomplete extraction of key navigation information from the map, and the unmanned vehicle may misjudge drivable areas due to blurred map information; on the other hand, when planning paths for unmanned vehicles, their motion characteristics are not fully considered, and traditional... The algorithm only aims at "shortest driving path length" and does not fully consider the dynamic constraints of the autonomous vehicle in actual movement. That is, it does not set distance constraints with obstacles or stability constraints when turning. As a result, the planned path often causes the autonomous vehicle to drive close to the wall or frequently change the driving direction, increasing the risk of collision.

[0004] In view of the above, a technical solution is needed: a maze mapping technology optimized for the perspective of drones, based on an improved... The algorithm plans the trajectory for the autonomous vehicle, helping it to effectively avoid obstacles and complete the maze exploration task in an orderly manner. To this end, the applicant has made beneficial designs, and the technical solution described below arose from this background. Summary of the Invention

[0005] The purpose of this invention is to provide a maze map construction and path planning algorithm from the perspective of an unmanned aerial vehicle (UAV), which solves the problems of insufficient real-time mapping performance of UAVs, easy deviation of map coordinates, and path planning not being adapted to the movement state of the UAV when navigating in maze scenarios, and provides path planning support for the driving of UAVs in mazes.

[0006] The objective of this invention is achieved by providing a maze map construction and path planning algorithm from a drone's perspective, comprising the following steps:

[0007] Step 1: The drone acquires the real-time streaming video stream of the maze and preprocesses the captured single-frame images to generate a wall mask map;

[0008] Step 2: Perform edge detection, perspective transformation and adaptive cropping on the preprocessed image to construct a maze grid map containing rescue targets and dangerous targets;

[0009] Step 3: Identify the target type using YOLO (You Only Look Once) and based on the improved... Search algorithm for path planning;

[0010] Step four: Use dynamic programming (DP) algorithm to solve the Traveling Salesman Problem (TSP), optimize the multi-target access order and send the path to the autonomous vehicle.

[0011] In a specific embodiment of the present invention, step one further includes the following steps:

[0012] The drone is equipped with a gimbal camera to acquire real-time RTSP (Real Time Streaming Protocol) video streams of the maze scene and establish a real-time communication link with the drone.

[0013] Single frames are extracted from the continuous video stream at a preset frequency and saved to the local storage module as the data source for map construction.

[0014] The captured RGB image was then converted to the HSV color space, and an HSV threshold range was set for typical wall features in the maze scene to generate a wall mask image.

[0015] Then, horizontal and vertical rectangular structural elements are used to perform secondary opening operations on the horizontal and vertical lines respectively to remove small noise points in the mask image, retain complete wall line information, and avoid noise interfering with subsequent map construction.

[0016] In another specific embodiment of the present invention, step two further includes the following steps:

[0017] First, the preprocessed image is converted into a grayscale image. The Deriche edge detection algorithm is used to extract the edge information of the maze wall. The edge detection effect is improved by optimizing the gradient calculation method in the X and Y directions. Then, the edge information is multiplied and fused with the color mask image generated in step one to enhance the recognizability of the wall boundary and generate a preliminary maze line map.

[0018] To address the potential tilt issue in drone photography, feature pixels of the maze walls are extracted, and the four vertices of the maze are determined by combining the extreme values ​​of these pixels. A perspective transformation matrix is ​​then constructed to convert the initial maze line drawing into a front-view raster map, eliminating coordinate deviations caused by tilted perspectives. Simultaneously, an adaptive cropping algorithm is employed, gradually expanding the cropping range from the map center. The cropping stops when multiple consecutive expansions of newly added areas yield no feature pixels of the walls, preserving the areas containing the core information of the maze to reduce redundant calculations.

[0019] The cropped original image is converted to HSV space, and rectangular target regions inside the maze are extracted by HSV thresholding. A target mask map is generated to mark the locations of the targets to be visited.

[0020] In yet another specific embodiment of the present invention, step three further includes the following steps:

[0021] The YOLO target detection algorithm is used to identify the target type of the original maze image after cropping in step two. This algorithm can complete the global target detection of the image in a single forward propagation, and output the bounding box coordinates, confidence scores and type labels of all targets. Based on this, the target types in the image are distinguished, and the bounding box coordinates of the targets identified by YOLO are mapped to the corresponding grid areas in the binary grid image.

[0022] In improved In the path planning stage of the search algorithm, eight movement directions are extended to the horizontal, vertical, and diagonal directions, and horizontal, vertical, and diagonal movement costs are set. At the same time, an obstacle distance penalty mechanism based on the distance from the node to the nearest obstacle is introduced. When the distance from the node to the nearest obstacle is less than a preset safe distance threshold, the path cost of the node is incrementally penalized to guide the path away from the obstacle. A turning penalty mechanism based on the change of movement direction is also introduced. When the movement direction of a node is inconsistent with the movement direction of its parent node, the path cost of the node is incrementally penalized to reduce the frequent turning during the autonomous vehicle's driving process. This generates a path that satisfies the motion constraints of the autonomous vehicle.

[0023] In yet another specific embodiment of the present invention, step four further includes the following steps:

[0024] Include the starting point, all target points to be visited, and the exit point in the path planning scope, and construct a distance matrix between target points, where the matrix elements are the path lengths between two points planned in step four.

[0025] The Traveling Salesman Problem is solved using dynamic programming, with the goal of visiting all reachable destinations while minimizing the total path cost, and the optimal destination visiting order is generated.

[0026] The access sequence is converted into real-world coordinates that can be recognized by the autonomous vehicle and saved as a preset format file, which is then sent to the ground autonomous vehicle via a wireless communication link.

[0027] The present invention, by employing the above-described structure, has the following advantages compared to the prior art:

[0028] Firstly, a real-time image processing mechanism based on UAV RTSP streams is adopted to achieve timely map updates through real-time image capture and rapid preprocessing.

[0029] Secondly, a map generation process of feature fusion, edge detection, and perspective correction is constructed to eliminate coordinate deviations caused by the tilt of the drone's shooting perspective, enhance the recognizability of wall boundaries and target areas, and keep map coordinates consistent with real-world coordinates.

[0030] Third, through improved The algorithm introduces obstacle distance penalty and steering penalty mechanisms, combined with a danger zone pre-marking strategy, to guide the autonomous vehicle away from walls and danger zones, reduce collision risk, and reduce the impact of frequent steering on motion state;

[0031] Fourth, a dynamic programming algorithm is used to solve the traveling salesman problem, optimize the order of multi-goal visits, automatically filter reachable goals and eliminate unreachable nodes, and avoid path redundancy and ineffective exploration.

[0032] Fifth, the path instructions are stored and transmitted in a universal format, which is compatible with the existing ROS autonomous vehicle navigation framework. No large-scale modifications to the autonomous vehicle hardware or underlying control system are required, making it portable and practical for engineering applications. Attached Figure Description

[0033] Figure 1 This is a diagram of the maze scene involved in the present invention;

[0034] Figure 2 This is the overall flowchart of the algorithm involved in this invention;

[0035] Figure 3 This is a flowchart of the adaptive cropping process involved in the present invention;

[0036] Figure 4This is a diagram showing the results of target region extraction and labeling involved in this invention;

[0037] Figure 5 This is a diagram of the path search iterative algorithm involved in the present invention;

[0038] Figure 6 This is a diagram showing the maze grid map construction and path planning results of the present invention. Detailed Implementation

[0039] The specific embodiments of the present invention are described in detail below with reference to the accompanying drawings. However, the description of the embodiments is not a limitation on the technical solution. Any formal but not substantive changes made based on the concept of the present invention should be considered within the scope of protection of the present invention.

[0040] In the following description, all directional (or orientational) concepts involving up, down, left, right, front, and back refer to the position of the figure being described, and are intended to facilitate public understanding. Therefore, they should not be construed as a special limitation on the technical solution provided by this invention.

[0041] This invention relates to a maze map construction and path planning algorithm from the perspective of an unmanned aerial vehicle (UAV), specifically to a maze map construction and path planning algorithm for an unmanned vehicle from the perspective of an UAV, comprising the following steps:

[0042] Step 1: The drone acquires the Real Time Streaming Protocol (RTSP) video stream of the maze and preprocesses the captured single-frame images to generate a wall mask map;

[0043] Step 2: Perform edge detection, perspective transformation and adaptive cropping on the preprocessed image to construct a maze grid map containing rescue targets and dangerous targets;

[0044] Step 3: Identify the target type using YOLO and based on the improved... Search algorithm for path planning;

[0045] Step four: Use dynamic programming algorithm to solve the traveling salesman problem, optimize the multi-objective access order, and send the path to the autonomous vehicle.

[0046] In step one, the process of the UAV acquiring the real-time video stream of the maze and generating a wall mask map is mainly achieved through four stages: video stream reception, keyframe extraction, image preprocessing, and wall mask generation. The video stream reception stage is responsible for establishing a real-time communication link with the UAV; the keyframe extraction stage filters valid images from the continuous video stream; the image preprocessing stage highlights wall information through color space conversion and feature enhancement; and the wall mask generation stage removes noise through morphological operations and outputs a binarized result. Specifically, it includes the following four steps.

[0047] The first step is the video stream reception and initialization phase. The high-definition gimbal camera mounted on the drone captures video of the maze environment and transmits the real-time stream data to the computer via the RTSP protocol. The computer establishes a connection and enables hardware decoding through the cv2.VideoCapture interface of the OpenCV library. After the connection is established, the link validity is verified using the cap.isOpened() function. If the connection fails, a retry mechanism is triggered to ensure stable video stream reception.

[0048] The second step is the keyframe extraction stage. This stage requires extracting clear, motion-blur-free single-frame images from the continuous video stream to avoid redundant data affecting subsequent processing efficiency. The system reads frame images at fixed time intervals and filters keyframes based on sharpness and stability indicators: sharpness is determined using Laplacian variance, and the second derivative is calculated by applying the Laplacian operator to the grayscale image, with the formula:

[0049]

[0050] in For the image in pixels grayscale value at that location This represents the Laplacian response value. Calculate the variance of the Laplacian response values ​​for all pixels. ,pass The value determines the clear frame; motion blur is detected by the gradient mean of the Sobel operator, where the Sobel operator's convolution kernels in the x and y directions are respectively...

[0051]

[0052] The gradient magnitude is

[0053]

[0054] Calculate the gradient mean of all pixels ,pass The value is used to determine non-blurred frames; scene stability is verified by the ORB feature point matching rate of adjacent frames to ensure that the scene has not changed drastically. Finally, images that simultaneously meet the above conditions are selected as the processing objects.

[0055] The third step is image preprocessing and wall feature enhancement. Multi-step processing is performed on the captured keyframes to highlight wall features. First, color space conversion is performed, converting the RGB format image to HSV space using `cv2.cvtColor`. The wall color distribution characteristics in HSV space are used for separation, and an initial color mask is generated using the `cv2.inRange` function with a preset threshold range. Next, noise removal is performed using morphological opening operations. This opening operation is a combination of erosion and dilation. Erosion eliminates small noise points in the image (by "eroding" the image edges through structuring elements), while dilation restores the integrity of the main wall structure (by "expanding" the image edges through structuring elements). Specifically, horizontal and vertical rectangular structuring elements are used to perform opening operations on the mask separately, and then the results from the two directions are merged using the `cv2.bitwise_or` function to obtain a preliminary denoised wall feature map. Finally, a closing operation (dilation followed by erosion) is used to fill in the tiny holes inside the wall, ensuring the continuity of the wall area.

[0056] The fourth step is the wall mask generation stage. The enhanced feature map is binarized to output the final mask. First, a threshold is set using the `cv2.threshold` function, converting the feature map into an 8-bit single-channel binary image. Pixels larger than the threshold are designated as walls, otherwise as non-walls. To further optimize mask quality, a square-rectangular structuring element is used for dilation to enhance the connectivity of wall edges. Then, horizontal and vertical rectangular structuring elements are used to perform secondary opening operations on horizontal and vertical lines respectively, preserving the main wall structure while removing residual noise. The final wall mask is generated, where white areas represent walls and black areas represent drivable space, serving as the basis for subsequent map construction.

[0057] In step two, edge detection, perspective transformation, and adaptive cropping are performed on the preprocessed image to construct a maze grid map containing target region markers. This specifically includes the following three steps.

[0058] The first step is to convert the wall mask image generated in step one into a grayscale image. Then, the Deriche edge detection algorithm is used. This algorithm is a recursive filtering-based edge detection method that, compared to the traditional Canny algorithm, can better preserve edge continuity while suppressing noise, making it particularly suitable for edge extraction of slender structures such as maze walls. In the algorithm implementation, the grayscale image is first converted to a 32-bit floating-point format to avoid loss of computational precision, and then the filtering parameters are defined. (Attenuation coefficient, controls the smoothness of the filter) and (Oscillation frequency, controlling edge response sensitivity), by recursively calculating the gradients in the X and Y directions.

[0059] For the gradient gradient X in the X direction, iteratively calculate according to the formula and correct the boundary error through reverse iteration. The calculation formula is as follows:

[0060]

[0061] in, For a certain row of the image The gradient value in the X direction at the location; For the current line The original pixel grayscale value of the location; The attenuation coefficient is calculated for the gradient and is used to control the smoothness of the gradient response; The frequency parameters used for gradient calculation determine the frequency characteristics of the gradient response; , To calculate the coefficients iteratively, from , The formula is derived to establish the recursive calculation relationship for the gradient.

[0062] Similarly, the gradient gradient Y in the Y direction is calculated column-wise. Edge strength is calculated using the Euclidean distance formula.

[0063]

[0064] Where gradientY represents a column of the image in... The gradient value in the Y direction at the location is calculated using the same logic as the gradient gradient in the X direction, gradientX. This is the overall edge strength value of an image pixel. The value directly reflects the probability that the pixel belongs to the edge of the maze wall.

[0065] Then, the edge intensity is normalized and binarized using cv2 (set to 1 if greater than the threshold, otherwise set to 0). Finally, the binary edge map and the wall mask map are fused by pixel-level multiplication to form a preliminary maze line map containing region and contour information.

[0066] The second step is the perspective transformation and adaptive clipping stage. Extract the pixel coordinates of the white walls from the initial maze line drawing, and determine the four vertices of the maze using geometric features. Calculate the perspective transformation matrix M and the target dimensions: use Euclidean distance to calculate the distance between adjacent vertices, and take the maximum value as the target width and height; define the source vertices (four vertices) and target vertices (rectangle from the frontal view), satisfying the pixel transformation formula:

[0067]

[0068] in, These are the original pixel coordinates. These are the coordinates after perspective transformation. Finally, the perspective transformation is applied to the initial maze line drawing using the cv2.warpPerspective function to obtain a maze raster map from a frontal view.

[0069] Then, starting from the center of the map, an initial rectangle is defined, and an iterative process is performed: each time, the rectangle expands in four directions, checking if there are white wall pixels in the newly added area. If no white pixels are found after n consecutive expansions, the process stops and backtracks to the boundary; otherwise, the expansion continues. After cropping, the core area map of the maze is obtained, and the original image is simultaneously cropped to maintain coordinate consistency.

[0070] The third step is the target region extraction and labeling stage. The cropped original image is converted to HSV space, and targets are extracted using double threshold filtering. After merging the masks, an opening operation is performed. After extracting the contours, targets with suitable area and aspect ratio are selected. A filled rectangle is drawn on the all-black image to generate a target mask, which is then overlaid with the raster map and saved as the final raster map containing target labels.

[0071] In step three, the YOLO object detection algorithm is used to identify the type of object in the maze, while also based on the improved... The search algorithm plans a path that satisfies the motion constraints of the autonomous vehicle.

[0072] In the YOLO target type recognition stage, the cropped original maze image output from step two is used as the processing object. The target recognition and coordinate mapping are completed through the following process:

[0073] First, the cropped image is preprocessed to the required input size for the YOLO algorithm, and pixel values ​​are normalized to the algorithm's adaptation range, converting it into a tensor format that the model can directly process. Then, a YOLO model adapted for the maze scene is loaded, and a single forward propagation is performed on the preprocessed tensor to complete global object detection, outputting detection results containing the bounding box coordinates, confidence scores, and type labels of all candidate objects. The detection results are then filtered, retaining targets with confidence scores meeting a preset threshold to eliminate false positives, and using a non-maximum suppression algorithm to remove redundant boxes with excessive overlap, finally obtaining the bounding box information of the valid targets.

[0074] Next, based on the bounding box coordinates of the valid target, the target center pixel coordinates are calculated. Following the mapping relationship established in step two—"cropped image pixel coordinates and raster index"—the target center pixel coordinates are converted into a raster index in the binary raster image. The raster image is then updated according to the target type label: if it is an obstacle-type target, its corresponding raster and surrounding area are marked as obstacles; if it is a target to be visited, its corresponding raster is marked as a node to be visited, forming a navigation raster G containing target attribute information. nav .

[0075] The improved version Search algorithms and traditional The difference in algorithms lies in: in traditional The algorithm, which previously only supported four movement directions (horizontal and vertical), has been expanded to include eight movement directions: horizontal, vertical, and diagonal. It also introduces an obstacle distance penalty mechanism based on the distance from a node to the nearest obstacle. When the distance from a node to the nearest obstacle is less than a preset safe distance threshold, an incremental penalty is applied to the path cost of that node to guide the path away from the obstacle. Furthermore, a steering penalty mechanism based on changes in movement direction is introduced. When the movement direction of a node is inconsistent with the movement direction of its parent node, an incremental penalty is applied to the path cost of that node to reduce frequent turning during autonomous vehicle operation. Improved version The search algorithm generates a path that satisfies the motion constraints of the autonomous vehicle through the above optimizations.

[0076] Specifically, in the improved version In the path planning stage of the search algorithm, the navigation grid map G is used. nav For input, through traditional Based on the algorithm, diagonal movement direction and obstacle distance and steering penalty mechanisms are added for optimization, generating paths that satisfy the motion constraints of the autonomous vehicle. Based on the above improvements... The path cost model of the algorithm defines the nodes. (Raster Index) The total cost This is used to measure the quality of a path, and the calculation formula is:

[0077]

[0078] in, From the starting point to the current node The actual cost during lateral / vertical movement.

[0079]

[0080] When the diagonal moves,

[0081]

[0082] For the current node The Manhattan distance heuristic function to the target node is, i.e.

[0083]

[0084] in, For nodes raster coordinates, The coordinates of the target node; As a penalty for obstacle distance,

[0085]

[0086] in, The obstacle penalty coefficient. This is the safe distance threshold; The breadth-first search algorithm is used to calculate: Initialize the distance matrix to infinity, set the distance of all obstacle grids to 0 and add them to the queue; Iterate by popping nodes from the queue, traverse their adjacent nodes, update the distance and add them to the queue, until the queue is empty, and obtain the shortest grid distance from each node to the nearest obstacle; To turn punishment,

[0087]

[0088] in, This is the steering penalty coefficient. For nodes Relative to its parent node The direction of movement.

[0089] The path search iteration phase achieves expansion and filtering by defining a node set and relationship record mechanism: setting the node set to be expanded (OPEN set), the expanded node set (CLOSE set), the node predecessor relationship record, and the node actual cost record.

[0090] The iterative process proceeds as follows: The node with the lowest total cost is selected from the set of nodes to be expanded as the current node. If the current node is the target node, the path from the starting point to the target node is obtained by tracing back through the node's predecessor relationships. If the current node is already in the expanded node set, no further processing is needed. Otherwise, the current node is added to the expanded node set, and all its possible neighboring nodes are generated. For each neighboring node, it is first verified whether it is located within the grid map and is not an obstacle area; if not, it is excluded. For neighboring nodes that meet the conditions, their actual cost is calculated. If this cost is higher than the recorded actual cost, the update is abandoned; otherwise, its actual cost and predecessor relationships are updated, the total cost is calculated, and it is added to the set of nodes to be expanded. This process is repeated until the set of nodes to be expanded is empty or the target node is found.

[0091] In step four, a dynamic programming algorithm is used to solve the Traveling Salesman Problem, optimizing the visiting order of the reachable targets selected in step three. The core of this step is to find the target visiting sequence that minimizes the total path cost by visiting all reachable targets sequentially from the starting point to the exit, under the constraint of starting from the origin and reaching the exit. This process takes the set of reachable targets and path cost data output from step three as input, and achieves global optimization of the visiting order through a logical chain of "target selection - cost matrix construction - dynamic programming solution - optimal path extraction." The state definition in the dynamic programming must match the number of targets to ensure that the optimal solution is obtained within a finite computational complexity.

[0092] The reachability target screening stage, based on the path feasibility assessment results from step three, extracts the targets to be visited identified from YOLOv5, forming a reachable target set T={t1,t2,...,t...}. m} (m is the number of reachable targets). If m=0, the path instruction of "start point-exit" is directly generated; if m≥1, the relationship between the start point S, the exit E and each target needs to be further clarified, and the start point and the exit are incorporated into the path planning system as virtual nodes to form an extended node set V={S}∪ T ∪{E}, where S is the path start point and E is the maze exit.

[0093] The cost matrix construction phase builds an expanded node set based on the path costs between nodes calculated in step three. Cost matrix , where matrix elements Indicates from node To the node Total path cost (taken from the improved version of step three) The algorithm calculates f(n). The cost matrix satisfies the following properties: (The cost from a node to itself is 0); This is not necessarily true (the path may have directional differences); if the node arrive If there is no feasible path, then For special relationships in the expanded node set, their cost is directly taken from the calculation result of the corresponding path in step three.

[0094] The dynamic programming approach for solving the Traveling Salesman Problem (TSP) employs a state-compressed dynamic programming algorithm, representing the access states using binary encoding. The states are defined as follows: Where mask is a binary mask (a 1 in the k-th bit indicates the target t). k(Already visited), u is the current node (taken from T ∪ {S}), and the state value represents the minimum path cost from the starting point S to node u under the visited state corresponding to mask. The state transition equation is:

[0095]

[0096] in For the unvisited target node (i.e., the first one of the mask) (bit is 0) Indicates the first The bit is set to 1. Indicates a new access target The subsequent state. The initial condition is: for the starting point S, when... When no target is accessed, The initial values ​​for all other states are... .

[0097] The iterative calculation process proceeds in ascending order of the number of bits in the mask: first, the initial state containing only the starting point (mask=0) is processed, followed by states containing 1 target, 2 targets, and so on, up to states containing m targets. For each mask, all possible current nodes u are traversed, if... Then iterate through all unvisited targets. Update status Next node The minimum cost. After the iteration, calculate the total cost from all target nodes to exit E, i.e.:

[0098]

[0099] in This represents the mask state where all m targets have been visited.

[0100] The optimal path extraction phase determines the specific order of target visits by backtracking the state transition process of dynamic programming. It starts from the target node with the minimum total cost. Begin by tracing back the predecessor node corresponding to each state mask: for the current state (mask, u), find the node that satisfies... (Remove the access token for u) and predecessor node This process continues until the starting point S is reached. The resulting node sequence is reversed and combined with the exit point E to form the complete optimal access order P. opt =[S,t i1 ,t i2 ,...,t im[E]. Then, it is converted into real-world coordinates that can be recognized by the autonomous vehicle and saved as a preset format file, which is then sent to the ground autonomous vehicle via a wireless communication link.

[0101] To verify the effectiveness of the maze map construction and path planning algorithm proposed in this invention from a UAV perspective in a maze scenario, the following experiment was designed. The system was built in a Python environment, has a modular structure, and the UAV can communicate with the unmanned vehicle hardware module. The experiment uses... Figure 1 The maze scene shown is the experimental background and strictly follows the... Figure 2 The algorithm framework shown is implemented in conjunction with the four key steps of this invention.

[0102] Figure 2 The diagram shows the overall algorithm framework of this invention. This framework uses UAV visual data as its core and processes each step sequentially: First, it acquires a maze RTSP stream image from the UAV, and generates a wall mask image through HSV threshold filtering and morphological opening preprocessing. Then, based on the mask image, it performs Deriche edge detection, perspective transformation, viewpoint correction, and adaptive cropping to construct a grid map containing the core structure of the maze. Next, it uses the YOLO target detection algorithm to identify the target and obstacle targets in the map and marks their grid positions. Based on the marked grid map, an improved [method / approach] is employed... The algorithm plans the paths between nodes; finally, it optimizes the multi-objective access order by solving the traveling salesman problem through dynamic programming, converts the grid index of the planned path into real-world coordinates, and generates path instructions that can be executed by the autonomous vehicle.

[0103] Figure 3 The diagram shows the adaptive cropping flowchart. The initial cropping range is set from the center of the raster map. Each iteration expands by 1 pixel in each of the four directions (up, down, left, and right), while simultaneously detecting the number of white wall pixels within the newly added area using an image pixel statistics function. If no white wall pixels are found in 10 consecutive expansions, the area is considered redundant background, and the expansion stops, with the final cropping range set back to the boundaries of the previous 10 iterations. In experiments, this process effectively preserves the maze walls, the target area, and obstacle areas while removing meaningless background at map edges, thus compressing the map data volume.

[0104] Figure 4The image shows the target region extraction and labeling. The left side is the original maze image, and the right side is the cropped maze mask and the target image without type recognition. After obtaining the preprocessed image in step two, the Canny operator is used to perform edge detection on the maze mask. A dual-threshold filtering strategy is used to retain the connection regions between strong and weak edges, accurately extracting the maze wall contours. For images with perspective distortion, OpenCV's four-point perspective transformation algorithm is used to calculate the homography matrix by selecting the four corner feature points of the maze, eliminating the influence of viewpoint deviation. After adaptive cropping, the processed image is mapped to a raster map, and the target region label is synchronously mapped to raster coordinates.

[0105] Figure 5 The diagram shows an iterative path search algorithm, which presents an improved version. The core iterative logic of the algorithm is as follows: First, initialize the set of nodes to be expanded, sorting them in ascending order of total cost. The initial set includes the starting point, the set of expanded nodes, records of node predecessor relationships, and records of actual node costs. Then, select the node with the minimum total cost from the set of nodes to be expanded as the current node. If the current node is the target node, generate a path by backtracking through predecessor relationships. If the current node is not in the set of expanded nodes, add it to the set, generate neighboring nodes in eight directions, and verify their grid range and non-obstacle attributes. For valid neighboring nodes, calculate the trial cost and update the optimal cost and predecessor relationships, then add them to the set of nodes to be expanded. This algorithm, by introducing obstacle distance penalties and turning penalties, can guide the path away from obstacles, reduce the number of turns, and increase the safety of autonomous vehicles.

[0106] Figure 6 The image shows the results of maze grid map construction and path planning. Black areas indicate obstacles, white areas indicate drivable paths, red triangular areas mark rescue targets, and yellow solid lines represent the optimal path for multi-target access. In the experiment, this path, after coordinate linear interpolation transformation, generates path instructions which are sent to the unmanned vehicle. The unmanned vehicle can then follow the instructions to complete the traversal of the rescue targets.

[0107] This embodiment verifies the effectiveness of the algorithm in map building and path planning from a drone's perspective through verification testing in a maze scenario: the algorithm can quickly complete map building and path planning tasks, and can also quickly replan the path when faced with obstacles in the scene. The deployment process requires no manual intervention and is suitable for maze scenarios such as warehouse inspection and emergency rescue.

[0108] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A maze map construction and path planning algorithm from the perspective of an unmanned aerial vehicle (UAV), characterized in that, Includes the following steps: Step 1: The drone acquires the real-time streaming video stream of the maze and preprocesses the captured single-frame images to generate a wall mask map; Step 2: Perform edge detection, perspective transformation and adaptive cropping on the preprocessed image to construct a maze grid map containing rescue targets and dangerous targets; Step 3: Identify the target type using YOLO and based on the improved... Search algorithm for path planning; Step four: Use dynamic programming algorithm to solve the traveling salesman problem, optimize the multi-objective access order, and send the path to the autonomous vehicle.

2. The algorithm for maze map construction and path planning from a UAV perspective according to claim 1, characterized in that, Step one, as described above, includes the following steps: The drone is equipped with a gimbal camera to acquire real-time RTSP video streams of the maze scene and establish a real-time communication link with the drone. Single frames are extracted from the continuous video stream at a preset frequency and saved to the local storage module as the data source for map construction. The captured RGB image was then converted to the HSV color space, and an HSV threshold range was set for typical wall features in the maze scene to generate a wall mask image. Then, horizontal and vertical rectangular structural elements are used to perform secondary opening operations on the horizontal and vertical lines respectively to remove small noise points in the mask image, retain complete wall line information, and avoid noise interfering with subsequent map construction.

3. The algorithm for maze map construction and path planning from a UAV perspective according to claim 1, characterized in that, Step two further includes the following steps: First, the preprocessed image is converted into a grayscale image. The Deriche edge detection algorithm is used to extract the edge information of the maze wall. The edge detection effect is improved by optimizing the gradient calculation method in the X and Y directions. Then, the edge information is multiplied and fused with the color mask image generated in step one to enhance the recognizability of the wall boundary and generate a preliminary maze line map. To address the potential tilt issue in drone photography, feature pixels of the maze walls are extracted, and the four vertices of the maze are determined by combining the extreme values ​​of these pixels. A perspective transformation matrix is ​​then constructed to convert the initial maze line drawing into a front-view raster map, eliminating coordinate deviations caused by tilted perspectives. Simultaneously, an adaptive cropping algorithm is employed, gradually expanding the cropping range from the map center. The cropping stops when multiple consecutive expansions of newly added areas yield no feature pixels of the walls, preserving the areas containing the core information of the maze to reduce redundant calculations. The cropped original image is converted to HSV space, and rectangular target regions inside the maze are extracted by HSV thresholding. A target mask map is generated to mark the locations of the targets to be visited.

4. The algorithm for maze map construction and path planning from a UAV perspective according to claim 1, characterized in that, Step three further includes the following steps: The YOLO target detection algorithm is used to identify the target type of the original maze image after cropping in step two. This algorithm can complete the global target detection of the image in a single forward propagation, and output the bounding box coordinates, confidence scores and type labels of all targets. Based on this, the target types in the image are distinguished, and the bounding box coordinates of the targets identified by YOLO are mapped to the corresponding grid areas in the binary grid image. In improved In the path planning stage of the search algorithm, eight movement directions are extended to the horizontal, vertical, and diagonal directions, and horizontal, vertical, and diagonal movement costs are set. At the same time, an obstacle distance penalty mechanism based on the distance from the node to the nearest obstacle is introduced. When the distance from the node to the nearest obstacle is less than a preset safe distance threshold, the path cost of the node is incrementally penalized to guide the path away from the obstacle. A turning penalty mechanism based on the change of movement direction is also introduced. When the movement direction of a node is inconsistent with the movement direction of its parent node, the path cost of the node is incrementally penalized to reduce the frequent turning during the autonomous vehicle's driving process. This generates a path that satisfies the motion constraints of the autonomous vehicle.

5. The algorithm for maze map construction and path planning from the perspective of an unmanned aerial vehicle (UAV) according to claim 1, characterized in that, Step four includes the following steps: Include the starting point, all target points to be visited, and the exit point in the path planning scope, and construct a distance matrix between target points, where the matrix elements are the path lengths between two points planned in step four. The Traveling Salesman Problem is solved using dynamic programming, with the goal of visiting all reachable destinations while minimizing the total path cost, and the optimal destination visiting order is generated. The access sequence is converted into real-world coordinates that can be recognized by the autonomous vehicle and saved as a preset format file, which is then sent to the ground autonomous vehicle via a wireless communication link.