Methods, apparatus, equipment, and computer storage media for calculating the principal orientation of raster maps
By identifying candidate directions in the raster map and counting the number of effectively occupied raster cells, the problem of the accuracy of straight line fitting being affected by parameters is solved, and more accurate calculation of the main direction of the raster map is achieved.
Patent Information
- Application Number
- CN202411825391.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-11
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2044-12-11
AI Technical Summary
In existing technologies for orientation correction of raster maps, the accuracy of straight line fitting is greatly affected by parameters, and in some scenarios, it is impossible to fit an ideal straight line, resulting in poor correction effect.
By determining several candidate map directions based on the current map direction, rotating the raster map to obtain the number of effectively occupied grid cells, and using the maximum number of effectively occupied grid cells to determine the main direction, the extraction and fitting of straight lines are avoided.
It improves the accuracy of calculating the main direction of raster maps, can handle scenarios where straight line extraction fails, simplifies parameter settings, and improves calculation accuracy.
Smart Images

Figure CN119963629B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of map positioning technology, and in particular to a method for calculating the main direction of a raster map, a device for calculating the main direction of a raster map, a computer storage medium for calculating the main direction of a raster map. Background Technology
[0002] Grid maps represent the environment using squares of a certain size and their occupancy, primarily used in 2D navigation planning for robots. In real-world environments, a primary direction is manually determined based on the scene; this direction typically refers to the direction of a long line segment or a majority of shorter line segments, such as the direction of a building or street. In some technological applications, it's necessary to find the primary direction of the grid map and place the map parallel to the X or Y axis along this direction. This improves map aesthetics (reducing jagged edges) and the rationality of task planning; this technique can be called map orientation correction technology.
[0003] However, current map orientation correction technology requires straight line fitting extraction from point cloud data. Because straight line fitting is affected by many parameters, the fitting accuracy is greatly affected by the parameters, and in some scenarios, it is impossible to fit an ideal straight line. Summary of the Invention
[0004] To address the aforementioned technical problems, this application proposes a method for calculating the main direction of a raster map, a device for calculating the main direction of a raster map, a raster map main direction calculation equipment, and a computer storage medium.
[0005] To address the aforementioned technical problems, this application proposes a method for calculating the main direction of a raster map, the method comprising:
[0006] Based on the current map orientation, determine several candidate map orientations;
[0007] Rotate the current grid map according to the candidate map direction to obtain the candidate grid map corresponding to each candidate map direction;
[0008] Obtain the number of effectively occupied grid cells for each candidate grid map;
[0009] The main direction of the grid map is determined by using the candidate map direction corresponding to the maximum number of effectively occupied grid cells and the current map direction.
[0010] The step of rotating the current grid map according to the direction of the candidate map includes:
[0011] Obtain the center point of the current raster map;
[0012] Rotate the current grid map according to the direction of the candidate map, using the center point of the map as the rotation center.
[0013] The step of obtaining the number of effectively occupied grid cells for each candidate grid map includes:
[0014] Count the number of effectively occupied rows of the candidate raster map row by row;
[0015] Count the number of effectively occupied columns of the candidate raster map column by column;
[0016] The number of effectively occupied grid cells is determined based on the number of effectively occupied row grid cells and the number of effectively occupied column grid cells.
[0017] The step of counting the number of valid occupied rows of the candidate raster map row by row includes:
[0018] The consecutively occupied rows of the candidate raster map are counted row by row;
[0019] Count the number of consecutive occupied rows in all rows to obtain the number of valid occupied rows in the candidate raster map.
[0020] The step of counting consecutively occupied rows of the candidate raster map row by row includes:
[0021] Obtain the number of consecutively occupied grid cells in the candidate grid map row by row;
[0022] A continuously occupied grid cell with a number of consecutively occupied grid cells greater than or equal to a preset threshold number is defined as a continuously occupied row grid cell.
[0023] The step of determining consecutively occupied grid cells with a number of consecutively occupied grid cells greater than or equal to a preset threshold as consecutively occupied row grid cells includes:
[0024] Obtain consecutively occupied grid cells whose number is greater than or equal to a preset threshold.
[0025] In response to the fact that the number of non-occupied grids between the continuously occupied grid and other occupied grids in the same row is less than a preset grid threshold, the continuously occupied grid is determined as the continuously occupied row grid.
[0026] The step of counting consecutively occupied rows of the candidate raster map row by row includes:
[0027] Obtain several rows of raster regions of the candidate raster map line by line;
[0028] Determine whether the ratio of occupied row grids to non-occupied row grids in the row grid region is greater than or equal to a preset ratio threshold.
[0029] If so, the occupying row grid in the row grid region is determined as the continuously occupying row grid.
[0030] To address the aforementioned technical problems, this application also proposes a raster map main direction calculation device, which includes: a candidate module, a rotation module, a calculation module, and a determination module; wherein,
[0031] The candidate module is used to determine several candidate map directions based on the current map direction;
[0032] The rotation module is used to rotate the current grid map according to the candidate map direction to obtain the candidate grid map corresponding to each candidate map direction.
[0033] The calculation module is used to obtain the number of effectively occupied grid cells for each candidate grid map;
[0034] The determining module is used to determine the main direction of the grid map by using the candidate map direction corresponding to the maximum number of effectively occupied grid cells and the current map direction.
[0035] To address the aforementioned technical problems, this application also proposes a raster map main direction calculation device, which includes a memory and a processor coupled to the memory; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the raster map main direction calculation method as described above.
[0036] To address the aforementioned technical problems, this application also proposes a computer storage medium for storing program data, which, when executed by a computer, is used to implement the aforementioned method for calculating the main direction of a raster map.
[0037] Compared with existing technologies, the beneficial effects of this application are as follows: the raster map main direction calculation device determines several candidate map directions based on the current map direction; rotates the current raster map according to the candidate map directions to obtain candidate raster maps corresponding to each candidate map direction; obtains the effective occupied grid number of each candidate raster map; and determines the main direction of the raster map using the candidate map direction corresponding to the maximum effective occupied grid number and the current map direction. Through the above-described raster map main direction calculation method, the main direction of the raster map is directly calculated through statistical methods on the graticule, without the need for line extraction and fitting. This effectively avoids setting complex line extraction parameters and can also handle scenarios where line extraction fails, thus improving the accuracy of the raster map main direction calculation. Attached Figure Description
[0038] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0039] in:
[0040] Figure 1 This is a schematic diagram of the raster map before map orientation correction technology.
[0041] Figure 2 This is a schematic diagram of a raster map after orientation correction technology.
[0042] Figure 3 This is a flowchart illustrating an embodiment of the raster map main direction calculation method provided in this application;
[0043] Figure 4 This is a schematic diagram of the overall process of the raster map main direction calculation method provided in this application;
[0044] Figure 5 This is the original raster land provided in this application. Figure 1 A schematic diagram of the embodiment;
[0045] Figure 6 This is a schematic diagram illustrating the effect of placing the main direction of the original raster map provided in this application parallel to the Y-axis direction;
[0046] Figure 7 This is a schematic diagram illustrating the effect of placing the main direction of the original raster map provided in this application parallel to the X-axis direction;
[0047] Figure 8 It is the candidate raster map obtained by rotating the original raster map according to the direction of a candidate map;
[0048] Figure 9 It is the candidate raster map obtained by rotating the original raster map according to the direction of another candidate map;
[0049] Figure 10 yes Figure 3 The diagram shows the detailed process of step S13 in the method for calculating the main direction of the raster map.
[0050] Figure 11 This is a schematic diagram of an embodiment of the grid map main direction calculation device provided in this application;
[0051] Figure 12 This is a schematic diagram of the structure of an embodiment of the grid map main direction calculation device provided in this application;
[0052] Figure 13 This is a schematic diagram of the structure of an embodiment of the computer storage medium provided in this application. Detailed Implementation
[0053] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0054] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a particular order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the application described herein can be implemented, for example, in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0055] Please refer to the correction effect of current map orientation correction technology. Figure 1 and Figure 2 , Figure 1 This is a schematic diagram of a raster map before map orientation correction technology. Figure 2 This is a schematic diagram of a raster map after being corrected using map orientation correction technology.
[0056] contrast Figure 1 and Figure 2 It is known that although the map orientation correction technology has a good correction effect, it depends on the straight line fitting effect. For some scenarios where the straight line fitting effect is poor, the map orientation correction effect will be greatly reduced.
[0057] To address the problems of current map orientation correction techniques, this application provides a method for calculating the main orientation of a raster map, which can accurately find the main orientation of the raster map without extracting straight line segments.
[0058] Please refer to details. Figure 3 and Figure 4 , Figure 3 This is a flowchart illustrating an embodiment of the raster map main direction calculation method provided in this application. Figure 4 This is a schematic diagram of the overall process of the raster map main direction calculation method provided in this application.
[0059] The raster map main direction calculation method of this application is applied to a raster map main direction calculation device. This raster map main direction calculation device can be a server, a terminal device, or a system in which a server and a terminal device cooperate. Accordingly, all components of the raster map main direction calculation device, such as individual units, sub-units, modules, and sub-modules, can be entirely located in the server, entirely located in the terminal device, or separately located in both the server and the terminal device.
[0060] Furthermore, the aforementioned server can be either hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When the server is software, it can be implemented as multiple software programs or software modules, such as software or software modules used to provide distributed server functionality, or as a single software program or software module; no specific limitations are made here.
[0061] like Figure 3 As shown, the specific steps are as follows:
[0062] Step S11: Based on the current map orientation, determine several candidate map orientations.
[0063] In this embodiment of the application, for any grid map, if there is an optimal main direction, then this main direction must be within a 45-degree range to the left and right of the current grid map direction, because any straight line can be rotated at most 45 degrees to be parallel to the X-axis or Y-axis.
[0064] It should be noted that some raster maps do not have an optimal principal direction, such as a circle in the map. Such raster maps are not the objects that the raster map principal direction calculation method of this application needs to handle.
[0065] Based on the above principle, the raster map main direction calculation device uses the current map direction as a reference and limits the search range of the main direction to a 45-degree range to the left and right of the current direction. Specifically, the raster map main direction calculation device can determine candidate map directions within the search range according to a preset step size.
[0066] For example, the candidate main direction is based on the current direction of the map as the initial value, and then rotated clockwise and counterclockwise by a certain angular step (generally greater than 45 degrees) to become the candidate main direction. For example, it is generally assumed that the angle of the current main direction of the map is 0 degrees. If the step is 1 degree, then the candidate main directions are [-45, -44, -43, ..., -3, -2, -1, 0, 1, 2, 3, ..., 43, 44, 45].
[0067] In other embodiments, the grid map main direction calculation device may also set other degree step sizes according to the device calculation resources, which will not be listed here.
[0068] In a raster map, the main direction generally refers to the direction of a long line segment or a majority of shorter line segments. Therefore, once the line segments are located, the main direction of the raster map can be easily calculated. Please refer to [link / reference] for details. Figures 5 to 7 ,in, Figure 5 The original raster map, Figure 6 To create a raster map with the main direction of the raster parallel to the Y-axis, Figure 7 This is a raster map with the main direction of the raster placed parallel to the X-axis.
[0069] Most methods for extracting line segments rely on the Hough transform, but the Hough transform suffers from too many parameters and poor accuracy. This application constructs a new mathematical model and method to solve this problem. Please refer to the following steps:
[0070] Step S12: Rotate the current grid map according to the candidate map direction to obtain the candidate grid map corresponding to each candidate map direction.
[0071] In this embodiment of the application, the grid map main direction calculation device rotates the current grid map according to each candidate map direction to obtain the candidate grid map corresponding to each candidate map direction, and then calculates the probability that the candidate main direction is the best main direction based on the candidate main direction of each candidate grid map.
[0072] Specifically, when the raster map main direction calculation device rotates the current raster map, it mainly rotates it according to the center point of the current raster map to ensure that the shapes of the current raster map and the candidate raster maps are basically consistent. Please refer to [link / reference] for details. Figure 8 and Figure 9 , Figure 8 It is the candidate raster map obtained by rotating the original raster map according to the orientation of a candidate map. Figure 9 It is the candidate raster map obtained by rotating the original raster map according to the direction of another candidate map.
[0073] Specifically, the raster map main direction calculation device rotates all occupied graticules in the raster map to the candidate main direction with the center of the raster map as the rotation center, and then performs collinear graticule statistics on the graticules in each row and column of the raster map.
[0074] It should be noted that when rotating the occupied grid, the number of occupied grids must remain unchanged before and after the rotation. No interpolation operations are allowed, as these will introduce additional occupied grids and affect the calculation accuracy of the main direction.
[0075] Step S13: Obtain the number of valid occupied grid cells for each candidate grid map.
[0076] In the embodiments of this application, such as Figures 5 to 9 As shown, black grid cells represent occupied grid cells, indicating the actual environment, while white grid cells represent free grid cells (blank grid cells). If a row of grid cells occupies the most black grid cells, then the main direction of that row is the current candidate main direction. Similarly, if a column of grid cells occupies the most black grid cells, then the main direction of that column is the current candidate main direction.
[0077] However, a raster map consists of many rows and columns of raster cells. Therefore, the main direction of a raster map should be determined by considering the number of occupied cells in all rows and columns. If the main direction of the raster map is determined by simply counting the number of black cells in all rows and columns, then all candidate main directions will not produce a clear distinction, because the total number of occupied cells in a raster map does not change with the rotation of occupied cells.
[0078] As the occupied grid cells rotate, the relative distribution of occupied and non-occupied grid cells in each row or column changes significantly. Therefore, the raster map main direction calculation device further provides a specific scheme for calculating the number of effectively occupied grid cells in a candidate raster map. Please refer to [link / reference needed] for details. Figure 10 , Figure 10 yes Figure 3 The diagram shows the detailed process of step S13 in the method for calculating the main direction of the raster map.
[0079] like Figure 3 As shown, the specific steps are as follows:
[0080] Step S131: Count the number of valid occupied rows of the candidate raster map row by row.
[0081] Step S132: Count the number of effectively occupied columns of candidate raster maps column by column.
[0082] Step S133: Determine the number of valid occupied grid cells based on the number of valid occupied row grid cells and the number of valid occupied column grid cells.
[0083] Specifically, the main direction calculation device of the raster map counts the black-occupied graticules of the candidate raster map row by row, and takes the number of black-occupied graticules in the row with the most black-occupied graticules as the number of effective occupied row graticules; it also counts the black-occupied graticules of the candidate raster map column by column, and takes the number of black-occupied graticules in the column with the most black-occupied graticules as the number of effective occupied column graticules.
[0084] Finally, the raster map main direction calculation device sums the number of effectively occupied row grids and the number of effectively occupied column grids to obtain the number of effectively occupied grids of the candidate raster map.
[0085] Comparison Figure 5 and Figure 8 , Figure 9 As can be seen, from left to right, the number of consecutively occupied grid cells in the same row or column gradually increases with clockwise rotation. Therefore, when counting the number of occupied grid cells in the entire grid map, it is necessary to consider the continuity of occupied grid cells in each row or column. That is, black grid cells must meet a certain continuity to be counted as valid black grid cells. This can effectively prevent the number of occupied grid cells from remaining unchanged from affecting the statistics of validly occupied grid cells in the entire grid map.
[0086] The determination of the continuity of occupied grid cells in each row or column can be set according to actual needs. For example, it can specify the required number of consecutive occupied grid cells, the maximum number of non-occupied grid cells in between, or the ratio of occupied to non-occupied grid cells. This application provides the following specific implementation methods. Taking the calculation of occupied row grid cells as an example, the calculation of occupied column grid cells can be obtained similarly:
[0087] In the first specific implementation, the raster map main direction calculation device obtains the number of consecutively occupied grid cells in the candidate raster map row by row, for example, the number of consecutively occupied grid cells may be 2, 3, 5, 8, etc. The raster map main direction calculation device traverses all the consecutively occupied grid cell counts and compares them with a preset number threshold 6, and determines the consecutively occupied grid cells with a consecutive number of 8 as the consecutively occupied row grid cells.
[0088] It should be noted that if the preset quantity threshold is 5, the raster map main direction calculation device needs to treat both the continuously occupied raster with a continuous number of 8 and the continuously occupied raster with a continuous number of 5 as continuously occupied row rasters.
[0089] In the second specific implementation, the raster map main direction calculation device acquires all occupied graticles of the candidate raster map row by row, and distinguishes between continuously occupied graticles and other occupied graticles based on whether adjacent graticles are all occupied graticles. Then, the raster map main direction calculation device determines whether the number of non-occupied graticles between continuously occupied graticles and other occupied graticles in the same row is less than a preset graticle threshold. If so, it means that the continuity of the continuously occupied graticles meets the requirement, and the continuously occupied graticles can be determined as continuously occupied row graticles.
[0090] In the third specific implementation, the grid map main direction calculation device determines line by line whether the ratio of occupied row grids to non-occupied row grids is greater than a preset ratio threshold. If so, it means that the continuity of occupied row grids meets the requirements, that is, the occupied row grids can be determined as continuous occupied row grids.
[0091] Step S14: Determine the main direction of the grid map using the candidate map direction corresponding to the maximum number of effective occupied grid cells and the current map direction.
[0092] In this embodiment, the raster map main direction calculation device determines the maximum number of effectively occupied grid cells for each candidate map direction according to the above process. Furthermore, the raster map main direction calculation device also needs to determine the maximum number of effectively occupied grid cells for the current map direction. From all maximum effectively occupied grid cell numbers, the raster map main direction calculation device further determines the maximum number, thereby determining the map direction corresponding to that maximum number as the raster map main direction.
[0093] In this application, a raster map main direction calculation device determines several candidate map directions based on the current map direction; rotates the current raster map according to the candidate map directions to obtain a candidate raster map corresponding to each candidate map direction; obtains the number of effectively occupied grid cells for each candidate raster map; and determines the main direction of the raster map using the candidate map direction corresponding to the maximum number of effectively occupied grid cells and the current map direction. This raster map main direction calculation method directly calculates the main direction of the raster map through statistical methods on the grid cells, eliminating the need for line extraction and fitting. This effectively avoids setting complex line extraction parameters and can handle scenarios where line extraction fails, thus improving the accuracy of the raster map main direction calculation.
[0094] The method for calculating the main direction of a raster map in this application directly calculates the main direction of the raster map through statistical methods on the raster, without the need to extract and fit straight lines. This can effectively avoid setting complex straight line extraction parameters and can also handle scenarios where straight line extraction fails.
[0095] The raster map main direction calculation method of this application directly considers the processing of jagged edges (collinear graticules) in the raster statistics stage, while the traditional method of extracting straight lines indirectly processes jagged edges, and its processing effect is slightly worse.
[0096] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0097] To implement the above-mentioned method for calculating the main direction of a raster map, this application also proposes a device for calculating the main direction of a raster map, for details please refer to [link / reference needed]. Figure 11, Figure 11 This is a schematic diagram of an embodiment of the grid map main direction calculation device provided in this application.
[0098] The grid map main direction calculation device 500 of this embodiment includes: a candidate module 51, a rotation module 52, a calculation module 53, and a determination module 54.
[0099] The candidate module 51 is used to determine several candidate map directions based on the current map direction.
[0100] The rotation module 52 is used to rotate the current grid map according to the candidate map direction to obtain the candidate grid map corresponding to each candidate map direction.
[0101] The calculation module 53 is used to obtain the number of effectively occupied grid cells for each candidate grid map.
[0102] The determining module 54 is used to determine the main direction of the grid map by using the candidate map direction corresponding to the maximum number of effectively occupied grid cells and the current map direction.
[0103] To implement the above-mentioned method for calculating the main direction of a raster map, this application also proposes a device for calculating the main direction of a raster map. Please refer to [link / reference needed] for details. Figure 12 , Figure 12 This is a schematic diagram of an embodiment of the grid map main direction calculation device provided in this application.
[0104] The grid map main direction calculation device 400 in this embodiment includes a processor 41, a memory 42, an input / output device 43, and a bus 44.
[0105] The processor 41, memory 42, and input / output device 43 are respectively connected to the bus 44. The memory 42 stores program data, and the processor 41 is used to execute the program data to implement the grid map main direction calculation method described in the above embodiment.
[0106] In this embodiment, processor 41 can also be referred to as a CPU (Central Processing Unit). Processor 41 may be an integrated circuit chip with signal processing capabilities. Processor 41 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor, or processor 41 can be any conventional processor.
[0107] This application also provides a computer storage medium; please refer to the following: Figure 13 , Figure 13 This is a schematic diagram of a computer storage medium according to an embodiment of the present application. The computer storage medium 600 stores a computer program 61, which, when executed by a processor, is used to implement the grid map main direction calculation method of the above embodiment.
[0108] When the embodiments of this application are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0109] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method for calculating the main direction of a raster map, characterized in that, The method for calculating the main direction of the raster map includes: Based on the current map orientation, several candidate map orientations are determined; the several candidate map orientations include the current map orientation. Rotate the current grid map according to the candidate map direction to obtain the candidate grid map corresponding to each candidate map direction; Obtain the number of effectively occupied grid cells for each candidate grid map; The main direction of the grid map is determined by using the candidate map directions corresponding to the maximum number of effectively occupied grid cells. The step of obtaining the number of effectively occupied grid cells for each candidate grid map includes: Count the number of effectively occupied rows of the candidate raster map row by row; Count the number of effectively occupied columns of the candidate raster map column by column; The number of effectively occupied grid cells is determined based on the number of effectively occupied row grid cells and the number of effectively occupied column grid cells; The step-by-step counting of the number of valid occupied rows of the candidate raster map includes: The consecutively occupied rows of the candidate raster map are counted row by row; Count the number of consecutive occupied rows in all rows to obtain the number of valid occupied rows in the candidate raster map.
2. The method for calculating the main direction of a raster map according to claim 1, characterized in that, The step of rotating the current raster map according to the direction of the candidate map includes: Obtain the center point of the current raster map; Rotate the current grid map according to the direction of the candidate map, using the center point of the map as the rotation center.
3. The method for calculating the main direction of a raster map according to claim 1, characterized in that, The step-by-step counting of consecutively occupied rows of the candidate raster map includes: Obtain the number of consecutively occupied grid cells in the candidate grid map row by row; A continuously occupied grid cell with a number of consecutively occupied grid cells greater than or equal to a preset threshold number is defined as a continuously occupied row grid cell.
4. The method for calculating the main direction of a raster map according to claim 3, characterized in that, The step of determining consecutively occupied grid cells with a number of consecutively occupied grid cells greater than or equal to a preset threshold as consecutively occupied row grid cells includes: Obtain consecutively occupied grid cells whose number is greater than or equal to a preset threshold. In response to the fact that the number of non-occupied grids between the continuously occupied grid and other occupied grids in the same row is less than a preset grid threshold, the continuously occupied grid is determined as the continuously occupied row grid.
5. The method for calculating the main direction of a raster map according to claim 1, characterized in that, The step-by-step counting of consecutively occupied rows of the candidate raster map includes: Obtain several rows of raster regions of the candidate raster map line by line; Determine whether the ratio of occupied row grids to non-occupied row grids in the row grid region is greater than or equal to a preset ratio threshold. If so, the occupying row grid in the row grid region is determined as the continuously occupying row grid.
6. A grid map main direction calculation device, characterized in that, The raster map main direction calculation device includes: a candidate module, a rotation module, a calculation module, and a determination module; wherein, The candidate module is used to determine several candidate map directions based on the current map direction; the several candidate map directions include the current map direction. The rotation module is used to rotate the current grid map according to the candidate map direction to obtain the candidate grid map corresponding to each candidate map direction. The calculation module is used to obtain the number of effectively occupied grid cells for each candidate grid map; The determining module is used to determine the main direction of the grid map by using the candidate map direction corresponding to the maximum number of effective occupied grid cells and the current map direction; The calculation module is also used to count the number of effectively occupied row grid cells of the candidate raster map row by row; count the number of effectively occupied column grid cells of the candidate raster map column by column; and determine the number of effectively occupied grid cells based on the number of effectively occupied row grid cells and the number of effectively occupied column grid cells. The calculation module is also used to count the consecutive occupied rows of the candidate raster map row by row; count the consecutive occupied rows of all rows, and obtain the number of valid occupied rows of the candidate raster map.
7. A grid map main direction calculation device, characterized in that, The main direction calculation device for the raster map includes a memory and a processor coupled to the memory; The memory is used to store program data, and the processor is used to execute the program data to implement the grid map main direction calculation method as described in any one of claims 1 to 5.
8. A computer storage medium, characterized in that, The computer storage medium is used to store program data, which, when executed by the computer, is used to implement the grid map main direction calculation method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Road marking recognition method, map generation method, and related products
US20210248390A1
Dynamic occupancy grid estimation method and apparatus
WO2022078342A1