Vector graphics acquisition methods, computer equipment, and computer-readable storage media

By determining the direction of obstacles in a raster map and connecting the target raster, the efficiency and accuracy issues of obtaining vector graphics of obstacles in raster maps are solved, achieving fast and accurate obstacle vectorization.

CN116862938BActive Publication Date: 2025-10-31芜湖云从科技有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310864887.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-13
Publication Date
2025-10-31
Estimated Expiration
2043-07-13

AI Technical Summary

Technical Problem

Existing technologies struggle to quickly and accurately extract vector graphics of obstacles from grid maps, impacting motion path planning for simulated objects.

Method used

By acquiring obstacle information around each grid in the grid map, the target grid and its obstacle orientation are determined, and each target grid is sequentially traversed and connected according to the preset connection direction to form a vector graphic.

Benefits of technology

It can quickly and accurately acquire vector graphics of obstacles, regardless of their shape, significantly improving acquisition efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116862938B_ABST
    Figure CN116862938B_ABST
Patent Text Reader

Abstract

This invention relates to the field of map technology, specifically providing a vector graphics acquisition method, computer device, and computer-readable storage medium, aiming to solve the problem of quickly and accurately acquiring vector graphics of obstacles from a raster map. To this end, the method provided by this invention includes: acquiring target grates representing obstacle outlines based on obstacle information surrounding each grate in the raster map, and acquiring the obstacle direction of the target grates, wherein the obstacle direction indicates the direction in which the target grates point towards the obstacle; sequentially traversing each target grate, and for each traversed target grate, acquiring the nearest target grate with the opposite obstacle direction according to a preset connection direction, and connecting them to form at least one vector graphic. Based on the above method, regardless of the number of obstacles or their shape, the vector graphics of each obstacle can be acquired quickly and accurately.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of map technology, specifically to a vector graphics acquisition method, a computer device, and a computer-readable storage medium. Background Technology

[0002] When performing motion simulations of simulated objects such as crowds, vehicles, and aircraft based on raster maps (rasterized environment maps), it is usually necessary to acquire vector graphics of obstacles (such as impassable obstacles like walls and pools) in the raster map. Then, based on the vector data of these vector graphics (such as line vector data and area vector data), a pathfinding algorithm is used to plan the motion path of the simulated object. Finally, the motion of the simulated object is controlled according to the motion path. Therefore, how to quickly and accurately acquire the vector graphics of each obstacle from the raster map has become an urgent technical problem to be solved.

[0003] Accordingly, a new technical solution is needed in this field to solve the above problems. Summary of the Invention

[0004] In order to overcome the above-mentioned defects, the present invention is proposed to provide a vector graphics acquisition method, computer device and computer-readable storage medium that solve or at least partially solve the above-mentioned technical problems.

[0005] In a first aspect, a method for acquiring vector graphics is provided, the method comprising:

[0006] Based on the obstacle information around each grid in the grid map, obtain the target grid representing the obstacle outline points and obtain the obstacle pointing of the target grid;

[0007] Iterate through each target grid cell sequentially. For each target grid cell encountered during the iteration...

[0008] According to the preset connection direction, obtain the target grid that is opposite to the direction of the obstacle and the closest to it, and connect them to form at least one vector graphic;

[0009] Wherein, the obstacle pointing indicates the direction in which the target grid points to the obstacle.

[0010] In one technical solution of the above vector graphics acquisition method, the steps of "acquiring the target grid representing the obstacle contour points and acquiring the obstacle pointing of the target grid" include:

[0011] Find the first grid cell in the grid map that is closest to the current grid cell in the first direction, where the first direction includes above, below, left and right of the current grid cell;

[0012] Determine whether there are obstacles in each first grid cell;

[0013] Based on the judgment results of each first grid cell, the target grid cell and the direction of its obstacles are obtained.

[0014] In one technical solution of the above vector graphics acquisition method, the step of "obtaining the target grid and its obstacle pointing according to the judgment results of each first grid" specifically includes:

[0015] If there is an obstacle in only one first grid cell in the first direction, then the current grid cell is the target grid cell and the obstacle points to the first direction in which the obstacle exists;

[0016] If there are obstacles in only two opposing first grid cells in the first direction, then the current grid cell is not the target grid cell and the obstacle pointing is no longer acquired;

[0017] If there are obstacles in only two adjacent first grid cells in the first direction, then the current grid cell is the target grid cell and the obstacle points to the direction formed by the intersection of these two adjacent first directions;

[0018] Among them, two opposing first directions are left and right, or top and bottom; two adjacent first directions are left and top, or left and bottom, or right and top, or right and bottom; the direction formed by the intersection of two adjacent first directions is top left, bottom left, top right, or bottom right.

[0019] In one technical solution of the above vector graphics acquisition method, the step of "acquiring the target grid and its obstacle pointing according to the judgment results of each first grid" further includes:

[0020] If obstacles exist in the first grid cells in at least three first directions, obtain the second grid cell in the grid map that is closest to the current grid cell in the second direction, where the second direction includes the upper left and / or lower left and / or upper right and / or lower right of the current grid cell;

[0021] Determine if there are obstacles in each second grid cell;

[0022] Based on the judgment results of each second grid, the target grid and the direction of its obstacles are obtained.

[0023] In one technical solution of the above vector graphics acquisition method, the method further includes obtaining the second direction of the current raster in the following manner:

[0024] Obtain every two adjacent first directions from the at least three first directions;

[0025] The direction formed by the intersection of every two adjacent first directions is taken as the second direction of the current grid.

[0026] In one technical solution of the above vector graphics acquisition method, the step of "obtaining the target grid and its obstacle pointing according to the judgment results of each second grid" specifically includes:

[0027] If there are obstacles in the second grid cells of each second direction, then the current grid cell is not the target grid cell and the obstacle pointer is no longer acquired;

[0028] If at least one second grid cell in the second direction has no obstacle, then the current grid cell is the target grid cell and the obstacle points to the second direction where the remaining obstacle exists.

[0029] In one technical solution of the above vector graphics acquisition method, the step of "connecting to the target grid that is closest to the obstacle and points in the opposite direction according to the preset connection direction" specifically includes:

[0030] Step S1: Select a target grid as the starting grid corresponding to a vector graphic, and use the starting grid as the current target grid; Step S2: According to the preset connection direction, obtain the nearest untraversed target grid with the opposite obstacle direction to the current target grid as the grid to be connected, and connect the current target grid with the grid to be connected; Step S3: Determine whether the obstacle direction and position of the grid to be connected and the starting grid are the same; if yes, stop grid connection of the vector graphic; if no, go to step S4; Step S4: Use the grid to be connected as the new current target grid, and go to step S2.

[0031] In one technical solution of the above vector graphics acquisition method, the preset connection direction is a clockwise connection direction or a counterclockwise connection direction.

[0032] In a second aspect, a computer device is provided, comprising a processor and a storage device, the storage device being adapted to store a plurality of program codes, the program codes being adapted to be loaded and executed by the processor to perform the method described in any of the above-described vector graphics acquisition methods.

[0033] In a third aspect, a computer-readable storage medium is provided, wherein a plurality of program codes are stored therein, the program codes being adapted to be loaded and run by a processor to perform the method described in any of the above-described vector graphics acquisition methods.

[0034] The above-described technical solutions of the present invention have at least one or more of the following beneficial effects:

[0035] In the technical solution of the vector graphics acquisition method provided by this invention, target grids representing obstacle outlines can be obtained based on obstacle information surrounding each grid in a grid map, and the obstacle direction of the target grids can be obtained, where the obstacle direction indicates the direction in which the target grid points to the obstacle. Each target grid is traversed sequentially, and for each traversed target grid, the nearest target grid with the opposite obstacle direction is obtained according to a preset connection direction and connected to it to form at least one vector graphics. Based on the above method, regardless of the number of obstacles or their shape, the vector graphics of each obstacle can be obtained quickly and accurately. Attached Figure Description

[0036] The disclosure of this invention will become more readily understood with reference to the accompanying drawings. It will be readily understood by those skilled in the art that these drawings are for illustrative purposes only and are not intended to limit the scope of protection of this invention. Wherein:

[0037] Figure 1 This is a schematic flowchart of the main steps of a vector graphics acquisition method according to an embodiment of the present invention;

[0038] Figure 2 This is a schematic flowchart of the main steps of a method for obtaining the pointer of a grid obstacle according to an embodiment of the present invention;

[0039] Figure 3 This indicates the direction of the grid. Figure 1 ;

[0040] Figure 4 This indicates the direction of the grid. Figure 2 ;

[0041] Figure 5 This indicates the direction of the grid. Figure 3 ;

[0042] Figure 6 This indicates the direction of the grid. Figure 3 ;

[0043] Figure 7 This indicates the direction of the grid. Figure 4 ;

[0044] Figure 8 This indicates the direction of the grid. Figure 5 ;

[0045] Figure 9 This is a schematic flowchart of the main steps of a method for connecting grids to form vector graphics according to an embodiment of the present invention;

[0046] Figure 10 This is a diagram illustrating the grid connections;

[0047] Figure 11 This is a schematic diagram of the main structure of a computer device according to an embodiment of the present invention. Detailed Implementation

[0048] Some embodiments of the present invention will now be described with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are merely illustrative of the technical principles of the present invention and are not intended to limit the scope of protection of the present invention.

[0049] In the description of this invention, "processor" can include hardware, software, or a combination of both. A processor can be a central processing unit, microprocessor, image processor, digital signal processor, or any other suitable processor. The processor has data and / or signal processing capabilities. The processor can be implemented in software, in hardware, or a combination of both. Computer-readable storage media includes any suitable medium capable of storing program code, such as magnetic disks, hard disks, optical disks, flash memory, read-only memory, random access memory, etc. The term "A and / or B" means all possible combinations of A and B, such as only A, only B, or A and B.

[0050] The following describes an embodiment of the vector graphics acquisition method provided by the present invention.

[0051] See appendix Figure 1 , Figure 1 This is a schematic flowchart illustrating the main steps of a vector graphics acquisition method according to an embodiment of the present invention. Figure 1 As shown, the vector graphics acquisition method in this embodiment of the invention mainly includes the following steps S101 to S102.

[0052] Step S101: Based on the obstacle information around each grid in the grid map, obtain the target grid representing the obstacle outline points and obtain the obstacle pointing of the target grid.

[0053] The obstacle pointing indicates the direction in which the target grid points to the obstacle.

[0054] When obtaining obstacle directions, information about obstacles surrounding the grid can be used to determine which directions obstacles exist within the grid, and then the grid's obstacle directions can be obtained based on these directions. For example, if an obstacle exists to the right of the grid, then the grid's obstacle direction is to the right.

[0055] Step S102: Traverse each target grid sequentially. For each target grid encountered, connect it to the nearest target grid that points in the opposite direction to the obstacle, according to the preset connection direction, to form at least one vector graphic. The preset connection direction can be clockwise or counterclockwise, as long as the same connection direction is used when connecting the grids.

[0056] If two target grids point to obstacles in opposite directions, it means that the obstacles each grid points to are located in the area between the two grids, and these two grids are the outline points of the obstacles within this area. However, there may be multiple different obstacles in this area, and the two target grids may not be pointing to the same obstacle. In this case, selecting the target grid with the closest location to connect them ensures that the two target grids pointing to the same obstacle are connected together.

[0057] Based on the methods described in steps S101 to S102 above, all protruding and recessed contour points in the obstacle outline can be accurately obtained. Regardless of the shape of the obstacle (e.g., straight lines, squares, etc.) or its regularity, the contour points can be accurately connected to form a vector graphic. Furthermore, since a single traversal of each grid is sufficient to obtain the target grid representing the obstacle contour points and its corresponding obstacle direction, and a further traversal of each target grid completes the connection of the target grids, forming a vector graphic, this method significantly improves the efficiency of vector graphic acquisition. Thus, regardless of the number of obstacles, the graphic vectorization of each obstacle can be completed quickly.

[0058] The following provides a further explanation of steps S101 and S102.

[0059] I. Explanation of step S101.

[0060] In some embodiments of step S101 above, it can be achieved by... Figure 2 The following steps S1011 to S1013 are shown to obtain the target grid and its obstacle orientation.

[0061] Step S1011: Obtain the first grid cell in the grid map that is closest to the current grid cell in the first direction. The first direction includes the top, bottom, left and right sides of the current grid cell.

[0062] For example, such as Figure 3 As shown, each square represents a grid cell. White grid cells indicate the absence of obstacles, while non-white grid cells indicate the presence of obstacles. The first grid cells above, below, and to the left of grid cell L are G, Q, and K, respectively. The grid cells to the right include M and NO. Since grid cell M is closest to grid cell L, grid cell M is selected as the first grid cell to the right of grid cell L.

[0063] Step S1012: Determine whether there are obstacles in each first grid cell.

[0064] Step S1013: Based on the judgment results of each first grid cell, obtain the target grid cell and its obstacle direction. Specifically, if only a portion of the first grid cells have obstacles, it indicates that the current grid cell is located near the outline of the obstacle, and the current grid cell is the target grid cell representing the outline point. Then, based on the direction in which the target grid cell has obstacles, obtain the obstacle direction of the target grid cell.

[0065] Based on the method described in steps S1011 to S1013 above, the target grid representing the outline points of obstacles and the direction of the obstacles can be accurately obtained according to the obstacle information in the four directions of the grid: above, below, left, and right.

[0066] The following provides a further explanation of step S1013.

[0067] In some implementations of step S1013 above, the target grid and its obstacle pointing can be obtained in the following three cases.

[0068] 1. First case

[0069] If there is an obstacle in only one first grid cell in the first direction, then the current grid cell is the target grid cell and this target grid cell can be used as a one-way vertex of the obstacle, and the obstacle points to the first direction in which the obstacle exists.

[0070] For example, Figure 3 In the middle grid K, there is only one obstacle in the first direction, which is to its right. Therefore, grid K is the target grid and the obstacle is pointing to the right.

[0071] 2. The second scenario

[0072] If there are obstacles in only two opposing first grid cells in the first direction, then the current grid cell is not the target grid cell and the obstacle pointing is no longer acquired.

[0073] The two opposing first directions are left and right, or above and below.

[0074] For example, such as Figure 4 As shown, each square represents a grid cell. White grid cells indicate the absence of obstacles, while non-white grid cells indicate the presence of obstacles. Grid E has obstacles only in the first grid cells DF in the two opposing first directions (left and right). Therefore, grid E is an interior point of the obstacle, not a contour point. Consequently, grid E is not the target grid cell, and its obstacle pointing is no longer acquired.

[0075] 3. The third scenario

[0076] If there are obstacles in only two adjacent first grid cells in the first direction, then the current grid cell is the target grid cell and the obstacle points to the direction formed by the intersection of these two adjacent first directions.

[0077] Two adjacent first directions can be left and top, or left and bottom, or right and top, or right and bottom. The direction formed by the intersection of two adjacent first directions is either upper left, lower left, upper right, or lower right. Specifically, the intersection of left and top forms upper left, the intersection of left and bottom forms lower left, the intersection of right and top forms upper right, and the intersection of right and bottom forms lower right.

[0078] For example, such as Figure 3 As shown, grid G ​​has obstacles only in the first grid LH of the two adjacent first directions below and to the right. Therefore, grid G ​​is the target grid, and the obstacle points to the lower right corner where the bottom and right directions intersect. Similarly, grid J is also a target grid, and the obstacle points to the lower left corner.

[0079] Furthermore, in some embodiments of step S1013 above, there may be cases where at least three first grids in the first direction have obstacles (the fourth case). In this case, the target grid and its obstacle orientation can be obtained through the following steps 11 to 13.

[0080] Step 11: Obtain the second nearest grid cell in the grid map, located in the second direction from the current grid cell. The second direction includes the upper left and / or lower left and / or upper right and / or lower right of the current grid cell. For example... Figure 3 As shown, the second nearest grid cells to the top left, bottom left, top right, and bottom right positions of grid M are GQIS, respectively.

[0081] Step 12: Determine if there are obstacles in each second grid cell.

[0082] Step 13: Based on the judgment results of each second grid, obtain the target grid and its obstacle orientation. Specifically, if only some of the second grids have obstacles, it indicates that the current grid is near the outline of the obstacle. The current grid may be the target grid representing the outline point. Then, based on the direction of the obstacle in the target grid, obtain the obstacle orientation of the target grid.

[0083] Based on the method described in steps 11 to 13 above, the target grid representing the outline points of obstacles and the direction of the obstacles can be obtained more accurately according to the obstacle information in the four directions of the grid: upper left, lower left, upper right, and lower right.

[0084] The following provides further explanation of steps 11 and 13 above.

[0085] 1. Explanation of step 11.

[0086] In some embodiments of step 11 above, the second direction of the current grid can be obtained through the following steps 111 to 112.

[0087] Step 111: If there are obstacles in the first grids of at least three first directions, obtain every two adjacent first directions among the at least three first directions.

[0088] Left, top, right, and bottom are adjacent in that order, and left and bottom are also adjacent. Assuming that there are obstacles in the first grid cells in the left, top, and right directions, then left and top are an adjacent pair of first directions, and top and right are an adjacent pair of first directions.

[0089] Step 112: Take the direction formed by the intersection of any two adjacent first directions as the second direction of the current grid. Continuing with the example in Step 111, the direction formed by the intersection of the left and top directions is the upper left, and the direction formed by the intersection of the top and right directions is the upper right. Therefore, the second direction of the current grid includes the upper left and upper right.

[0090] Based on the method described in steps 111 to 112 above, the second direction of the current grid can be accurately obtained by utilizing the first direction in which there is an obstacle in the current grid.

[0091] 2. Explanation of step 13.

[0092] In some implementations of step 11 above, the target grid and its obstacle pointing can also be obtained in the following two ways.

[0093] (1) First case

[0094] If there are obstacles in the second grid cells of each second direction, then the current grid cell is not the target grid cell and the obstacle pointer is no longer acquired.

[0095] For example, such as Figure 3 As shown, obstacles exist in the first grid cells HRLN above, below, to the left, and to the right of grid M. The second directions formed by the intersection of these four directions are upper left, upper right, lower left, and lower right, respectively. Obstacles also exist in the grid cells GIQS in these four second directions. This indicates that grid M is an interior point of an obstacle, not a contour point; therefore, grid M is not the target grid, and its obstacle orientation is no longer determined.

[0096] For example, such as Figure 5As shown, each square represents a grid cell, and each grid cell indicates the presence of an obstacle. The first grid cell BDF above, to the left, and to the right of grid cell E all contain obstacles. The second direction formed by the intersection of these three directions is the upper left and upper right, respectively. Grid cells AC in these two second directions also contain obstacles. This indicates that grid cell E is an interior point of an obstacle, not a contour point. Therefore, grid cell E is not the target grid cell, and its obstacle pointing is no longer determined.

[0097] (2) Second case

[0098] If at least one second grid cell in the second direction has no obstacle, then the current grid cell is the target grid cell and the obstacle points to the second direction where the remaining obstacle exists.

[0099] For example, such as Figure 6 As shown, each square represents a grid cell. White grid cells indicate the absence of obstacles, while non-white grid cells indicate the presence of obstacles. Grid E has obstacles above, to its left, and to its right in the first grid cell BDF. The second direction formed by the intersection of these three directions is the upper left and upper right, respectively. Only the upper left grid cell A is free of obstacles. Therefore, grid E is the target grid cell, and its obstacle points to another second direction containing obstacles, namely the upper right.

[0100] Similarly, grid K is also the target grid, with obstacles pointing to the upper left.

[0101] For example, such as Figure 7 As shown, each square represents a grid cell. White grid cells indicate the absence of obstacles, while non-white grid cells indicate the presence of obstacles. Grid E has obstacles in its top, bottom, left, and right first grid cells BHDF. The second direction formed by the intersection of these four directions is top-left, top-right, bottom-left, and bottom-right, respectively. Grid cells CGI in the top-right, bottom-left, and bottom-right directions have no obstacles. Therefore, grid E is the target grid cell, and the obstacle point is to the top-left of the remaining area containing obstacles.

[0102] Similarly, grid N is also the target grid, and the obstacle is pointed to the upper left or upper right.

[0103] Furthermore, in some embodiments of step S101 above, in order to facilitate the execution of the vector graphics acquisition method of the present invention by using a computer device to execute a computer program, the direction value of each grid can be obtained according to the obstacle situation above, below, to the left and to the right of each grid, and then the grid is determined as to be a target grid and the corresponding obstacle direction is determined according to the direction value.

[0104] Specifically, the basic direction values ​​for the left, right, top, and bottom of the grid are first set to 1, 2, 4, and 8, respectively. For each grid, it is determined whether there is an obstacle in the nearest grid (the first grid in the aforementioned embodiment) to the left, right, top, and bottom of the current grid. If there is, the corresponding basic direction value is added to the initial direction value of the current grid to obtain the final direction value of the current grid, where the initial direction value is zero.

[0105] For example, such as Figure 8 As shown, grid K has obstacles only in its rightmost first grid cell L. The base direction value for the rightmost cell is 2, therefore, the final direction value of grid K is 2. Grid G ​​has obstacles only in its rightmost and bottommost first grid cells HL. The base direction values ​​for the rightmost and bottommost cells are 2 and 8 respectively, therefore, the final direction value of grid G ​​is 10. Grid L has obstacles in its leftmost, rightmost, topmost, and bottommost first grid cells KMGQ, therefore, the final direction value of grid L is 15.

[0106] After determining the final direction value of each grid cell, the following five cases can be used to determine whether a grid cell is a target grid cell and the corresponding obstacle direction.

[0107] 1. The final direction values ​​are 1, 2, 4, and 8.

[0108] If the final direction value of the grid is 1, 2, 4, or 8, it indicates that the grid has an obstacle only in the first grid cell to the left, right, above, or below. Therefore, the current grid cell is the target grid cell, and this target grid cell can serve as a unidirectional vertex of the obstacle, with the obstacle pointing in the first direction in which the obstacle exists. This situation actually refers to the first case in step S1013 of the aforementioned embodiment.

[0109] 2. The final direction values ​​are 5, 6, 9, and 10.

[0110] If the final direction value of the grid is 5, 6, 9, or 10, it indicates that the grid has obstacles only in the first grid cells of two adjacent directions. Therefore, the current grid is the target grid and the obstacle points in the direction formed by the intersection of these two adjacent first directions. This situation actually refers to the third case in step S1013 of the aforementioned embodiment.

[0111] 3. The final direction values ​​are 3 and 12.

[0112] If the final direction value of the grid is 3 or 12, it indicates that there is an obstacle in the first grid cell in two opposite directions. Therefore, the current grid cell is not the target grid cell and the obstacle direction is no longer acquired. This situation actually refers to the second case in step S1013 of the aforementioned embodiment.

[0113] 4. The final direction values ​​are 7, 11, 13, 14, and 15.

[0114] If the final direction value of the grid is 7, 11, 13, 14, or 15, it indicates that there are obstacles in the first grid in at least three directions. In this case, it is necessary to obtain the second grid that is closest to the current grid in the second direction in the grid map, determine whether there are obstacles in each second grid, and obtain the target grid and its obstacle pointing according to the determination result of each second grid (steps 11 to 13 in the above embodiments).

[0115] This situation actually refers to the fourth situation in step S1013 of the aforementioned embodiment, namely, the situation where there are obstacles in at least three first grids in the first direction.

[0116] II. Explanation of step S102.

[0117] In some embodiments of step S102 above, it can be achieved by... Figure 9 The following steps S1021 to S1025 are shown to connect the target grids to form vector graphics.

[0118] Step S1021: Select a target raster as the starting raster corresponding to a vector graphic, and use the starting raster as the current target raster.

[0119] Specifically, a target raster can be randomly selected as the starting raster.

[0120] Step S1022: According to the preset connection direction, obtain the untraversed target grid that is closest to the obstacle pointing to the current target grid as the grid to be connected, and connect the current target grid with the grid to be connected.

[0121] Specifically, the grids can be connected in either a clockwise or counter-clockwise direction, as long as the connection direction of each target grid is consistent. In this embodiment, the first target grid traversed is the first target grid after the starting grid, not the starting grid.

[0122] The opposite directions of "above" include: below, lower left, and lower right;

[0123] The opposite directions below include: above, upper left, and upper right;

[0124] The opposite directions to the left include: right, upper right, and lower right;

[0125] The opposite directions to the right include: left, upper left, and lower left;

[0126] The opposite directions of the upper left include right, upper right, lower right, lower, and lower left;

[0127] The opposite directions to the lower left include right, upper right, lower right, upper, and upper left;

[0128] The opposite directions to the upper right include left, upper left, lower left, lower, and lower right;

[0129] The opposite directions to the lower right include left, upper left, lower left, upper, and upper right.

[0130] Step S1023: Determine whether the obstacle directions and positions of the grid to be connected and the starting grid are the same. If they are the same, it indicates that the connection has returned to the starting point, and a complete graphic has been formed. Therefore, proceed to step S1025 to stop connecting the grids of this vector graphic. Otherwise, proceed to step S1024 to continue connecting.

[0131] Step S1024: Set the grid to be connected as the new current target grid.

[0132] Step S1025: Stop raster connecting vector graphics.

[0133] Based on the methods described in steps S1021 to S1025 above, the grid connection of a vector graphic can be accurately completed. In this embodiment, the grid connection of each vector graphic in the raster map can be completed one by one using the above method, or it can be done simultaneously until all target graticules are connected, at which point the acquisition of vector graphics can be stopped.

[0134] The following is based on Figure 10 The example shown illustrates the grid connection method described above.

[0135] like Figure 10 As shown, grid IJ has no obstacles, while the remaining grids all have obstacles. Using the method described in step S101, the target grid includes ADEGMOQT. The obstacle pointing to A is the bottom right, the obstacle pointing to D is the bottom left, the obstacle pointing to E is the top right, and the obstacles pointing to G are the top left, top right, and bottom right. The obstacle pointing to MOQT is as follows... Figure 10 The details shown will not be repeated here. Figure 10 The "ignore" option indicates that the corresponding raster is not the target raster.

[0136] Set the preset connection direction to clockwise and select grid A as the starting grid.

[0137] Step 1: Set grid A as the current target grid.

[0138] Step 2: The obstacle direction of grid A is bottom right, and its opposite obstacle directions include bottom left, top left, and top right. In a clockwise direction, the nearest untraversed target grid with the opposite obstacle direction of grid A is grid D. Therefore, connect grid A and grid D, and set grid D as the new current target grid.

[0139] Step 3: The obstacle direction of grid D is bottom left, and its opposite obstacle directions include top right, bottom right, and top left. In a clockwise direction, the nearest untraversed target grid with the opposite obstacle direction of grid D is grid T. Therefore, connect grid D and grid T, and set grid T as the new current target grid.

[0140] Step 4: The obstacle direction of grid T is top left, and its opposite obstacle directions include top right, bottom right, and bottom left. In a clockwise direction, the nearest untraversed target grid with the opposite obstacle direction of grid T is grid Q. Therefore, connect grid T and grid Q, and set grid Q as the new current target grid.

[0141] Step 5: The obstacle direction of grid Q is top right, and its opposite obstacle directions include top left, bottom left, and bottom right. In a clockwise direction, the nearest untraversed target grid with the opposite obstacle direction of grid Q is grid M. Therefore, connect grid Q and grid M, and set grid M as the new current target grid.

[0142] Step 6: The obstacle direction of grid M is bottom right, and its opposite obstacle directions include top left, bottom left, and top right. In a clockwise direction, the nearest untraversed target grid with the opposite obstacle direction of grid M is grid O. Therefore, connect grid M and grid O, and set grid O as the new current target grid.

[0143] Step 7: The obstacle direction of grid O is upper right, and its opposite obstacle directions include upper left, lower left, and lower right. In a clockwise direction, the nearest untraversed target grid with the opposite obstacle direction of grid O is grid G. Therefore, connect grid O and grid G, and set grid G ​​as the new current target grid.

[0144] Step 8: The obstacles of grid G ​​point to the top left, top right, and bottom right, while the opposite obstacles point to the top right, bottom right, bottom left, and top left. Following a clockwise direction, the nearest untraversed target grid with the opposite obstacle direction to grid G ​​is grid E. Therefore, connect grid G ​​and grid E, and designate grid E as the new current target grid.

[0145] Step 9: The obstacle direction of grid E is top right, and its opposite obstacle directions include top left, bottom left, and bottom right. Following a clockwise direction, the nearest untraversed target grid with the opposite obstacle direction of grid E is grid A. Therefore, connect grid E and grid A, and simultaneously set grid A as the new current target grid. Since the current target grid has the same information (obstacle direction and position) as the starting grid, stop connecting grids.

[0146] Based on the method described in steps 1 to 9 above, grid ADTQMOGEA can be connected in a clockwise direction to form a complete vector graphic. Alternatively, grid EGOMQTDAE can be connected in a counterclockwise direction to form a complete vector graphic.

[0147] It should be noted that although the steps in the above embodiments are described in a specific order, those skilled in the art will understand that in order to achieve the effects of the present invention, different steps do not necessarily have to be executed in such an order. They can be executed simultaneously (in parallel) or in other orders. These adjusted solutions are equivalent to the technical solutions described in the present invention and therefore will also fall within the protection scope of the present invention.

[0148] Those skilled in the art will understand that all or part of the processes in the method of the above embodiment of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer-readable storage medium can include any entity or device capable of carrying the computer program code, a medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer memory, a read-only memory, a random access memory, an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc. It should be noted that the content included in the computer-readable storage medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable storage medium does not include electrical carrier signals and telecommunication signals.

[0149] Furthermore, the present invention also provides a computer device.

[0150] See appendix Figure 11 , Figure 11 This is a schematic diagram of the main structure of a computer device according to an embodiment of the present invention. Figure 11As shown, the computer device in this embodiment of the invention mainly includes a storage device and a processor. The storage device can be configured to store a program for executing the vector graphics acquisition method of the above-described method embodiments, and the processor can be configured to execute the program in the storage device. This program includes, but is not limited to, the program for executing the vector graphics acquisition method of the above-described method embodiments. For ease of explanation, only the parts related to the embodiments of the present invention are shown. For specific technical details not disclosed, please refer to the method section of the embodiments of the present invention.

[0151] In embodiments of the present invention, the computer device may be a control device comprising various electronic devices. In some possible implementations, the computer device may include multiple storage devices and multiple processors. The program executing the vector graphics acquisition method of the above method embodiments can be divided into multiple subroutines, each subroutine can be loaded and run by a processor to execute different steps of the vector graphics acquisition method of the above method embodiments. Specifically, each subroutine can be stored in different storage devices, and each processor can be configured to execute programs in one or more storage devices to jointly implement the vector graphics acquisition method of the above method embodiments, that is, each processor executes different steps of the vector graphics acquisition method of the above method embodiments to jointly implement the vector graphics acquisition method of the above method embodiments.

[0152] The aforementioned multiple processors can be processors deployed on the same device. For example, the aforementioned computer device can be a high-performance device composed of multiple processors, and the aforementioned multiple processors can be processors configured on that high-performance device. Alternatively, the aforementioned multiple processors can also be processors deployed on different devices. For example, the aforementioned computer device can be a server cluster, and the aforementioned multiple processors can be processors on different servers within the server cluster.

[0153] Furthermore, the present invention also provides a computer-readable storage medium.

[0154] In one embodiment of the computer-readable storage medium according to the present invention, the computer-readable storage medium may be configured to store a program for performing the vector graphics acquisition method of the above-described method embodiments. This program may be loaded and run by a processor to implement the vector graphics acquisition method. For ease of explanation, only the parts related to the embodiments of the present invention are shown; for specific technical details not disclosed, please refer to the method section of the embodiments of the present invention. The computer-readable storage medium may be a storage device comprising various electronic devices. Optionally, in the embodiments of the present invention, the computer-readable storage medium is a non-transitory computer-readable storage medium.

[0155] The technical solution of the present invention has been described above with reference to one embodiment shown in the accompanying drawings. However, it will be readily understood by those skilled in the art that the scope of protection of the present invention is obviously not limited to these specific embodiments. Without departing from the principles of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions resulting from such changes or substitutions will all fall within the scope of protection of the present invention.

Claims

1. A method for acquiring vector graphics, characterized in that, The method includes: Based on the obstacle information around each grid in the grid map, obtain the target grid representing the obstacle outline points and obtain the obstacle pointing of the target grid; Iterate through each target grid cell sequentially. For each target grid cell encountered during the iteration... According to the preset connection direction, obtain the target grid that is opposite to the direction of the obstacle and the closest to it, and connect them to form at least one vector graphic; Wherein, "obstacle pointing" indicates the direction in which the target grid points to the obstacle; The target grid and its obstacle orientation are obtained in the following way: Find the first grid cell in the grid map that is closest to the current grid cell in the first direction, where the first direction includes above, below, left and right of the current grid cell; If obstacles exist in the first grid cells in at least three first directions, obtain the second grid cell in the grid map that is closest to the current grid cell in the second direction, where the second direction includes the upper left and / or lower left and / or upper right and / or lower right of the current grid cell; Determine if there is an obstacle in each second grid cell; if there is an obstacle in each second grid cell in the second direction, then the current grid cell is not the target grid cell and the obstacle pointing is no longer obtained; if there is no obstacle in at least one second grid cell in the second direction, then the current grid cell is the target grid cell and the obstacle pointing is the remaining second direction with an obstacle. The second direction is obtained by: acquiring every two adjacent first directions from the at least three first directions; and taking the direction formed by the intersection of every two adjacent first directions as the second direction of the current grid. The opposite directions of "above" include "below", "lower left", and "lower right". The opposite directions of "below" include "above", "upper left", and "upper right". The opposite directions of "left" include "right", "upper right", and "lower right". The opposite directions of "right" include "left", "upper left", and "lower left". The opposite directions of "upper left" include "right", "upper right", "lower right", "below", and "lower left". The opposite directions of "lower left" include "right", "upper right", "lower right", "upper left", and "upper left". The opposite directions of "upper right" include "left", "upper left", "lower left", "below", and "lower right". The opposite directions of "lower right" include "left", "upper left", "lower left", "upper", and "upper right".

2. The vector graphics acquisition method according to claim 1, characterized in that, The method further includes obtaining the target grid and its obstacle orientation through the following means: If there is an obstacle in only one first grid cell in the first direction, then the current grid cell is the target grid cell and the obstacle points to the first direction in which the obstacle exists; If there are obstacles in only two opposing first grid cells in the first direction, then the current grid cell is not the target grid cell and the obstacle pointing is no longer acquired; If there are obstacles in only two adjacent first grid cells in the first direction, then the current grid cell is the target grid cell and the obstacle points to the direction formed by the intersection of these two adjacent first directions; Among them, two opposing first directions are left and right, or top and bottom; two adjacent first directions are left and top, or left and bottom, or right and top, or right and bottom; the direction formed by the intersection of two adjacent first directions is top left, bottom left, top right, or bottom right.

3. The vector graphics acquisition method according to claim 1, characterized in that, The step of "connecting to the nearest target grid that points in the opposite direction to its obstacle, according to the preset connection direction" specifically includes: Step S1: Select a target raster as the starting raster corresponding to a vector graphic, and use the starting raster as the current target raster; Step S2: According to the preset connection direction, obtain the untraversed target grid that is closest to the current target grid with the opposite obstacle direction as the grid to be connected, and connect the current target grid to the grid to be connected; Step S3: Determine whether the obstacle directions and positions of the grid to be connected and the starting grid are the same; if yes, stop connecting the vector graphics; if no, proceed to step S4. Step S4: Set the grid to be connected as the new current target grid and proceed to step S2.

4. The vector graphics acquisition method according to claim 1 or 3, characterized in that, The preset connection direction is either clockwise or counterclockwise.

5. A computer device comprising a processor and a storage device, said storage device being adapted to store a plurality of program codes, characterized in that, The program code is adapted to be loaded and run by the processor to perform the vector graphics acquisition method according to any one of claims 1 to 4.

6. A computer-readable storage medium storing a plurality of program codes, characterized in that, The program code is adapted to be loaded and run by a processor to perform the vector graphics acquisition method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Spatial overlap analysis method and system used in geographic information system

    CN101751449A

  • Obstacle contour acquisition method, device and equipment and computer readable storage medium

    CN114255252A