Grid map acquisition method and device, electronic equipment and storage medium
By converting the original raster map into point cloud data and transforming it to generate a target raster map, the problem of storing and processing raster map data in the existing technology requires a large amount of system resources, and the data volume is reduced and resource conservation.
Patent Information
- Application Number
- CN202310944043.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-28
- Publication Date
- 2025-02-14
AI Technical Summary
In the prior art, storing and processing raster map data requires a large amount of system resources, especially in environments where resources are limited such as embedded devices and mobile devices, how to reduce the amount of data in raster maps has become an urgent problem.
By obtaining the point cloud data corresponding to pixel points in the original raster map, generating a point cloud matrix, determining the target vector and point cloud transformation matrix, transforming the point cloud data, obtaining the target point cloud data, and re-determining the target gate based on this data grid map.
This achieves the reduction of the data volume of the original raster map, reduces the system resources required for storage and processing, making the target raster map simpler and easier to process, and avoids the need for a large number of system resources in related technologies.
Smart Images

Figure CN119437258A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, device, electronic device and storage medium for obtaining a raster map. Background Art
[0002] With the widespread use of raster maps in many applications such as self-driving cars, robot navigation, and GIS systems, there is an increasing demand for storing and processing raster map data. However, since raster map data usually requires a large amount of storage space, this is a challenge in resource-constrained environments such as embedded devices and mobile devices.
[0003] How to reduce the data volume of raster maps and thus reduce the system resources required to store and process raster maps has become an urgent problem to be solved. Summary of the invention
[0004] The embodiments of the present application provide a raster map acquisition method, device, electronic device and storage medium, which can reduce the data volume of the raster map and solve the problem in the related art that storage and processing of raster map data requires a large amount of system resources.
[0005] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.
[0006] According to one aspect of an embodiment of the present application, a grid map acquisition method is provided, the method comprising: acquiring point cloud data corresponding to pixel points in an original grid map, and generating a point cloud matrix corresponding to the original grid map based on the point cloud data; determining a target vector for characterizing the distribution of the point cloud data according to the point cloud matrix, and determining a point cloud transformation matrix based on the target vector; transforming the point cloud data by means of the point cloud transformation matrix to obtain target point cloud data, and determining a target grid map according to the target point cloud data.
[0007] In some examples, a point cloud matrix corresponding to the original grid map is generated based on the point cloud data, including: calculating the point cloud center points corresponding to all the point cloud data, and calculating the distance from each point cloud data to the point cloud center point; and generating the point cloud matrix according to the distance from each point cloud data to the point cloud center point.
[0008] In some examples, a target vector for characterizing the distribution of the point cloud data is determined based on the point cloud matrix, including: performing singular value decomposition on the point cloud matrix to obtain multiple singular values corresponding to the point cloud matrix, determining the largest singular value from the multiple singular values, and taking the vector corresponding to the largest singular value as the target vector.
[0009] In some examples, determining a point cloud transformation matrix based on the target vector includes: obtaining a target horizontal coordinate and a target vertical coordinate in the target vector, and determining a rotation angle corresponding to the target vector based on the target horizontal coordinate and the target vertical coordinate; determining a rotation matrix corresponding to the target vector according to the rotation angle, and determining the point cloud transformation matrix based on the rotation matrix.
[0010] In some examples, the rotation angle corresponding to the target vector is determined based on the target horizontal coordinate and the target vertical coordinate, including: determining the quadrant of the target vector based on the target horizontal coordinate and the target vertical coordinate, and determining the rotation angle corresponding to the target vector according to the quadrant of the target vector; bringing the target horizontal coordinate and the target vertical coordinate into the rotation angle determination method to perform angle calculation to determine the rotation angle corresponding to the target vector.
[0011] In some examples, each point cloud data includes a horizontal coordinate, a vertical coordinate, a height and a reflectivity; obtaining the point cloud data corresponding to the pixel point in the original grid map includes: obtaining the resolution of the original grid map, and determining the pixel row, pixel column, initial horizontal coordinate, initial vertical coordinate and pixel value corresponding to each pixel point in the original grid map; determining the horizontal coordinate of the point cloud data corresponding to each pixel point based on the pixel column, initial horizontal coordinate and resolution corresponding to each pixel point; determining the vertical coordinate of the point cloud data corresponding to each pixel point based on the pixel row, initial vertical coordinate and resolution corresponding to each pixel point; setting a fixed height, using the fixed height as the height of the point cloud data corresponding to each pixel point, and using the pixel value of each pixel point as the reflectivity of the point cloud data corresponding to each pixel point.
[0012] In some examples, determining a target grid map based on the target point cloud data includes: obtaining the horizontal coordinates and vertical coordinates in all the target point cloud data to determine the minimum horizontal coordinate, maximum horizontal coordinate, minimum vertical coordinate and maximum vertical coordinate in all the target point cloud data; determining the width and height of the target grid map based on the minimum horizontal coordinate, maximum horizontal coordinate, minimum vertical coordinate and maximum vertical coordinate in all the target point cloud data; determining the target pixel point based on the target point cloud data to obtain the target grid map.
[0013] According to one aspect of an embodiment of the present application, a grid map acquisition device is provided, the device comprising: an acquisition module, used to acquire point cloud data corresponding to pixel points in an original grid map, and generate a point cloud matrix corresponding to the original grid map based on the point cloud data; a determination module, used to determine a target vector for characterizing the distribution of the point cloud data according to the point cloud matrix, and determine a point cloud transformation matrix based on the target vector; a transformation module, used to transform the point cloud data through the point cloud transformation matrix to obtain target point cloud data, and determine a target grid map according to the target point cloud data.
[0014] According to one aspect of an embodiment of the present application, an embodiment of the present application provides an electronic device, comprising one or more processors; a storage device for storing one or more computer programs, when the one or more computer programs are executed by the one or more processors, the electronic device implements the method as described above.
[0015] According to one aspect of an embodiment of the present application, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor of an electronic device, the electronic device executes the method as described above.
[0016] In the technical solution provided in the embodiment of the present application, the original raster map is converted into corresponding point cloud data. After the point cloud data is determined, the corresponding point cloud matrix is generated through the point cloud data, and the point cloud transformation matrix is determined based on the target vector of the point cloud data distribution. Finally, the point cloud data is transformed based on the point cloud transformation matrix to obtain the target point cloud data, and finally the target raster map is re-determined based on the target point cloud data, wherein the point cloud data corresponding to the original raster map is transformed to achieve the conversion of the point cloud data corresponding to the original raster map into a more regular shape, thereby reducing invalid point cloud data, making the target point cloud data simpler and easier to process than the point cloud data corresponding to the original raster map. Finally, the target raster map determined based on the target point cloud data is also simpler and easier to process, thereby reducing the data volume of the original raster map, and reducing the system resources required for storing and processing the target raster map accordingly, thereby avoiding the problem of requiring a large amount of system resources to store and process raster map data in related technologies.
[0017] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings herein are incorporated into the specification and constitute a part of the specification, showing embodiments consistent with the present application, and together with the specification, are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0019] Figure 1 is a basic flow chart of a grid map acquisition method shown in an exemplary embodiment of the present application;
[0020] Figure 2 It is a basic schematic diagram showing a conversion relationship between pixel points and point cloud data according to an exemplary embodiment of the present application;
[0021] Figure 3 is a schematic diagram showing a comparison between a target grid map and an original grid map shown in an exemplary embodiment of the present application;
[0022] Figure 4 is a basic schematic diagram of a grid map acquisition device shown in an exemplary embodiment of the present application;
[0023] Figure 5 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION
[0024] Here, exemplary embodiments will be described in detail, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are only examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
[0025] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0026] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all contents and operations, nor must they be executed in the order described. For example, some operations may be decomposed, while some operations may be combined or partially combined, so the actual execution order may change according to actual conditions.
[0027] It should also be noted that the "multiple" mentioned in this application refers to two or more than two. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship.
[0028] In order to solve the above technical problems, the present application embodiment provides a method for obtaining a grid map, such as Figure 1 As shown, the method includes:
[0029] S101, obtaining point cloud data corresponding to pixel points in an original grid map, and generating a point cloud matrix corresponding to the original grid map based on the point cloud data;
[0030] S102, determining a target vector for characterizing the distribution of the point cloud data according to the point cloud matrix, and determining a point cloud transformation matrix based on the target vector;
[0031] S103, transforming the point cloud data by using the point cloud transformation matrix to obtain target point cloud data, and determining a target grid map according to the target point cloud data.
[0032] It can be understood that the grid map acquisition method provided in this embodiment can be applied to mobile tools, wherein the mobile tools can be all devices with mobile capabilities, including vehicles with automatic driving or intelligent driving (including vehicles with manned functions (such as cars, buses, large buses, minibuses, etc.), vehicles with cargo functions (such as ordinary trucks, vans, trailers, closed trucks, tank trucks, flatbed trucks, container trucks, dump trucks, special structure trucks), special vehicles (such as logistics distribution vehicles, automatic guided transport vehicles AGV, patrol cars, cranes, cranes, excavators, bulldozers, forklifts, rollers, loaders, off-road engineering vehicles, armored engineering vehicles, sewage treatment vehicles, sanitation vehicles, vacuum trucks, floor washing vehicles, sprinkler trucks, sweeping robots, food delivery robots, shopping guide robots, lawn mowers, golf carts, etc.), vehicles with entertainment functions (such as entertainment vehicles, amusement park automatic driving devices, balance cars, etc.), rescue vehicles (such as fire trucks, ambulances, power repair vehicles, engineering rescue vehicles, etc.)) and robots (such as sweeping robots, food delivery robots, etc.).
[0033] In some examples, the raster map acquisition method provided in this example can also be applied to terminal devices, where the terminal devices include but are not limited to: mobile phones, tablet computers, smart watches, laptops, desktop computers, etc.
[0034] It can be understood that the original raster map is a raster image obtained by converting scene data into digital data by scanning and measuring the scene by the raster map construction device. The original raster map is composed of multiple pixels. Before obtaining the point cloud data corresponding to the pixel points in the original raster map, the method provided in this example also includes: setting the pixel value corresponding to each pixel point; specifically, the original raster map is divided into an exploration area and an unexplored area, and the exploration area specifically includes: a passable area and an inaccessible area, and the pixel value of each pixel point in the passable area of the original raster map is set to 255, the pixel value of each pixel point in the inaccessible area of the original raster map is set to 0, and the pixel value of the pixel point in the unexplored area of the original raster map is set to 127.
[0035] Among them, the raster map acquisition method provided in this example converts the original raster map into the corresponding point cloud data. After determining the point cloud data, the corresponding point cloud matrix is generated through the point cloud data, and the point cloud transformation matrix is determined based on the target vector of the point cloud data distribution. Finally, the point cloud data is transformed based on the point cloud transformation matrix to obtain the target point cloud data, and finally the target raster map is re-determined based on the target point cloud data. Among them, the point cloud data corresponding to the original raster map is transformed to achieve the conversion of the point cloud data corresponding to the original raster map into a more regular shape, thereby reducing invalid point cloud data, making the target point cloud data simpler and easier to process than the point cloud data corresponding to the original raster map. Finally, the target raster map determined based on the target point cloud data is also simpler and easier to process, thereby reducing the data volume of the original raster map, and reducing the system resources required for storing and processing the target raster map accordingly, thereby avoiding the problem of requiring a large amount of system resources to store and process raster map data in related technologies.
[0036] In some examples, each point cloud data includes a horizontal coordinate, a vertical coordinate, a height, and a reflectivity; obtaining the point cloud data corresponding to the pixel point in the original grid map includes:
[0037] Obtaining the resolution of the original grid map, and determining the pixel row, pixel column, initial horizontal coordinate, initial vertical coordinate and pixel value corresponding to the pixel point in the original grid map;
[0038] Determine the horizontal coordinate of the point cloud data corresponding to the pixel point based on the pixel column, the initial horizontal coordinate and the resolution corresponding to the pixel point;
[0039] Determine the ordinate of the point cloud data corresponding to the pixel point based on the pixel row corresponding to the pixel point, the initial ordinate, and the resolution;
[0040] A fixed height is set, and the fixed height is used as the height of the point cloud data corresponding to each pixel point, and the pixel value of each pixel point is used as the reflectivity of the point cloud data corresponding to each pixel point.
[0041] It can be understood that in order to save system resources, obtaining the point cloud data corresponding to the pixel points in the original grid map includes: obtaining the point cloud data corresponding to each pixel point in the exploration area of the original grid map; specifically, the pixel value of the pixel point in the original grid map is 0, 255 or 127, and only the point cloud data corresponding to the pixel points with pixel values of 0 and 255 are obtained, avoiding obtaining the point cloud data corresponding to the pixel points with a pixel value of 127 in the original grid map, thereby avoiding obtaining the point cloud data of all the pixels in the original grid map, achieving the effect of reducing the amount of point cloud data, and then subsequently transforming the point cloud data through the point cloud transformation matrix to obtain the target point cloud data, and when determining the target grid map according to the target point cloud data, the data amount of the target grid map is further reduced.
[0042] In some examples, obtaining point cloud data corresponding to pixel points in the original grid map includes: obtaining point cloud data corresponding to all pixel points in the original grid map.
[0043] Among them, each point cloud data includes abscissa, ordinate, height and reflectivity. Therefore, it is necessary to determine the abscissa, ordinate, height and reflectivity of the corresponding point cloud data according to the data of the pixel point in the original grid data. Specifically, firstly obtain the resolution of the original grid map, and determine the pixel row, pixel column, initial abscissa, initial ordinate and pixel value corresponding to the pixel point in the original grid map;
[0044] Continuing with the above example, the resolution of the original raster map is the value determined when constructing the original raster map. The resolution of the original raster map is used to characterize the real-world size corresponding to a pixel in the original raster map; the initial horizontal coordinate and the initial vertical coordinate of the pixel in the original raster map are used to characterize the position of the pixel in the original raster map; the pixel row corresponding to the pixel in the original raster map is the pixel row where the pixel is located, and the pixel column corresponding to the pixel in the original raster map is the pixel column where the pixel is located. Specifically, for example, if a pixel in the original raster map is in the second row of pixels, then the pixel row corresponding to the pixel is 2, and if a pixel in the original raster map is in the second column of pixels, then the pixel column corresponding to the pixel is 3.
[0045] Continuing with the above example, determining the abscissa of the point cloud data corresponding to the pixel point based on the pixel column, the initial abscissa, and the resolution corresponding to the pixel point includes: substituting the pixel column, the initial abscissa, and the resolution corresponding to the pixel point into a preset abscissa formula to determine the abscissa of the point cloud data, wherein the preset abscissa formula is as follows:
[0046] x = col·r + origin_x;
[0047] Among them, x is the horizontal coordinate of the point cloud data, col is the pixel column corresponding to the pixel point, r is the resolution of the original grid map, and origin_x is the initial horizontal coordinate of the pixel point in the original grid map;
[0048] Continuing with the above example, the ordinate of the point cloud data corresponding to the pixel point is determined based on the pixel row, the initial ordinate, and the resolution corresponding to the pixel point. Specifically, the pixel row, the initial ordinate, and the resolution corresponding to the pixel point are substituted into the preset ordinate formula to determine the ordinate of the point cloud data. The preset ordinate formula is as follows:
[0049] y = row·r+origin_y;
[0050] Among them, y is the ordinate of the point cloud data, row is the pixel row corresponding to the pixel point, r is the resolution of the original grid map, and origin_y is the initial horizontal coordinate of the pixel point in the original grid map;
[0051] It can be understood that a fixed height is set, and the fixed height is used as the height of the point cloud data corresponding to each pixel point, and the pixel value of each pixel point is used as the reflectivity of the point cloud data corresponding to each pixel point, wherein the fixed height is recorded as H (preferably, H is set to 0), and the pixel value of the pixel point is recorded as pixel, then combined with the above-determined abscissa and ordinate, the determined point cloud data is:
[0052] p cur (x,y,z,i)=(col·r+origin_x,row·r+origin_y,H,pixel);
[0053] Among them, p cur (x, y, z, i) is the point cloud data.
[0054] It can be understood that in some examples, in order to ensure that the information of the original raster map is not lost in subsequent operations, after determining the point cloud data corresponding to the pixel point, it is also necessary to determine the point cloud data above, below, left and right of the pixel point. Specifically, the point cloud data on the upper side of the pixel point is recorded as p up (x, y, z, i), and record the point cloud data below the pixel as pdown (x, y, z, i), the point cloud data on the left side of the pixel is recorded as p left (x, y, z, i), and record the point cloud data on the right side of the pixel as p right (x,y,z,i).
[0055] Continuing from the above example, we can understand that the length and width of each pixel in the grid map are both 0.5r, then:
[0056] p up (x,y,z,i)=(col·r+origin_x,row·r-0.5r+origin_y,H,pixel);
[0057] p down (x,y,z,i)=(col·r+origin_x,row·r+0.5r+origin_y,H,pixel);
[0058] p left (x,y,z,i)=(col·r-0.5r+origin_x,row·r+origin_y,H,pixel);
[0059] p right (x,y,z,i)=(col·r+0.5r+origin_x,row·r+origin_y,H,pixel);
[0060] In some examples of this embodiment, generating a point cloud matrix corresponding to the original grid map based on the point cloud data includes:
[0061] Calculate the point cloud center point corresponding to all the point cloud data, and calculate the distance from each point cloud data to the point cloud center point;
[0062] The point cloud matrix is generated according to the distance from each point cloud data to the center point of the point cloud.
[0063] Specifically, the point cloud center point corresponding to all point cloud data is calculated by a preset point cloud center point calculation formula, wherein the preset point cloud center point calculation formula is as follows:
[0064] where p k (x k ,y k ,z k );
[0065] Among them, n is the number of point cloud data, m is the center point of the point cloud, and p k is the kth point cloud data, x kis the horizontal coordinate of the kth point cloud data, y k is the ordinate of the kth point cloud data, z k is the height of the kth point cloud data.
[0066] It can be understood that when only the point cloud data corresponding to the pixel points is calculated, the number of point cloud data corresponds to the number of pixel points, that is, if there are x pixels, there are x point cloud data, and n=x in the above-mentioned preset point cloud center point calculation formula; for another example, if the point cloud data corresponding to the pixel points is calculated, and the point cloud data above, below, left and right of each pixel point is calculated, each pixel point corresponds to 5 point cloud data, that is, if there are x pixels, there are x point cloud data, and n=5*x in the above-mentioned preset point cloud center point calculation formula;
[0067] Continuing with the above example, after calculating the center point of the point cloud, calculate the distance from each point cloud data to the center point of the point cloud. Specifically, subtract the center point of the point cloud from the point cloud data to get the distance from the point cloud data to the center point of the point cloud, as follows:
[0068] y k =p k -m;
[0069] Among them, y k is the distance from the kth point cloud data to the center point of the point cloud, p k is the kth point cloud data, and m is the center point of the point cloud.
[0070] After obtaining the distances from all point cloud data to the center point of the point cloud, a distance set is generated and the distance set is used as a point cloud matrix, as follows:
[0071] Y={y 1 ,y 2 ,…,y n};
[0072] Among them, y 1 is the distance from the first point cloud data to the center point of the point cloud, y 2 is the distance from the second point cloud data to the center point of the point cloud... and so on, y n is the distance from the nth point cloud data to the center point of the point cloud, and Y is the point cloud matrix.
[0073] In some examples of this embodiment, determining a target vector for characterizing the distribution of the point cloud data according to the point cloud matrix includes:
[0074] Performing singular value decomposition on the point cloud matrix to obtain multiple singular values corresponding to the point cloud matrix,
[0075] The largest singular value is determined from the multiple singular values, and a vector corresponding to the largest singular value is used as the target vector.
[0076] Specifically, the point cloud matrix is decomposed by the following formula:
[0077] Y=UΣV T
[0078] Among them, Y is the point cloud matrix, U is the 3rd-order orthogonal matrix composed of vectors corresponding to singular values, Σ is the diagonal matrix whose diagonal is the singular value, V T is an n-order orthogonal matrix, T is the matrix transpose;
[0079] Specifically, assuming that the point cloud matrix Y is an N*M matrix, then the obtained U is an N*N square matrix (the vectors in it are orthogonal, and the vectors in U are called left singular vectors), Σ is an N*M matrix (except that the elements on the diagonal are all 0, and the elements on the diagonal are called singular values), V' (the transpose of V) is an N*N matrix, the vectors in it are also orthogonal, and the vectors in V are called right singular vectors);
[0080] It can be understood that, since the height of all point cloud data is unified as H in obtaining the point cloud data corresponding to the pixel points in the original grid map, it is only necessary to obtain the vector u corresponding to the largest singular value from U. max (x max ,y max ,z max ) is a target vector that can represent the distribution of the point cloud data;
[0081] In some examples of this embodiment, determining a point cloud transformation matrix based on the target vector includes:
[0082] Acquire a target abscissa and a target ordinate in the target vector, and determine a rotation angle corresponding to the target vector based on the target abscissa and the target ordinate;
[0083] A rotation matrix corresponding to the target vector is determined according to the rotation angle, and the point cloud transformation matrix is determined based on the rotation matrix.
[0084] Specifically, firstly, a target horizontal coordinate and a target vertical coordinate in the target vector are obtained, and a rotation angle corresponding to the target vector is determined based on the target horizontal coordinate and the target vertical coordinate, and the rotation angle is recorded as θ;
[0085] Then get the initial rotation matrix, where the initial rotation matrix includes the X-axis rotation matrix, the Y-axis rotation matrix and the Z-axis rotation matrix. Since the height H of all point cloud data is the same, all point cloud data can be regarded as two-dimensional point cloud data. At this time, only rotation around the Z axis is required. Therefore, the X-axis rotation matrix and the Y-axis rotation matrix are fixed rotation matrices, as follows:
[0086]
[0087] Among them, R x is the X-axis rotation matrix, R y is the Y-axis rotation matrix;
[0088] Then determine the z-axis rotation matrix according to the rotation angle, as follows:
[0089]
[0090] Among them, R z is the Z-axis rotation matrix, θ is the rotation angle;
[0091] After determining the X-axis rotation matrix, Y-axis rotation matrix, and Z-axis rotation matrix, the final point cloud transformation matrix is obtained according to the rotation matrices in the three directions, as follows:
[0092]
[0093] Among them, T is the point cloud transformation matrix, R x is the X-axis rotation matrix, R y is the Y-axis rotation matrix, R z is the Z-axis rotation matrix.
[0094] In some examples of this embodiment, determining a rotation angle corresponding to the target vector based on the target horizontal coordinate and the target vertical coordinate includes:
[0095] Determine the quadrant in which the target vector is located based on the target horizontal coordinate and the target vertical coordinate, and determine the rotation angle corresponding to the target vector according to the quadrant in which the target vector is located;
[0096] The target horizontal coordinate and the target vertical coordinate are brought into the rotation angle determination method to perform angle calculation to determine the rotation angle corresponding to the target vector.
[0097] Specifically, if the target horizontal coordinate and the target vertical coordinate have the same sign, it indicates that the target vector is in the first or third quadrant. In order to reduce the rotation angle, this example sets the rotation principle to rotate in the direction with a smaller angle. Therefore, the method for determining the rotation angle θ is as follows:
[0098]
[0099] Among them, abs() is the absolute value operation, atan2 is the tangent operation, and y max is the target ordinate, x max is the target horizontal coordinate;
[0100] Similarly, if the target horizontal coordinate and the target vertical coordinate have the same sign, it means that the target vector is in the second or fourth quadrant. In order to reduce the rotation angle, this example sets the rotation principle to rotate in the direction with a smaller angle. Therefore, the method for determining the rotation angle θ is as follows:
[0101]
[0102] Among them, abs() is the absolute value operation, atan2 is the tangent operation, and y max is the target ordinate, x max is the target horizontal coordinate;
[0103] It can be understood that after determining the rotation angle corresponding to the target vector based on the target horizontal coordinate and the target vertical coordinate, the method provided in this embodiment further includes:
[0104] Determine whether the rotation angle is the target angle. If the rotation angle is the target angle, directly exit the grid map acquisition method;
[0105] If the rotation angle is not the target angle, execute the subsequent step of "substituting the target horizontal coordinate and the target vertical coordinate into the rotation angle determination method to perform angle calculation, and determine the rotation angle corresponding to the target vector".
[0106] Among them, the above-mentioned target angles are 0° and 90°, that is, if the rotation angle is 0° or 90°, at this time, when the subsequent steps are executed according to the rotation angle, the size of the original grid map changes slightly or does not change, and it is meaningless to still execute the subsequent grid map acquisition method. Therefore, the grid map acquisition method is directly exited at this time; on the contrary, if the rotation angle is not 0° and 90°, the subsequent step of "substituting the target horizontal coordinate and the target vertical coordinate into the rotation angle determination method for angle calculation to determine the rotation angle corresponding to the target vector" is executed at this time.
[0107] In some examples of this embodiment, after obtaining the point cloud transformation matrix, each point cloud data is transformed using the point cloud transformation matrix to obtain the transformed target point cloud data, as follows:
[0108]
[0109] Among them, p n is the target point cloud data, x n is the horizontal coordinate of the target point cloud data, yn is the ordinate of the target point cloud data, z n is the height of the target point cloud data; T is the point cloud transformation matrix, p ori is the point cloud data obtained from the pixels of the original raster map, x ori is the horizontal coordinate of the point cloud data, y ori is the vertical coordinate of the point cloud data, z ori is the height of the point cloud data;
[0110] It can be understood that after the point cloud transformation matrix transformation, the reflectivity of each target point cloud data is the same as the reflectivity of the point cloud data obtained by the pixel points of the original raster map. For example, if the reflectivity of the point cloud data obtained by the pixel points of the original raster map is 255, then the reflectivity of the corresponding target point cloud data after the point cloud data transformation is also 255.
[0111] In some examples of this embodiment, determining a target grid map according to the target point cloud data includes:
[0112] Acquire the horizontal coordinates and the vertical coordinates of all the target point cloud data to determine the minimum horizontal coordinate, the maximum horizontal coordinate, the minimum vertical coordinate and the maximum vertical coordinate of all the target point cloud data;
[0113] Determine the width and height of the target grid map according to the minimum horizontal coordinate, the maximum horizontal coordinate, the minimum vertical coordinate and the maximum vertical coordinate in all the target point cloud data;
[0114] The target pixel points are determined according to the target point cloud data to obtain the target grid map.
[0115] First, determine the point cloud boundary of the target point cloud data, that is, by obtaining the abscissa and ordinate of all target point cloud data, and selecting the minimum abscissa, maximum abscissa, minimum ordinate and maximum ordinate from the obtained abscissa and ordinate, wherein the minimum abscissa, maximum abscissa, minimum ordinate and maximum ordinate are the boundaries of all target point cloud data;
[0116] Then calculate the width and height of the target grid map according to the boundary of the target point cloud data, as follows:
[0117] height=floor((pny max -pny min ) / r+0.5)
[0118] width = floor ((pnx max -pnx min ) / r+0.5)
[0119] Among them, height is the height of the target grid map, width is the width of the target grid map, floor(x) is a rounding function, that is, taking the largest integer not greater than x (different from "rounding", rounding down directly removes the decimal part, among them, pny max is the maximum ordinate, pny min is the minimum ordinate, pnx max is the maximum horizontal coordinate, pnx min is the minimum horizontal coordinate, r is the resolution of the original raster map;
[0120] After determining the width and height of the target grid map, the target pixel point is determined according to the target point cloud data to obtain the target grid map; the specific target pixel point includes abscissa and ordinate as well as reflectivity, wherein the abscissa of the corresponding target pixel point is determined by the abscissa and the minimum abscissa of the target point cloud data, as follows:
[0121] xn=floor((p nx -px min ) / r+0.5);
[0122] Among them, xn is the horizontal coordinate of the nth target pixel, p nx is the horizontal coordinate of the nth target point cloud data, pnx min is the minimum horizontal coordinate and r is the resolution.
[0123] Among them, the horizontal coordinate of the corresponding target pixel point can be determined according to the horizontal coordinate of the target point cloud data, as follows:
[0124] yn=floor((p ny -py min ) / r+0.5);
[0125] Among them, yn is the ordinate of the nth target pixel, p ny is the ordinate of the nth target point cloud data, pny min is the minimum ordinate and r is the resolution.
[0126] Then obtain the reflectivity of the target point cloud data, and use the reflectivity of the target point cloud data as the reflectivity of the target pixel point, as follows:
[0127] pixeln=intensity n ;
[0128] Among them, pixeln is the reflectivity of the nth pixel, intensity n is the reflectivity of the nth target point cloud data. It can be understood that the reflectivity of the target point cloud data is the same as the reflectivity of the corresponding point cloud data.
[0129] It can be understood that after obtaining the target pixel points corresponding to each target point cloud data, all the target pixel points together constitute the target grid map;
[0130] In some examples, after determining the target pixel points according to the target point cloud data to obtain the target grid map, the method further includes:
[0131] Obtaining an unexplored area in the target grid map, and setting a pixel value of 127 in the unexplored area to fill the target grid map;
[0132] It can be understood that in some examples, when the operation of obtaining point cloud data corresponding to pixel points in the original grid map is performed, only the point cloud data corresponding to the pixel points in the exploration area of the original grid map is obtained, and the point cloud data is subsequently transformed to obtain the target point cloud data. In the target grid map generated based on the target point cloud data, there are blank areas where target pixel points are not set. At this time, the area where the target pixel points are not set is regarded as the unexplored area in the target grid map, and the unexplored area in the target grid map is filled with pixels with a pixel value of 127, so that there are no blank areas in the unexplored area.
[0133] In some examples, after determining the target pixel points according to the target point cloud data to obtain the target grid map, the method further includes:
[0134] Save the target grid map and save the transformation relationship between the point cloud data and the target point cloud data;
[0135] Among them, saving the target grid map specifically includes: tiling the target grid map, dividing the target grid map into sub-grid maps of L meters (L is recommended to be 50 meters, and the number of grid pixels is 1000, that is, L / r) in size according to the height and width of the target grid map, and those that are not divisible do not need to be expanded to L meters, and the starting position and ending position of each sub-grid map are obtained. Secondly, the target grid map is divided according to the previous starting position and ending position to obtain all sub-grid maps, and stored in the form of "y_x_edge" (y and x are the coordinates of the upper left corner), and finally, the point cloud transformation matrix and the boundary coordinates of the target grid map are stored in the specified file. This ensures that when the terminal device uses the grid map, the sub-grid map can be used, thereby avoiding the need to take out the complete target grid map each time it is used, and further reducing the system resource requirements when the terminal device uses the grid map.
[0136] The grid map acquisition method provided in the present embodiment converts the original grid map into corresponding point cloud data. After determining the point cloud data, the corresponding point cloud matrix is generated through the point cloud data, and the point cloud transformation matrix is determined based on the target vector of the point cloud data distribution. Finally, the point cloud data is transformed based on the point cloud transformation matrix to obtain the target point cloud data, and finally the target grid map is re-determined based on the target point cloud data, wherein the point cloud data corresponding to the original grid map is transformed to realize the conversion of the point cloud data corresponding to the original grid map into a more regular shape, thereby reducing invalid point cloud data, making the target point cloud data simpler and easier to process than the point cloud data corresponding to the original grid map, and finally the target grid map determined based on the target point cloud data is also simpler and easier to process, thereby reducing the data volume of the original grid map, and reducing the system resources required for storing and processing the target grid map accordingly, thereby avoiding the problem in the related art that a large amount of system resources are required to store and process the grid map data.
[0137] In order to better understand the present invention, this embodiment provides a more specific example to illustrate the present invention. This example provides a method for obtaining a raster map. The method is divided into five steps, which are as follows:
[0138] The original raster map data is preprocessed to obtain point cloud data, the target vector corresponding to the maximum singular value of the point cloud data is determined, the point cloud transformation matrix is determined and the point cloud data is transformed, the target raster map is obtained from the target point cloud data obtained after rotation, and the target raster map data and the transformation relationship are saved.
[0139] The first step is preprocessing of the original raster map data.
[0140] Among them, the unexplored area in the original raster map does not need to be converted into point cloud data, and the pixel value of the pixel in the unexplored area is 127; the point cloud pixel value of the passable area in the explored area in the original raster map is set to 255, and the impassable area is set to 0. The resolution r of the original raster map (that is, the real-world size corresponding to a pixel in a raster map, r is usually set to 0.05m) is used to convert the complete original raster map constructed by the unmanned vehicle indoors into a point cloud map, where the height of each point cloud data in the point cloud map is set to a fixed value H (H is recommended to be 0). In order to ensure that the original raster map information is not lost in subsequent operations, a pixel in the original raster map needs to be converted into 5 point cloud data, as follows:
[0141] p cur (x,y,z,i)=(col·r+origin_x,row·r+origin_y,H,pixel)
[0142] p up(x,y,z,i)=(col·r+origin_x,row·r-0.5r+origin_y,H,pixel)
[0143] p down (x,y,z,i)=(col·r+origin_x,row·r+0.5r+origin_y,H,pixel)
[0144] p left (x,y,z,i)=(col·r-0.5r+origin_x,row·r+origin_y,H,pixel)
[0145] p right (x,y,z,i)=(col·r+0.5r+origin_x,row·r+origin_y,H,pixel)
[0146] Among them, p cur (x, y, z, i) is the point cloud data corresponding to the pixel point, p up (x, y, z, i) is the point cloud data corresponding to the upper side of the pixel, p down (x, y, z, i) is the point cloud data corresponding to the lower side of the pixel, p left (x, y, z, i) is the point cloud data corresponding to the left side of the pixel, p right (x, y, z, i) is the point cloud data corresponding to the right side of the pixel; (origin x , origin y ) is the real world coordinate of the original raster map pixel point, specifically, origin x is the horizontal coordinate of the pixel point, origin y is the vertical coordinate of the pixel, col is the pixel column where the pixel is located, row is the pixel row where the pixel is located, r is the resolution of the original raster map, H is the fixed height, and pixel is the pixel value of the pixel.
[0147] Specifically, the conversion relationship between pixel points and point cloud data is as follows: Figure 2 As shown, the black color is the point cloud data corresponding to the real position of the current pixel, and the length and width of each pixel are 0.5r. In addition, there is a point cloud data corresponding to the left side of the pixel, a point cloud data corresponding to the right side of the pixel, a point cloud data corresponding to the upper side of the pixel, and a point cloud data corresponding to the lower side of the pixel. The reflectivity of the point cloud data above, below, left and right of the pixel is consistent with the pixel value of the current pixel.
[0148] The second step is to determine the target vector corresponding to the largest singular value in the point cloud data. First, according to the following formula, solve step 1 to obtain the point cloud data (assuming that the number of point cloud data in the point cloud is n) The details are as follows:
[0149] where p k (x k ,y k ,z k );
[0150] Among them, n is the number of point cloud data, m is the center point of the point cloud, and p k is the kth point cloud data, x k is the horizontal coordinate of the kth point cloud data, y k is the ordinate of the kth point cloud data, z k is the height of the kth point cloud data;
[0151] Secondly, the distance set Y between all point cloud data and the point cloud center point m is calculated.
[0152] y k =p k -m;
[0153] Y={y 1 ,y 2 ,…,y n};
[0154] Among them, y k is the distance from the kth point cloud data to the center point of the point cloud, p k is the kth point cloud data, m is the center point of the point cloud; y 1 is the distance from the first point cloud data to the center point of the point cloud, y 2 is the distance from the second point cloud data to the center point of the point cloud... and so on, y n is the distance from the nth point cloud data to the center point of the point cloud, and Y is the point cloud matrix;
[0155] Using the singular value decomposition of the matrix, we can get the vectors corresponding to the singular values of the matrix Y, where Σ is a diagonal matrix whose diagonal is the singular value, U is a 3rd-order orthogonal matrix composed of the vectors corresponding to the singular values, and V T is an n-order orthogonal matrix, and T is the matrix transpose.
[0156] Y=UΣV T
[0157] Among them, Y is the point cloud matrix, U is the 3rd-order orthogonal matrix composed of vectors corresponding to singular values, Σ is the diagonal matrix whose diagonal is the singular value, V T is an n-order orthogonal matrix, and T is the matrix transpose;
[0158] Finally, since we set the height to the same value when converting the point cloud data in step 1, obtaining the point cloud distribution shape only requires obtaining the target vector u corresponding to the maximum singular value from U max (x max ,y max ,z max ) is used to describe the point cloud distribution.
[0159] The third step is to determine the point cloud transformation matrix and transform the point cloud data.
[0160] First, determine the target vector u max x in max and max Are they of the same sign? If they are of the same sign, it means that the vector u max It is in the first and third quadrants. The principle of rotation is to rotate in the direction of smaller angle. The method to determine the rotation angle θ is as follows:
[0161]
[0162] Among them, abs() is the absolute value operation, and atan2 is the tangent operation.
[0163] If they are of different signs, that is, different signs, it means that the vector u max In the second and fourth quadrants, the rotation angle θ is determined as follows:
[0164]
[0165] In some examples, the obtained rotation angle θ is 0° and 90°, and the grid map acquisition method is directly exited.
[0166] In some examples, after obtaining the rotation angle θ, since the two-dimensional (same Z) point cloud data only needs to be rotated around the Z axis, R x and R y The rotation matrix R around the Z axis is calculated based on the rotation angle obtained above. z :
[0167]
[0168] According to the above three directions of rotation matrix, the final point cloud transformation matrix T is obtained:
[0169]
[0170] Finally, the point cloud data p corresponding to the pixel points of the original grid map obtained in step 1 is transformed using the transformation matrix T. ori Transform to obtain the transformed target point cloud data p n .
[0171]
[0172] Among them, p n is the target point cloud data, x n is the horizontal coordinate of the target point cloud data, y n is the ordinate of the target point cloud data, z n is the height of the target point cloud data; T is the point cloud transformation matrix, p ori is the point cloud data obtained from the pixels of the original raster map, x ori is the horizontal coordinate of the point cloud data, y ori is the vertical coordinate of the point cloud data, z ori is the height of the point cloud data;
[0173] The fourth step is to restore the target grid map from the rotated target point cloud data. First, calculate the boundaries of the transformed target point cloud data, that is, the minimum and maximum values of pnx and pny, and determine the width and height of the target grid map according to the boundaries of the target point cloud data. The calculation formula is (r is the resolution):
[0174] height=floor((pny max -pny min ) / r+0.5);
[0175] width = floor ((pnx max -pnx min ) / r+0.5);
[0176] Among them, height is the height of the target grid map, width is the width of the target grid map, floor(x) is a rounding function, that is, taking the largest integer not greater than x (different from "rounding", rounding down directly removes the decimal part, among them, pny max is the maximum ordinate, pny min is the minimum ordinate, pnx max is the maximum horizontal coordinate, pnx min is the minimum horizontal coordinate, r is the resolution of the original raster map;
[0177] After obtaining the size of the final target grid map, the rotated target point cloud data is converted into target pixel points using the following formula:
[0178] y=floor((p ny -py min ) / r+0.5);
[0179] x=floor((p nx -px min) / r+0.5);
[0180] pixel n=intensity n ;
[0181] Among them, xn is the horizontal coordinate of the nth target pixel, p nx is the horizontal coordinate of the nth target point cloud data, pnx min is the minimum horizontal coordinate, r is the resolution, yn is the vertical coordinate of the nth target pixel, p ny is the ordinate of the nth target point cloud data, pny min is the minimum ordinate, pixeln is the pixel value of the nth pixel, intensity n is the reflectivity of the nth target point cloud data. It can be understood that the reflectivity of the target point cloud data is the same as the reflectivity of the corresponding point cloud data.
[0182] Specifically, Figure 3 As shown, Figure 3 This is a schematic diagram of the comparison between the target grid map and the original grid map. Figure 3 As shown, Figure 3 The left side shows the original raster map. Figure 3 The right side is the target grid map, and the storage data of the target grid map is reduced to about 1 / 4 of the original grid map;
[0183] The fifth step is to save the target raster map data and transformation relationship.
[0184] In order to ensure further reduction of memory usage when used downstream, when saving the target grid map, first, the target grid map obtained in step 4 needs to be tiled. According to the height and width of the target grid map obtained in step 4, it needs to be divided into sub-grid maps of size L meters (L is recommended to be 50 meters, and the grid pixels are 1000, that is, L / r). Those that are not divisible do not need to be expanded to L meters. The starting position and end position of each sub-grid map are obtained. Secondly, the target grid map obtained in step 4 is divided according to the previous starting position and end position to obtain all sub-grid maps, and stored in the form of "y_x_edge" (y and x are the coordinates of the upper left corner). Finally, the point cloud transformation matrix in step 4 and the boundary coordinates of the target grid map are stored in the specified file.
[0185] This example provides a raster map acquisition method, which solves the storage problem of large raster maps of unmanned vehicles in indoor environments, thereby realizing the preservation of large-scene raster maps indoors, ensuring navigation and positioning, reducing the memory and computing resources required for processing raster map data, reducing equipment costs, etc., improving customer experience, enhancing adaptability to large-scene operations, and improving product competitiveness.
[0186] Based on the same technical concept, this embodiment also provides a grid map acquisition device, such as Figure 4 As shown, the device comprises:
[0187] An acquisition module 1 is used to acquire point cloud data corresponding to pixel points in an original grid map, and generate a point cloud matrix corresponding to the original grid map based on the point cloud data;
[0188] Determination module 2, used to determine a target vector for characterizing the distribution of the point cloud data according to the point cloud matrix, and determine a point cloud transformation matrix based on the target vector;
[0189] The transformation module 3 is used to transform the point cloud data through the point cloud transformation matrix to obtain target point cloud data, and determine the target grid map according to the target point cloud data.
[0190] In some examples, a point cloud matrix corresponding to the original grid map is generated based on the point cloud data, including: calculating the point cloud center points corresponding to all the point cloud data, and calculating the distance from each point cloud data to the point cloud center point; and generating the point cloud matrix according to the distance from each point cloud data to the point cloud center point.
[0191] In some examples, a target vector for characterizing the distribution of the point cloud data is determined based on the point cloud matrix, including: performing singular value decomposition on the point cloud matrix to obtain multiple singular values corresponding to the point cloud matrix, determining the largest singular value from the multiple singular values, and taking the vector corresponding to the largest singular value as the target vector.
[0192] In some examples, determining a point cloud transformation matrix based on the target vector includes: obtaining a target horizontal coordinate and a target vertical coordinate in the target vector, and determining a rotation angle corresponding to the target vector based on the target horizontal coordinate and the target vertical coordinate; determining a rotation matrix corresponding to the target vector according to the rotation angle, and determining the point cloud transformation matrix based on the rotation matrix.
[0193] In some examples, the rotation angle corresponding to the target vector is determined based on the target horizontal coordinate and the target vertical coordinate, including: determining the quadrant of the target vector based on the target horizontal coordinate and the target vertical coordinate, and determining the rotation angle corresponding to the target vector according to the quadrant of the target vector; bringing the target horizontal coordinate and the target vertical coordinate into the rotation angle determination method to perform angle calculation to determine the rotation angle corresponding to the target vector.
[0194] In some examples, each point cloud data includes a horizontal coordinate, a vertical coordinate, a height and a reflectivity; obtaining the point cloud data corresponding to the pixel point in the original grid map includes: obtaining the resolution of the original grid map, and determining the pixel row, pixel column, initial horizontal coordinate, initial vertical coordinate and pixel value corresponding to each pixel point in the original grid map; determining the horizontal coordinate of the point cloud data corresponding to each pixel point based on the pixel column, initial horizontal coordinate and resolution corresponding to each pixel point; determining the vertical coordinate of the point cloud data corresponding to each pixel point based on the pixel row, initial vertical coordinate and resolution corresponding to each pixel point; setting a fixed height, using the fixed height as the height of the point cloud data corresponding to each pixel point, and using the pixel value of each pixel point as the reflectivity of the point cloud data corresponding to each pixel point.
[0195] In some examples, determining a target grid map based on the target point cloud data includes: obtaining the horizontal coordinates and vertical coordinates in all the target point cloud data to determine the minimum horizontal coordinate, maximum horizontal coordinate, minimum vertical coordinate and maximum vertical coordinate in all the target point cloud data; determining the width and height of the target grid map based on the minimum horizontal coordinate, maximum horizontal coordinate, minimum vertical coordinate and maximum vertical coordinate in all the target point cloud data; determining the target pixel point based on the target point cloud data to obtain the target grid map.
[0196] It should be understood that the combination of various modules of the grid map acquisition device provided in this embodiment can implement various steps of the above-mentioned grid map acquisition method and achieve the same technical effects as the various steps of the grid map acquisition method, which will not be repeated here.
[0197] An embodiment of the present application also provides an electronic device, comprising one or more processors and a storage device, wherein the storage device is used to store one or more computer programs, and when the one or more computer programs are executed by one or more processors, the electronic device implements the above-mentioned raster map acquisition method.
[0198] Figure 5 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.
[0199] It should be noted that Figure 5 The computer system 1800 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0200] like Figure 5 As shown, the computer system 1800 includes a processor (Central Processing Unit, CPU) 1801, which can perform various appropriate actions and processes according to the program stored in the read-only memory (Read-Only Memory, ROM) 1802 or the program loaded from the storage part 1808 to the random access memory (Random Access Memory, RAM) 1803, such as executing the method in the above embodiment. In RAM 1803, various programs and data required for system operation are also stored. CPU 1801, ROM 1802 and RAM 1803 are connected to each other through bus 1804. Input / output (Input / Output, I / O) interface 1805 is also connected to bus 1804.
[0201] In some embodiments, the following components are connected to the I / O interface 1805: an input section 1806 including a keyboard, a mouse, etc.; an output section 1807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1808 including a hard disk, etc.; and a communication section 1809 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1809 performs communication processing via a network such as the Internet. A drive 1810 is also connected to the I / O interface 1805 as needed. A removable medium 1811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1810 as needed, so that a computer program read therefrom is installed into the storage section 1808 as needed.
[0202] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 1809, and / or installed from a removable medium 1811. When the computer program is executed by a processor (CPU) 1801, various functions defined in the system of the present application are executed.
[0203] It should be noted that the computer-readable medium shown in the embodiment of the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (Erasable Programmable Read Only Memory), a flash memory, an optical fiber, a portable compact disk read-only memory (Compact Disc Read-Only Memory, CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a computer-readable computer program is carried. This propagated data signal can take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. A computer program contained on a computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0204] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the devices, methods and computer program products according to various embodiments of the present application. Among them, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and a computer program.
[0205] The units or modules involved in the embodiments described in this application may be implemented by software or hardware, and the units or modules described may also be set in a processor. The names of these units or modules do not, in some cases, constitute limitations on the units or modules themselves.
[0206] Another aspect of the present application also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the above-mentioned raster map acquisition method is implemented. The computer-readable storage medium may be included in the electronic device described in the above embodiment, or may exist independently without being assembled into the electronic device.
[0207] Another aspect of the present application also provides a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor of an electronic device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the electronic device executes the grid map acquisition method as described above in the above embodiments.
[0208] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0209] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application.
[0210] The above content is only a preferred exemplary embodiment of the present application and is not intended to limit the implementation scheme of the present application. A person of ordinary skill in the art can easily make corresponding changes or modifications based on the main concept and spirit of the present application. Therefore, the scope of protection of the present application shall be based on the scope of protection required by the claims.
Claims
1. A method for obtaining a grid map, characterized in that: The method comprises: Acquire point cloud data corresponding to pixel points in the original grid map, and generate a point cloud matrix corresponding to the original grid map based on the point cloud data; Determine a target vector for characterizing the distribution of the point cloud data according to the point cloud matrix, and determine a point cloud transformation matrix based on the target vector; The point cloud data is transformed by the point cloud transformation matrix to obtain target point cloud data, and a target grid map is determined according to the target point cloud data.
2. The method according to claim 1, characterized in that Generating a point cloud matrix corresponding to the original grid map based on the point cloud data includes: Calculate the point cloud center point corresponding to all the point cloud data, and calculate the distance from each point cloud data to the point cloud center point; The point cloud matrix is generated according to the distance from each point cloud data to the center point of the point cloud.
3. The method according to claim 1, characterized in that Determining a target vector for characterizing the distribution of the point cloud data according to the point cloud matrix includes: Performing singular value decomposition on the point cloud matrix to obtain multiple singular values corresponding to the point cloud matrix, The largest singular value is determined from the multiple singular values, and a vector corresponding to the largest singular value is used as the target vector.
4. The method according to claim 1, characterized in that Determining a point cloud transformation matrix based on the target vector includes: Acquire a target abscissa and a target ordinate in the target vector, and determine a rotation angle corresponding to the target vector based on the target abscissa and the target ordinate; A rotation matrix corresponding to the target vector is determined according to the rotation angle, and the point cloud transformation matrix is determined based on the rotation matrix.
5. The method according to claim 4, characterized in that Determining a rotation angle corresponding to the target vector based on the target horizontal coordinate and the target vertical coordinate includes: Determine the quadrant in which the target vector is located based on the target horizontal coordinate and the target vertical coordinate, and determine the rotation angle corresponding to the target vector according to the quadrant in which the target vector is located; The target horizontal coordinate and the target vertical coordinate are brought into the rotation angle determination method to perform angle calculation to determine the rotation angle corresponding to the target vector.
6. The method according to claim 1, characterized in that Each point cloud data includes abscissa, ordinate, height and pixel value; Get the point cloud data corresponding to the pixel points in the original raster map, including: Obtaining the resolution of the original grid map, and determining the pixel row, pixel column, initial horizontal coordinate, initial vertical coordinate and reflectivity corresponding to each pixel point in the original grid map; Determine the horizontal coordinate of the point cloud data corresponding to each pixel point based on the pixel column, the initial horizontal coordinate and the resolution corresponding to each pixel point; Determine the ordinate of the point cloud data corresponding to each pixel point based on the pixel row corresponding to each pixel point, the initial ordinate and the resolution; A fixed height is set, and the fixed height is used as the height of the point cloud data corresponding to each pixel point, and the pixel value of each pixel point is used as the reflectivity of the point cloud data corresponding to each pixel point.
7. The method according to claim 1, characterized in that Determining a target grid map according to the target point cloud data includes: Acquire the horizontal coordinates and the vertical coordinates of all the target point cloud data to determine the minimum horizontal coordinate, the maximum horizontal coordinate, the minimum vertical coordinate and the maximum vertical coordinate of all the target point cloud data; Determine the width and height of the target grid map according to the minimum horizontal coordinate, the maximum horizontal coordinate, the minimum vertical coordinate and the maximum vertical coordinate in all the target point cloud data; The target pixel points are determined according to the target point cloud data to obtain the target grid map.
8. A grid map acquisition device, characterized in that: The grid map acquisition device comprises: An acquisition module, used to acquire point cloud data corresponding to pixel points in an original grid map, and generate a point cloud matrix corresponding to the original grid map based on the point cloud data; A determination module, configured to determine a target vector for characterizing the distribution of the point cloud data according to the point cloud matrix, and determine a point cloud transformation matrix based on the target vector; The transformation module is used to transform the point cloud data through the point cloud transformation matrix to obtain target point cloud data, and determine the target grid map according to the target point cloud data.
9. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the electronic device to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor of an electronic device, the electronic device is caused to execute the method according to any one of claims 1 to 7.