A path planning method based on geometric topology structure

CN117949003BActive Publication Date: 2026-10-09BEIJING INST OF COMP TECH & APPL
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410271255.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-11
Publication Date
2026-10-09
Estimated Expiration
2044-03-11

AI Technical Summary

Technical Problem

[0005]本发明要解决的技术问题是如何提供一种基于几何拓扑结构的路径规划方法,以解决传统算法对这种路径规划效果不理想的问题

Benefits of technology

[0016] This invention proposes a path planning method based on geometric topology. Based on the topology planning algorithm, this invention uses global processing technology to perform parallel computation. Unlike traditional heuristic algorithms, this algorithm can pre-calculate closed regions, thereby avoiding path repetition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117949003B_ABST
    Figure CN117949003B_ABST
Patent Text Reader

Abstract

The application relates to a path planning method based on geometric topology structure and belongs to the path planning field. The application carries out connected domain analysis on a road network input picture, outputs a labels matrix, carries out drawing according to the labels matrix, constructs an output matrix for inquiring connected domain categories and backgrounds, constructs a tmp matrix for inquiring connected domains, adjacent points of the connected domains and whether the adjacent points meet the connected domains and the connected domain categories when searching in up, down, left and right directions, calculates whether the background area points meet the connected domains and the connected domain categories when searching in up, down, left and right directions by inquiring the tmp matrix, carries out statistics on the background area according to the tmp matrix, marks U-shaped areas, and constructs a result1 matrix to search adjacent areas of non-passable areas. The application is based on a topology structure planning algorithm, adopts global processing technology and can be parallelized, can calculate closed areas in advance, and thus can avoid path repetition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of path planning, specifically relating to a path planning method based on geometric topology. Background Technology

[0002] Traditional pathfinding algorithms are suitable for simple obstacle situations. Search algorithms are generally divided into non-heuristic search and heuristic search. Non-heuristic search algorithms indiscriminately search in all directions, resulting in low efficiency. Heuristic search algorithms can sometimes easily get stuck in closed regions, for example... Figure 1 As shown.

[0003] Heuristic search algorithms generally require dynamic programming and are not suitable for parallel computing. Currently, located in urban roads, road networks... Figure 10 The road network is complex and contains enclosed areas, for example... Figure 1 The obstacle is a U-shape opening to the left. Ideally, the path planning effect would be... Figure 1 The left-hand side shows the effect, but based on traditional heuristic search algorithms, the planned path is selected according to the distance between the current position and the exit position. Figure 1 As can be seen from the right side, the heuristic search algorithm first enters the U-shaped area, then searches the U-shaped area to find that the path is not traversable, and finally exits the U-shaped area to find the correct path. Real-world road network maps contain many such U-shaped areas, therefore traditional algorithms are not ideal for path planning in this situation. Summary of the Invention

[0004] (a) Technical problems to be solved

[0005] The technical problem to be solved by this invention is how to provide a path planning method based on geometric topology to solve the problem that traditional algorithms do not perform well in this type of path planning.

[0006] (II) Technical Solution

[0007] To address the aforementioned technical problems, this invention proposes a path planning method based on geometric topology, which includes the following steps:

[0008] S1. Perform connected component analysis on the input image of the road network and output the labels matrix. The value of (a,b,0) in the labels matrix is ​​0, which means that the (a,b) pixel belongs to the background region. The value is i, which means that it belongs to the i-th connected component. Draw the plot based on the labels matrix.

[0009] S2. Construct the output matrix to query the connected component categories and background, and label the output matrix according to the labels matrix;

[0010] S3. Construct the tmp matrix to query connected components, adjacent points of connected components, whether adjacent points encounter connected components when searching in the up, down, left, and right directions, and the type of connected components. Mark the tmp matrix according to the output matrix.

[0011] S4. By querying the tmp matrix, calculate whether the background region points encounter connected components when searching in the up, down, left, and right directions, and the type of the first connected component encountered.

[0012] S5. Statistically analyze the background region based on the tmp matrix. When searching in the up, down, left, and right directions, the total number of times connected region i is encountered is calculated. If the number of times one of them is greater than 2, then mark the point as a U-shaped region of connected region i.

[0013] S6. Construct the result1 matrix and search for the neighboring regions of the impassable region. If the neighboring region is a connected region and is unrelated to it, then set the neighboring region as the background region.

[0014] S7. Obtain the connected regions of the background area. The entire path planning task is carried out through this region.

[0015] (III) Beneficial Effects

[0016] This invention proposes a path planning method based on geometric topology. Based on the topology planning algorithm, this invention uses global processing technology to perform parallel computation. Unlike traditional heuristic algorithms, this algorithm can pre-calculate closed regions, thereby avoiding path repetition. Attached Figure Description

[0017] Figure 1 Traditional search algorithms;

[0018] Figure 2 This is an example diagram of the binarized road network map of the present invention;

[0019] Figure 3 This is a simplified flowchart of the algorithm of the present invention;

[0020] Figure 4 Schematic diagram of connected components and U-shaped regions;

[0021] Figure 5 Compute a graph for connected components;

[0022] Figure 6 A schematic diagram of a connected component mask;

[0023] Figure 7 This is a schematic diagram of the connected component calculation results;

[0024] Figure 8 A diagram illustrating the construction of output and tmp;

[0025] Figure 9 Construct a schematic diagram of adjacent pixels in a connected component;

[0026] Figure 10 A schematic diagram for calculating adjacent pixels;

[0027] Figure 11 A schematic diagram of the U-shaped region mask construction;

[0028] Figure 12 This is a schematic diagram of the calculation results for the U-shaped region;

[0029] Figure 13 This is a diagram illustrating how the background area is separated.

[0030] Figure 14 This is a schematic diagram of the connectivity of the U-shaped region;

[0031] Figure 15 A schematic diagram of the U-shaped region processing;

[0032] Figure 16 This describes the entire path planning process of the present invention. Detailed Implementation

[0033] To make the objectives, contents, and advantages of the present invention clearer, the specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings and examples.

[0034] The path planning process first requires processing the road network map. After processing, the input image can be regarded as a binary image, with the background area as 0 and obstacles as 1.

[0035] like Figure 2 As shown in the diagram, there are multiple closed regions. As discussed earlier, heuristic algorithms are prone to getting stuck in closed regions, meaning there is only one actually passable path. Currently, high-performance parallel computing resources are abundant, and traditional heuristic algorithms, due to their serial computation, are unsuitable for parallel computing. Geometric topology-based planning algorithms can calculate paths globally and are suitable for parallel computing. The specific steps are as follows... Figure 3 As shown.

[0036] The main objective of the algorithm is to find all U-shaped regions. Here, we first define the connected components and U-shaped regions.

[0037] A connected region is an image region consisting of foreground pixels with the same pixel value and adjacent positions. Figure 4 The black area represents the background, and the green part represents a connected component.

[0038] When a pixel located within a connected region searches in the four directions of up, down, left, and right, if the foreground region is found to be the same connected region for the first time in at least three of these directions, then this pixel is located within the U-shaped region.

[0039] like Figure 4 The positions corresponding to A and B are shown in the diagram. When searching in the upper left and lower left directions, the first foreground encountered at position A is the green connected region in the diagram. Therefore, position A is not located in the U-shaped region. When searching in the upper, lower, and left directions, the first foreground encountered at position B is the green connected region in the diagram. Therefore, position B is located in the U-shaped region.

[0040] This invention provides a path planning method based on geometric topology, comprising the following steps:

[0041] S1. Perform connected component analysis on the input image of the road network and output the labels matrix. The value of (a,b,0) in the labels matrix is ​​0, which means that the (a,b) pixel belongs to the background region. The value is i, which means that it belongs to the i-th connected component. Draw the plot based on the labels matrix.

[0042] S2. Construct the output matrix to query the connected component categories and background, and label the output matrix according to the labels matrix;

[0043] S3. Construct the tmp matrix to query connected components, adjacent points of connected components, whether adjacent points encounter connected components when searching in the up, down, left, and right directions, and the type of connected components. Mark the tmp matrix according to the output matrix.

[0044] S4. By querying the tmp matrix, calculate whether the background region points encounter connected components when searching in the up, down, left, and right directions, and the type of the first connected component encountered.

[0045] S5. Statistically analyze the background region based on the tmp matrix. When searching in the up, down, left, and right directions, the total number of times connected region i is encountered is calculated. If the number of times one of them is greater than 2, then mark the point as a U-shaped region of connected region i.

[0046] S6. Construct the result1 matrix and search for the neighboring regions of the impassable region. If the neighboring region is a connected region and is unrelated to it, then set the neighboring region as the background region.

[0047] S7. Obtain the connected regions of the background area. The entire path planning task is carried out through this region.

[0048] Example 1:

[0049] S1. Perform connected component analysis on the input image of the road network and output the labels matrix. The value of (a,b,0) in the labels matrix is ​​0, which means that the (a,b) pixel belongs to the background region. The value is i, which means that it belongs to the i-th connected component. Draw the plot based on the labels matrix.

[0050] The algorithm first finds Figure 2All connected components in the code. Connectivity analysis algorithms generally call the OpenCV module, as shown in the specific code below. Figure 5 As shown, the principle is to continuously search for pixels in the adjacent regions of the foreground pixels until all adjacent pixels are background pixels, and then combine the foreground pixels that have been searched into a region.

[0051] Figure 5 This is a common code flow for calculating connected components. It mainly involves calling the OpenCV module to read the image, perform median filtering, image binarization, and dilation operations. After preparation, the `connectedComponentsWitHStats` function is used for connected component analysis. The output variable `labels` is a mask with the same width and height as the input image and only one channel. `labels` is a matrix, which is a lookup table. Let the width and height of the input image be W and H respectively, and the dimensions of `labels` be (W, H, 1), where the third parameter is 1, indicating only one channel. In the `labels` matrix (a, b, 0), a value of 0 indicates that pixels (a, b) belong to the background region, a value of 1 indicates they belong to connected component 1, and a value of 2 indicates they belong to connected component 2. Therefore, background positions are 0, and positions greater than 0 represent the corresponding connected components. The specific shape is as follows... Figure 6 As shown.

[0052] Based on the labels matrix, the graph is plotted. Pixels in region 0 are black, representing the background region; pixels in region 1 are green, representing connected component 1; and pixels in region 2 are brown, representing connected component 2. The connected components are obtained as follows: Figure 7 As shown.

[0053] from Figure 7 As can be seen, green and brown represent connected region 1 and connected region 2, respectively, while the rest is the background. Multiple U-shaped regions appear in the connected regions, and these regions need to be calculated next.

[0054] S2. Construct the output matrix to query the connected component categories and background, and label the output matrix according to the labels matrix;

[0055] First, such as Figure 8 As shown, a two-channel mask is constructed, with shapes representing the width and height of the input image, and the number of channels is 2. The corresponding output has dimensions (W, H, 2).

[0056] Based on the labels generated in the previous step, the output is labeled. The first channel labels the corresponding pixels according to the connected component number, and the second channel labels all connected components with 1, which means labeling all obstacle areas. For example, to query the information at (a,b) in the image, the value at (a,b,0) can be 0, 1, or 2, representing the black background area, green connected component 1, and brown connected component 2, respectively. The value at (a,b,1) can be 0 or 1, where 0 represents the black background area and 1 represents the green or brown connected component.

[0057] S3. Construct the tmp matrix to query connected components, adjacent points of connected components, whether adjacent points encounter connected components when searching in the up, down, left, and right directions, and the type of connected components. Mark the tmp matrix according to the output matrix.

[0058] Construct a nine-channel mask with shapes representing the width and height of the input image, and 9 channels, corresponding to tmp, with dimensions (W, H, 9).

[0059] The output is used to label tmp, which has a total of 9 channels. The ninth channel has a value of 1, indicating that the current pixel is a background point adjacent to an obstacle, and a value of 2, indicating that the current pixel is an obstacle. The remaining 8 channels represent the first foreground region encountered in the four directions (up, down, left, and right) that is either connected component 1 or connected component 2. A value of 1 indicates that connected component 1 or connected component 2 has been encountered, while 0 indicates that it has not. Figure 9 This indicates the corresponding tmp generation code. For example, at tmp matrix (a,b,8), which is the ninth channel, the values ​​can be 0, 1, or 2. 0 indicates that (a,b) is a normal point, 1 indicates that the point is adjacent to a connected component, and 2 indicates that the point is within a connected component. At tmp matrices (a,b,0), (a,b,1), (a,b,2), and (a,b,3), only 0 and 1 can be used, corresponding to the up, down, left, and right directions respectively. When 1 is used, it means that (a,b) is adjacent to a connected component, and searching in the corresponding direction will find the connected component, with the first found connected component being connected component 1. At tmp matrices (a,b,4), (a,b,5), (a,b,6), and (a,b,7), only 0 and 1 can be used, corresponding to the up, down, left, and right directions respectively. When 1 is used, it means that (a,b) is adjacent to a connected component, and searching in the corresponding direction will find the connected component, with the first found connected component being connected component 2.

[0060] Generated from tmp Figure 10 Brown and purple represent connected domain 1 and connected domain 2, respectively, and the pink area adjacent to the boundary of the connected domain represents the corresponding neighboring point.

[0061] S4. By querying the tmp matrix, calculate whether the background region points encounter connected components when searching in the up, down, left, and right directions, and the type of the first connected component encountered.

[0062] Search all pixels according to the tmp ninth channel. If the value is less than 1, it indicates that the point belongs to the background and is not adjacent to any connected components. Search all such points up, down, left, and right until the first point with a tmp ninth channel value equal to 1 is found. The code is as follows: Figure 11 As shown. For example, if the ninth channel of a point's tmp is equal to 0, then the search proceeds in the order of up, down, left, and right. First, the search moves upwards. When the ninth channel of the point's tmp is found to be equal to 1, it indicates that a boundary point has been found. The values ​​of channels 0, 1, 4, and 5 of the tmp data corresponding to this boundary point are then assigned to that point. Here, 0 and 1 indicate whether connected component 1 was found when the boundary point was searched upwards and downwards, and 4 and 5 indicate whether connected component 2 was found when the boundary point was searched upwards and downwards. If it was found, it is assigned 1; otherwise, it is assigned 0. The same operation is performed in other directions.

[0063] S5. Statistically analyze the background region based on the tmp matrix. When searching in the up, down, left, and right directions, the total number of times connected region i is encountered is calculated. If the number of times one of them is greater than 2, then mark the point as a U-shaped region of connected region i.

[0064] Based on the TMP data, statistical analysis is performed on all background region points in the vertical, horizontal, and vertical directions. For example, if the sum of channel values ​​0, 1, 2, and 3 in the TMP is greater than 2, it indicates that the point belongs to a U-shaped region in connected component 1; if the sum of channel values ​​4, 5, 6, and 7 is greater than 2, it indicates that the point belongs to a U-shaped region in connected component 2. The plot is then drawn according to this procedure. Figure 12 Red and green represent connected domain 1 and connected domain 2, while purple and blue represent U-shaped regions of connected domain 1 and connected domain 2, respectively. The background region includes four black regions that the path planning needs to traverse, but these regions are not connected and require further processing.

[0065] S6. Construct the result1 matrix and search for the neighboring regions of the impassable region. If the neighboring region is a connected region and is unrelated to it, then set the neighboring region as the background region.

[0066] The background region was separated because connected component 1 entered the U-shaped region of connected component 2. Figure 13 Regions A and B are both U-shaped connected regions. Region A's boundary intersects the background, and region B's boundary intersects connected region 1. By determining whether the boundary of each U-shaped region intersects with other connected regions, and then designating the U-shaped regions near that boundary as the background, the background region can be connected. The code for this part is as follows: Figure 14As shown, a four-channel mask is designed, named result1. The four channels correspond to connected component 1, connected component 2, the U-shaped region of connected component 1, and the U-shaped region of connected component 2, respectively. Then, pixels whose boundaries in the U-shaped region are other connected components are found using result1 and modified into background regions. The generated result is shown in the image. Figure 15 As shown.

[0067] S7. Obtain the connected regions of the background area based on the result1 matrix. The entire path planning task is carried out through this region.

[0068] Figure 15 By processing the three regions in the middle, the four background regions can be connected, and the entire path planning task can be carried out through this region.

[0069] Figure 16 The entire path planning process can be seen in the image.

[0070] This invention is based on a topology planning algorithm and uses global processing technology for parallel computation. Unlike traditional heuristic algorithms, this algorithm can pre-calculate closed regions, thereby avoiding path repetition.

[0071] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A path planning method based on geometric topology, characterized in that, The method includes the following steps: S1. Perform connected component analysis on the input image of the road network and output the labels matrix. The value of (a,b,0) in the labels matrix is ​​0, which means that the (a,b) pixel belongs to the background region. The value is i, which means that it belongs to the i-th connected component. Draw the plot based on the labels matrix. S2. Construct the output matrix to query the connected component categories and background, and label the output matrix according to the labels matrix; S3. Construct the tmp matrix to query connected components, adjacent points of connected components, whether adjacent points encounter connected components when searching in the up, down, left, and right directions, and the type of connected components. Mark the tmp matrix according to the output matrix. S4. By querying the tmp matrix, calculate whether the background region points encounter connected components when searching in the up, down, left, and right directions, and the type of the first connected component encountered. S5. Statistically analyze the background region points based on the tmp matrix. When searching in the up, down, left, and right directions, the total number of times connected region i is encountered is calculated. If the number of times any one of them is greater than 2, then mark the point as a U-shaped region of connected region i. S6. Construct the result1 matrix. By determining whether the boundary of the U-shaped region of the connected domain intersects with other connected domains, the U-shaped region near the boundary is designed as the background, and the background region is connected. S7. Obtain the connected regions of the background area. The entire path planning task is carried out through this region.

2. The path planning method based on geometric topology as described in claim 1, characterized in that, The road network input image needs to be preprocessed. After processing, the input image is a binary image with the background area as 0 and obstacles as 1.

3. The path planning method based on geometric topology as described in claim 1, characterized in that, A connected region is an image region consisting of foreground pixels with the same pixel value and adjacent positions. When a pixel located in a connected region is searched in the four directions of up, down, left, and right, if the foreground region is found to be the same connected region for the first time in at least three directions, then this pixel is located in a U-shaped region.

4. The path planning method based on geometric topology as described in any one of claims 1-3, characterized in that, Step S1 specifically includes: reading the image, performing median filtering, image binarization, and dilation operations by calling the OpenCV module. After the preparation work is completed, the connectedComponentsWitHStats function is used to perform connected component analysis. The output variable labels is a mask with the same width and height as the input image and only one channel. labels is a matrix, which is a lookup table. Let the width and height of the input image be W and H respectively, and the dimension of labels be (W,H,1), where the third parameter is 1, indicating that there is only 1 channel. The value of the labels matrix (a,b,0) is 0, which means that the (a,b) pixel belongs to the background region. The value is 1, which means that it belongs to connected component 1. The value is 2, which means that it belongs to connected component 2. The background position is 0, and the position greater than 0 represents the corresponding connected component. The graph is drawn according to the labels matrix. The pixels in the 0 area are black, which represents the background region. The pixels in the 1 area are green, which represents connected component 1. The pixels in the 2 area are brown, which represents connected component 2.

5. The path planning method based on geometric topology as described in claim 4, characterized in that, Step S2 specifically includes: constructing a two-channel mask with shapes representing the width and height of the input image, having 2 channels, and corresponding to the output with dimensions (W,H,2); Based on the labels matrix, the output matrix is ​​labeled. The first channel labels the corresponding pixels according to the connected component number, and the second channel labels all connected components with 1, which means that all obstacle areas are labeled. When querying the information at (a,b) in the image, the value at (a,b,0) in the output matrix is ​​0, 1, or 2, which represent the black background area, green connected component 1, and brown connected component 2, respectively. The value at (a,b,1) is 0 or 1, where 0 represents the black background area and 1 represents the green or brown connected component.

6. The path planning method based on geometric topology as described in claim 5, characterized in that, Step S3 specifically includes: Construct a nine-channel mask with shapes representing the width and height of the input image, and 9 channels, corresponding to tmp, with dimensions (W, H, 9). The `tmp` matrix is ​​labeled based on the `output` matrix. `tmp` has a total of 9 channels. A value of 1 in the ninth channel indicates that the current pixel is a background point immediately adjacent to an obstacle, and a value of 2 indicates that the current pixel is an obstacle. The remaining 8 channels represent the first foreground region encountered in the four directions (up, down, left, right) that is either connected component 1 or connected component 2. A value of 1 indicates an encounter with connected component 1 or 2, and 0 indicates no encounter. Specifically, at position (a, b, 8) in the `tmp` matrix, the ninth channel takes values ​​of 0, 1, and 2. 0 indicates that point (a, b) is a normal point, 1 indicates that the point is adjacent to a connected component, and 2 indicates that the point is within a connected component. At positions (a,b,0), (a,b,1), (a,b,2), and (a,b,3), the values ​​are 0 and 1, corresponding to the up, down, left, and right directions, respectively. When the value is 1, it means that point (a,b) is adjacent to a connected component, and a connected component can be found by searching in the corresponding direction. The first connected component found is connected component 1. At positions (a,b,4), (a,b,5), (a,b,6), and (a,b,7), the values ​​are 0 and 1, corresponding to the up, down, left, and right directions, respectively. When the value is 1, it means that point (a,b) is adjacent to a connected component, and a connected component can be found by searching in the corresponding direction. The first connected component found is connected component 2.

7. The path planning method based on geometric topology as described in claim 6, characterized in that, Step S4 specifically includes: searching all pixels according to the ninth channel of tmp. If the value is less than 1, it indicates that the point belongs to the background and is not adjacent to the connected component. Search all such points up, down, left, and right until the first point is found whose tmp ninth channel value is equal to 1. Wherein, if the ninth channel of tmp of a point is equal to 0, then search in the order of up, down, left, and right. First, search upwards. When it is found that the ninth channel of tmp of the point is equal to 1, it indicates that a boundary point has been found. Then, the tmp data 0, 1, 4, and 5 channel values ​​corresponding to the boundary point are assigned to the point. Here, 0 and 1 indicate whether the boundary point has been found in connected component 1 when searching upwards and downwards, and 4 and 5 indicate whether the boundary point has been found in connected component 2 when searching upwards and downwards. If it has been found, assign 1; otherwise, assign 0. The other directions are also operated in the same way.

8. The path planning method based on geometric topology as described in claim 7, characterized in that, Step S5 specifically includes: statistically analyzing all background area points in the up, down, left, and right directions according to the tmp data. In the tmp data, if the sum of the values ​​of channels 0, 1, 2, and 3 is greater than 2, it indicates that the point belongs to the U-shaped region of connected domain 1, and if the sum of the values ​​of channels 4, 5, 6, and 7 is greater than 2, it indicates that the point belongs to the U-shaped region of connected domain 2.

9. The path planning method based on geometric topology as described in claim 8, characterized in that, Step S6 specifically includes: designing a four-channel mask, which is result1. The four channels correspond to connected domain 1, connected domain 2, the U-shaped region of connected domain 1, and the U-shaped region of connected domain 2, respectively. Then, the pixels whose boundaries in the U-shaped region are other connected domains are found through result1 and modified into background regions.

Citation Information

Patent Citations

  • Path planning method of grid map

    CN112683275A

  • Path planning method, electronic equipment and computer storage medium

    CN114545922A