CN115393382A - Method and device for searching voxels in map, computer equipment and storage medium - Google Patents

Method and device for searching voxels in map, computer equipment and storage medium Download PDF

Info

Publication number
CN115393382A
CN115393382A CN202210901348.2A CN202210901348A CN115393382A CN 115393382 A CN115393382 A CN 115393382A CN 202210901348 A CN202210901348 A CN 202210901348A CN 115393382 A CN115393382 A CN 115393382A
Authority
CN
China
Prior art keywords
voxel
current
point
information
map
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210901348.2A
Other languages
Chinese (zh)
Inventor
李四林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Xiaoma Zhixing Technology Co ltd
Original Assignee
Guangzhou Xiaoma Zhixing Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Xiaoma Zhixing Technology Co ltd filed Critical Guangzhou Xiaoma Zhixing Technology Co ltd
Priority to CN202210901348.2A priority Critical patent/CN115393382A/en
Publication of CN115393382A publication Critical patent/CN115393382A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/187Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/66Analysis of geometric attributes of image moments or centre of gravity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10028Range image; Depth image; 3D point clouds

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Geometry (AREA)
  • Image Generation (AREA)

Abstract

The application relates to a voxel searching method, a voxel searching device, computer equipment and a storage medium in a map. The method comprises the following steps: receiving a query request of a neighboring voxel of a point to be queried in a current map sent by a terminal, wherein the current map comprises a plurality of voxels; searching the voxels in each height block according to a nearest neighbor searching algorithm to obtain the pointing information of one or more neighbor voxels corresponding to the point to be queried, wherein each height block is obtained by dividing each voxel in the current map in advance; and sending the pointing information to the terminal. According to the method and the device, each voxel in the current map can be divided into a plurality of height blocks in advance, and the adjacent voxels are searched based on each height block, so that the problem of low searching efficiency caused by searching the whole point cloud map in the traditional technology is solved, and the searching efficiency is improved.

Description

Method and device for searching voxels in map, computer equipment and storage medium
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a method and an apparatus for searching voxels in a map, a computer device, and a storage medium.
Background
The laser radar point cloud map plays an important role in the process of perception and motion planning of autonomous robots (including but not limited to automatic driving vehicles, robots, unmanned aerial vehicles and the like). Various methods for generating a laser point cloud map based on a laser radar exist. In a constructed map, a nearby point or a nearby area near a certain point needs to be searched frequently, and since massive point cloud data are unevenly and sparsely distributed in a wide space, it is difficult to search for the nearby point near the certain point.
In the conventional technical scheme, when a near-neighbor point near a certain point is searched, a whole point cloud map is often searched, so that the searching efficiency is low.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a method, an apparatus, a computer device and a storage medium for searching voxels in a map.
A method of voxel lookup in a map, the method comprising:
receiving a query request of a neighbor voxel of a point to be queried in a current map sent by a terminal;
determining the information of a target height block corresponding to a point to be queried according to the position information of the point to be queried in the query request and map data corresponding to the current map, wherein the map data comprise the information of current voxels to which each point in the current map belongs and the information of height blocks to which each current voxel belongs;
according to the information of the target height block, determining the direction information of a neighbor voxel corresponding to the point to be inquired by adopting a nearest neighbor searching algorithm;
and sending the pointing information to the terminal.
In one embodiment, the map data further includes a voxel parameter of each current voxel, the voxel parameter of each current voxel includes a key value determined according to point cloud data of each point in each current voxel, and the method for searching for a voxel in the map further includes:
acquiring point cloud data of a current frame, and dividing corresponding point cloud into a plurality of newly added voxels according to the point cloud data;
determining voxel parameters of each newly added voxel according to point cloud data of each point in each newly added voxel, wherein the voxel parameters of each newly added voxel comprise key values of each newly added voxel;
sorting the newly added voxels according to a preset rule according to the key values of the newly added voxels to obtain a first voxel sequence;
acquiring a second voxel sequence formed by each current voxel in the current map, wherein the second voxel sequence is generated by sequencing according to the voxel parameters of each current voxel according to a preset rule;
traversing and comparing the key values of each newly added voxel in the first voxel sequence and each current voxel in the second voxel sequence from the head respectively;
sequentially acquiring voxel parameters of voxels with smaller key values in the results of each pair, and storing the voxel parameters into a preset target memory;
and obtaining a new map according to each voxel parameter in the target memory.
In one embodiment, the above method for finding voxels in a map further includes:
dividing a three-dimensional coordinate space where each point of a current map is located to obtain each current voxel;
dividing each current voxel to obtain each height block;
the determining the information of the target height block corresponding to the point to be queried according to the position information of the point to be queried in the query request and the map data corresponding to the current map includes:
determining the information of the current voxel to which the point to be inquired belongs according to the position information of the point to be inquired and the information of the current voxel to which each point in the map data belongs;
determining the information of the height block to which the point to be inquired belongs according to the information of the current voxel to which the point to be inquired belongs and the information of the height block to which each voxel belongs in the map data;
and determining the information of the target height block according to the information of the height block to which the point to be inquired belongs and the information of the adjacent height block.
In one embodiment, the method for searching voxels in a map further includes:
acquiring a sub-voxel sequence corresponding to each height block from the first voxel sequence;
according to the coordinate value of each point in the current voxel corresponding to each height block, creating a corresponding kdtree for the sub-voxel sequence corresponding to each height block;
the determining, according to the information of the target height block, the pointing information of the neighbor voxel corresponding to the point to be queried by using a nearest neighbor search algorithm includes:
and performing K neighborhood search on the kdtree corresponding to the target height block according to a nearest neighbor search algorithm to obtain the pointing information of a nearest neighbor voxel corresponding to the point to be queried.
In one embodiment, the voxel parameter of each of the current voxels further includes a point number, a centroid and a covariance of each voxel, and the voxel parameter of each newly added voxel further includes a point number, a centroid and a covariance of each newly added voxel, and the method for searching for a voxel in the map further includes:
if the comparison result is that the newly added voxel and the current voxel key value are the same, merging the points of the current voxel and the newly added voxel with the same key value to obtain the point of the merged voxel;
merging the current voxels with the same key value and the points and the centroids of the newly added voxels to obtain the centroids of the merged voxels;
combining the points and the covariance of the current voxel and the newly added voxel with the same key value to obtain the covariance of the combined voxel;
and storing the point number, the centroid and the covariance of the combined voxels into a target memory.
In one embodiment, the method for searching voxels in a map further includes:
if the key value of the combined voxel is the same as the key value of the existing voxel in the target memory, combining the voxel parameter of the combined voxel with the voxel parameter of the voxel with the same key value in the target memory, and storing the combined voxel parameter in the target memory.
In one embodiment, the method for searching voxels in a map further includes:
when the size of the new map exceeds a preset threshold value, obtaining voxels to be deleted in the new map;
starting traversing from a first voxel in a new map by using a preset first pointer and a preset second pointer;
if the voxel pointed by the first pointer is a voxel to be deleted, the second pointer is not moved, and the first pointer traverses backwards;
if the voxel pointed by the first pointer is the voxel to be reserved, moving the voxel pointed by the first pointer to the position pointed by the second pointer to replace the voxel pointed by the second pointer, and traversing backwards by the first pointer;
circularly executing the steps of enabling the second pointer to be motionless and enabling the first pointer to traverse backwards if the voxel pointed by the first pointer is the voxel to be deleted, and moving the voxel pointed by the first pointer to the position pointed by the second pointer to replace the voxel originally pointed by the second pointer and enabling the first pointer to traverse backwards if the voxel pointed by the first pointer is the voxel to be reserved;
when the first pointer traverses to the last voxel in the current map, all voxels following the voxel pointed to by the second pointer are deleted.
A device for finding voxels in a map, comprising:
the receiving module is used for receiving a query request of a neighbor voxel of a point to be queried in a current map sent by a terminal;
the determining module is used for determining the information of a target height block corresponding to the point to be inquired according to the position information of the point to be inquired in the inquiry request and the map data corresponding to the current map, wherein the map data comprise the information of the current voxel to which each point in the current map belongs and the information of the height block to which each current voxel belongs;
the searching module is used for determining the direction information of the adjacent voxels corresponding to the point to be inquired by adopting a nearest neighbor searching algorithm according to the information of the target height block;
and the sending module is used for sending the pointing information to the terminal.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
receiving a query request of a neighbor voxel of a point to be queried in a current map sent by a terminal;
determining the information of a target height block corresponding to a point to be queried according to the position information of the point to be queried in the query request and map data corresponding to the current map, wherein the map data comprise the information of the current voxel to which each point in the current map belongs and the information of the height block to which each current voxel belongs;
according to the information of the target height block, determining the direction information of a neighbor voxel corresponding to the point to be inquired by adopting a nearest neighbor searching algorithm;
and sending the pointing information to the terminal.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
receiving a query request of a neighbor voxel of a point to be queried in a current map sent by a terminal;
determining the information of a target height block corresponding to a point to be queried according to the position information of the point to be queried in the query request and map data corresponding to the current map, wherein the map data comprise the information of the current voxel to which each point in the current map belongs and the information of the height block to which each current voxel belongs;
according to the information of the target height block, determining the pointing information of a neighboring voxel corresponding to the point to be queried by adopting a nearest neighbor searching algorithm;
and sending the pointing information to the terminal.
According to the method, the device, the computer equipment and the storage medium for searching the voxels in the map, the current map comprises a plurality of voxels through a query request of the neighboring voxels of a point to be queried in the current map, which is sent by a receiving terminal; searching the voxels in each height block according to a nearest neighbor searching algorithm to obtain the pointing information of one or more neighbor voxels corresponding to the point to be searched, wherein each height block is obtained by dividing each voxel in the current map in advance; and sending the pointing information to the terminal. According to the method and the device, each voxel in the current map can be divided into a plurality of height blocks in advance, and the neighbor voxels are searched based on each height block, so that the problem of low searching efficiency caused by searching the whole point cloud map in the traditional technology is solved, and the searching efficiency is improved.
Drawings
FIG. 1 is a diagram of an exemplary environment in which a method for finding voxels in a map may be implemented;
FIG. 2 is a schematic flow chart illustrating a method for finding voxels in a map according to one embodiment;
FIG. 3 is a flow diagram illustrating updating a current map, according to one embodiment;
fig. 4 is a schematic flowchart of a refining step of determining information of a target height block corresponding to a point to be queried according to location information of the point to be queried in a query request and map data corresponding to a current map in an embodiment;
FIG. 5 is a flow diagram illustrating the creation of a kdtree for each height block in one embodiment;
fig. 6 is a schematic flow chart illustrating merging of a newly added voxel and a current voxel in one embodiment;
FIG. 7 is a diagram illustrating addition of a newly added voxel to a current map in one embodiment;
FIG. 8 is a schematic flow chart illustrating voxel deletion in one embodiment;
FIG. 9 is a block diagram of an apparatus for finding voxels in a map according to an embodiment;
fig. 10 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Referring to fig. 1, fig. 1 is a schematic application environment diagram of a voxel search method in a map according to an exemplary embodiment of the present application. As shown in fig. 1, the application environment includes a server 100 and a terminal 101, and the server 100 and the terminal 101 may be communicatively connected through a network 102 to implement the voxel-in-map search method of the present application.
The server 100 is configured to receive a query request sent by the terminal 101 for a neighboring voxel of a point to be queried in a current map; determining the information of a target height block corresponding to a point to be queried according to the position information of the point to be queried in the query request and map data corresponding to the current map, wherein the map data comprise the information of current voxels to which each point in the current map belongs and the information of height blocks to which each current voxel belongs; according to the information of the target height block, determining the direction information of a neighbor voxel corresponding to the point to be inquired by adopting a nearest neighbor searching algorithm; the pointing information is transmitted to the terminal 101. The server 100 may be implemented as an independent server or a server cluster composed of a plurality of servers.
The terminal 101 is configured to send a query request of a neighboring voxel of a point to be queried in a current map to the server 100, and receive pointing information of the neighboring voxel corresponding to the point to be queried. The terminal 101 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices.
The network 102 is used for network connection between the terminal 101 and the server 100, and in particular, the network 102 may include various types of wired or wireless networks.
In one embodiment, as shown in fig. 2, a voxel searching method in a map is provided, which is described by taking the method as an example applied to the server in fig. 1, and includes the following steps:
s11, receiving a query request of a neighboring voxel of a point to be queried in a current map, which is sent by a terminal. In the present application, the current map may be a point cloud map. The point to be queried may be a point in a current map sent by the terminal. The above-mentioned neighboring voxels may be voxels within a preset range near the point to be queried. The voxel in the application can be a cube unit or a cuboid unit obtained by dividing a three-dimensional coordinate system space where a point in a current map is located. Further, the query request in the present application may carry information of the point to be queried.
And S12, determining the information of the target height block corresponding to the point to be queried according to the position information of the point to be queried in the query request and the map data corresponding to the current map, wherein the map data comprise the information of the current voxel to which each point in the current map belongs and the information of the height block to which each current voxel belongs.
In this application, the position information of the point to be queried may be coordinate value information of the point to be queried. The map data may be data related to each point included in the current map. Specifically, the map data may include coordinate values of each point in the current map, information of a current voxel to which each point belongs, and information of a height block to which each current voxel belongs. Wherein the current voxel is a voxel included in the current map. In the application, a three-dimensional coordinate system space where each point in a map is located is divided to obtain a plurality of current voxels, and each current voxel can be a cuboid or a small cube with length, width and height. A plurality of points may be included in each current voxel. In the present application, the length, width, and height of each current voxel may be set by user customization. For the purpose of acceleration on the computer, the base-2 dimensions, such as 0.125m, 0.25m, and 0.5m, may be used for the length, width, and height of each current voxel. The information of the current voxel may include coordinate value information of the current voxel, the number of included points, and the like.
Furthermore, the method further divides each divided current voxel to obtain each height block. Each height block may include a plurality of voxels therein. For example, when each current voxel is divided, the three-dimensional space coordinate system in which the voxel is located may be obtained by cutting every predetermined distance in the Z-axis direction. The information of the height block may include position information of the height block, identification information of the height block, information of each current voxel included in each height block, and the like.
In the application, the position information of the point to be queried can be matched with the map data, and the information of the target height block matched with the position information of the point to be queried can be obtained according to the affiliation between each point and each current voxel in the map data and the affiliation between each current voxel and each height block.
And S13, determining the direction information of the neighbor voxel corresponding to the point to be inquired by adopting a nearest neighbor searching algorithm according to the information of the target height block.
In this application, the information of the target height block may include information of each current voxel included in the target height block, the information of each current voxel may include coordinate values of each point included in each current voxel and distribution information, and the distribution information may be a covariance of each point included in each current voxel. The nearest search algorithm may establish kdtree for the target height block in advance, and search for a neighboring voxel corresponding to the point to be queried according to the kdtree of the target height block. Among them, kdtree (short for k-dimensional tree) is a data structure for dividing a k-dimensional data space. The method is mainly applied to searching of multidimensional space key data (such as range searching and nearest neighbor searching). Stored in the tree are some K-dimensional data. Constructing a kdtree on a K-dimensional data set represents a partition of the K-dimensional space formed by the K-dimensional data set, that is, each node in the tree corresponds to a K-dimensional hyper-rectangular region.
The above-mentioned pointing information may be information pointing to a storage location of a neighboring voxel corresponding to the point to be queried in the corresponding memory. That is, the data stored in the corresponding memory of the neighboring voxel corresponding to the query point can be obtained through the pointing information.
And S14, sending the pointing information to the terminal.
In a possible application scenario of obtaining the pointing information, a voxel to which a point to be queried belongs and neighboring voxels of the voxel to which the point to be queried belongs may be determined according to information of neighboring voxels of the point to be queried, and further, a position of the point to be queried in a map may be determined.
In another possible application scenario, after determining a voxel to which a point to be queried belongs and neighboring voxels of the voxel to which the point to be queried belongs, ambient environment information of a map in which the point to be queried is located may be determined. For example, when the edge line of the a object is to be determined, the information of the edge line of the a object may be determined by sequentially searching its neighboring points from the points on the edge.
Referring to fig. 3, in an embodiment, the map data may further include a voxel parameter of each current voxel, the voxel parameter of each current voxel includes a key value determined according to point cloud data of each point in each current voxel, and the method for searching for a voxel in the map may further include:
s31, point cloud data of the current frame are obtained, and corresponding point clouds are divided into a plurality of newly added voxels according to the point cloud data;
s32, determining voxel parameters of each newly added voxel according to point cloud data of each point in each newly added voxel, wherein the voxel parameters of each newly added voxel comprise key values of each newly added voxel;
s33, sequencing each newly added voxel according to a preset rule according to the key value of each newly added voxel to obtain a first voxel sequence;
s34, obtaining a second voxel sequence formed by each current voxel in the current map, wherein the second voxel sequence is generated by sequencing according to the voxel parameters of each current voxel according to a preset rule;
s35, traversing from the head and comparing key values of each newly added voxel in the first voxel sequence with key values of each current voxel in the second voxel sequence;
s36, sequentially obtaining voxel parameters of voxels with smaller key values in each pair of results, and storing the voxel parameters into a preset target memory;
and S37, obtaining a new map according to each voxel parameter in the target memory.
In the present application, the voxel parameter is data describing an attribute of each current voxel. The key value of each current voxel may be a unique identifier of the current voxel, and is calculated according to the spatial position of each current voxel. Since the number of all voxels in the local map space is huge, but the number of voxels in which data (useful) exists in practical applications is relatively small and sparsely distributed in space, only the required voxels are stored. It is therefore necessary to use keys to index the current voxels. Similarly, the key value of each newly added voxel is the unique identifier of each newly added voxel and is calculated according to the spatial position of each newly added voxel. The voxel parameter may include other parameters of the voxel besides a key value of the voxel, such as a position of a centroid of the voxel and a number of points included in the voxel.
The current frame is a newly scanned frame of point cloud data, or the current frame is a frame of point cloud data to be newly added to the current map.
In calculating the key value of each new added voxel, X, Y and the Z coordinate shift of each new added voxel can be stored in a 64-bit shaping as a number, which can support the range of 4194 × 16km ^ 3. The specific calculation formula may be as follows:
index=x index |y index <<bit x |z index <<(bits y +bits x )
wherein the content of the first and second substances,
Figure BDA0003770984620000101
index_offset=[1<<(bits_x-1),1<<(bits_y-1),1<<(bits_z-1)]
index is the key (key value) of the voxel, is the unique identification information of the voxel, and is a 64-bit unsigned integer.
x index ,y index And z index Is the voxel's individual coordinate on three coordinate axes (the nth voxel in a certain direction).
bit x ,bit y And bit z The number of bits of the voxel three-axis coordinate occupied in the key value is shown.
index _ offset is a key corresponding to the origin in the map, being the most "middle" key.
The new voxels are sorted according to the key value of each new voxel according to a preset rule to obtain a first voxel sequence, which may be: and sequencing the newly added voxels according to the key values of the newly added voxels from small to large to obtain a first voxel sequence.
The second voxel sequence is generated by sorting the voxel parameters of the current voxels in the descending order of key values.
Traversing from the head and comparing the key values of each newly added voxel in the first voxel sequence with each current voxel in the second voxel sequence; sequentially obtaining voxel parameters of voxels with smaller key values in each pair of results, and storing the voxel parameters into a preset target memory, which may include:
comparing the current voxel in the first voxel sequence with the current voxel in the second voxel sequence, obtaining a voxel parameter of a target voxel with a smaller key value in the current round and storing the voxel parameter into a target memory;
acquiring a next voxel of a voxel sequence where a target voxel is located, and taking the next voxel as a current voxel in the sequence;
comparing the current voxel of the sequence with the current voxel of another sequence to obtain a target voxel with a smaller key value in the current round and storing the target voxel in a target memory;
and obtaining the next voxel of the voxel sequence where the target voxel with smaller key value in the current round is located, taking the next voxel as the current voxel in the sequence, returning to the step of comparing the current voxel of the sequence with the current voxel of another sequence, and obtaining the target voxel with smaller key value in the current round and storing the target voxel in a target memory until the next voxel of the voxel sequence where the target voxel is located is obtained and is the last voxel in the voxel sequence.
In this application, the map data corresponding to the current map may be stored in a preset current memory, and the target memory may be a twin memory space having the same size as the current memory, and is used for updating and maintaining the map. That is, each time there is a new scanning frame, that is, a new voxel needs to be added to the current map, the voxel sequences need to be merged by the target memory, the two sequences are merged into one sequence to be stored in the target memory, and a new map is correspondingly generated according to the target memory. The map updating and maintaining method and the map updating and maintaining device can achieve map updating and maintaining through the implementation mode. Meanwhile, due to the fact that the voxels are arranged in order in the memory space, the efficiency of adding the voxels can be improved when the map is updated, and the efficiency of updating and maintaining the map is improved.
In one embodiment, the method for searching voxels in the map further includes:
dividing a three-dimensional coordinate space where each point of a current map is located to obtain each current voxel;
dividing each current voxel to obtain each height block;
referring to fig. 4, the determining the information of the target height block corresponding to the point to be queried according to the location information of the point to be queried in the query request and the map data corresponding to the current map may include:
s41, determining the information of the current voxel to which the point to be inquired belongs according to the position information of the point to be inquired and the information of the current voxel to which each point in the map data belongs;
s42, determining the information of the height block to which the point to be inquired belongs according to the information of the current voxel to which the point to be inquired belongs and the information of the height block to which each voxel belongs in the map data;
s43, determining the information of the target height block according to the information of the height block to which the point to be inquired belongs and the information of the adjacent height blocks.
In the present application, the map data includes information of each height block, information of each current voxel included in each height block, and information of each point included in each current voxel. The information of each height block may include identification information of each height block, position information of each height block, and the like. The information of each current voxel may include a voxel parameter of each current voxel, and the voxel parameter may include a key value of each current voxel, distribution information of a point in each current voxel, and location information. The information of each point may include position information of each point, and the like. According to the method and the device, the position information of the point to be inquired can be matched with the distribution information and the position information of each point in each current voxel to determine the information of the current voxel to which the point to be inquired belongs.
Further, matching is carried out according to the information of the voxel to which the point to be inquired belongs and the information of each current voxel included in each height block in the map data, so as to determine the information of the height block to which the point to be inquired belongs. The target height block may be a height block to which the point to be queried belongs and/or a height block adjacent to the height block to which the point to be queried belongs. The information of the target height block may be identification information and position information of the target height block.
According to the method and the device, each current voxel in the current map can be divided to obtain each height block, the target height block is determined from each height block, and the voxel is searched from the target height block, so that the condition that the adjacent voxels of the point to be inquired are searched from the whole point cloud map is avoided, and the searching efficiency is improved.
Referring to fig. 5, in an embodiment, the method for searching voxels in a map further includes:
s51, acquiring a sub-voxel sequence corresponding to each height block from the first voxel sequence;
s52, according to the coordinate value of each point in the current voxel corresponding to each height block, creating corresponding kdtree for the sub-voxel sequence corresponding to each height block;
the determining, according to the information of the target height block, the pointing information of the neighbor voxel corresponding to the point to be queried by using a nearest neighbor search algorithm includes:
and performing K neighborhood search on the kdtree corresponding to the target height block according to a nearest neighbor search algorithm to obtain the pointing information of the nearest neighbor voxel corresponding to the point to be queried.
In the present application, each current voxel in the current map is a sequence ordered according to key values in the memory, and each height block is segmented according to the position information of each current voxel, so that each current voxel in each obtained height block is also ordered.
After each height block is obtained through division, a corresponding kdtree is created for each height block. In the step of performing K neighborhood search on the kdtree corresponding to the target height block according to the nearest neighbor search algorithm to obtain the direction information of the nearest neighbor voxel corresponding to the point to be queried, the specific K neighborhood search may include:
(1) And (5) starting the query data Q from the root node, and accessing the Kd-Tree downwards according to the comparison result of Q and each node until the leaf node is reached.
Wherein the comparison of Q to a node refers to comparing Q to m corresponding to a value in k dimension in the node, and if Q (k) < m, then the left sub-tree is visited, otherwise the right sub-tree is visited. And when the distance between the Q and the data stored on the leaf node is reached, calculating the distance between the Q and the data stored on the leaf node, recording a data point corresponding to the minimum distance, and marking as the current 'nearest neighbor' Pcur and the minimum distance Dcur.
(2) A backtracking operation is performed that is to find the "nearest neighbor" that is closer to Q. I.e., to determine if there are more points closer to Q in the branch that have not been visited, the distance between them is less than Dcur.
And (3) if the distance between Q and the unvisited branch under the parent node of Q is less than Dcur, the branch is considered to have data closer to P, the node is entered, the searching process in the step (1) is carried out, if a closer data point is found, the current 'nearest neighbor' Pcur is updated, and Dcur is updated.
If the distance between Q and the unvisited branch under its parent is greater than Dcur, this indicates that there is no point within the branch that is closer to Q.
The backtracking judgment process is carried out from bottom to top until no branch closer to P exists when backtracking to the root node.
According to the method and the device, the whole current map can be divided into the plurality of height blocks, the corresponding kdtree is established for each height block, after the target height block corresponding to the point to be queried is determined, K critical area search is carried out in the target height block only by using the kdtree, the problem of low search efficiency caused by the fact that the kdtree is established on the whole point cloud map in the traditional technology is solved, and the search speed is improved.
Referring to fig. 6, in an embodiment, the voxel parameters of each of the current voxels may further include a point number, a centroid and a covariance of each of the voxels, and the voxel parameters of each of the newly added voxels further include a point number, a centroid and a covariance of each of the newly added voxels, and the method for finding a voxel in the map may further include:
s61, if the comparison result shows that the newly added voxels are the same as the current voxel key values, combining the points of the current voxels and the newly added voxels with the same key values to obtain the points of the combined voxels;
s62, merging the current voxels with the same key values and the points and the centroids of the newly added voxels to obtain the centroids of the merged voxels;
s63, combining the current voxels with the same key values and the points and the covariance of the newly added voxels to obtain the covariance of the combined voxels;
and S64, storing the point number, the center of mass and the covariance of the combined voxel into a target memory.
In the present application, the voxel parameters described above may support user-defined. Specifically, the user may set in advance data included in the topic parameter of each current voxel. In the present application, the preset voxel parameters of each current voxel may include key values, point numbers, position information of a centroid, and covariance. The covariance is a matrix describing the distribution of each point in each current voxel.
Similarly, the voxel parameters of the newly added voxels also include key values, point numbers, position information of the centroid, and covariance. The voxel parameters may be set according to actual requirements, for example, the voxel parameters may also be set to include common geometric feature points (such as points, lines, and planes) and semantic features (such as vegetation, travelable areas, buildings, and the like). The voxel parameters of the present application are stored in a predetermined memory space, such as the target memory and the current memory. And the current memory is used for storing the voxel parameters corresponding to each current voxel corresponding to the current map. The target memory is used for storing voxel parameters of each voxel in a merged sequence of the first voxel sequence and the second voxel sequence when the current map is updated.
Specifically, assuming that a current voxel and a newly added voxel with the same key value are respectively a voxel a and a voxel B, an obtained merged voxel is a voxel C, the number of points in the voxel a is m, the number of points in the voxel B is n, and the number of points in the voxel C is q, if the comparison result is that the newly added voxel and the current voxel have the same key value, the number of points of the current voxel and the newly added voxel with the same key value are merged to obtain the number of points of the merged voxel, and a specific merging formula is as follows:
q=m+n
the point number and the centroid of the current voxel and the newly added voxel with the same key value are combined to obtain the centroid of the combined voxel, and the specific combination formula is as follows:
Figure BDA0003770984620000141
wherein p is new To merge the position information of the centroid of voxel C. n and m are the number of points of voxel A and the number of points of voxel B, p old Is the centroid, p, of old voxels A and B feature The centroid of the voxel C is merged.
The point number and covariance of the current voxel and the newly added voxel with the same key value are combined to obtain the covariance of the combined voxel, and the specific combination formula is as follows:
Figure BDA0003770984620000151
wherein, cov new The covariance of voxel C is merged. n and m are the number of points of voxel A and the number of points of voxel B, p old Is the centroid of old voxels A and B, p feature The centroid of the voxel C is merged. Cov old Cov, covariance of old voxels A and B feature To merge the covariance of voxel C.
Referring to fig. 7, fig. 7 is a schematic diagram illustrating adding a new voxel to a current map according to an embodiment. Fig. 7 includes a second voxel sequence 71, a current voxel 711 in the second voxel sequence, a key value 712 of each current voxel, a first voxel sequence 72, and a voxel sequence 73 obtained after the first voxel sequence is added to the second voxel sequence. The first voxel sequence 72 includes new voxels with key values of 1, 2, 6, 7, 11, and 12, respectively. The second voxel sequence 71 includes current voxels having key values of 1, 2, 3, 4, 5, 6, 7, 8, 9, and 10, respectively. When each newly added voxel in the first voxel sequence is compared with each current voxel in the second voxel sequence, the method may include the following steps:
obtaining a key value 1 of a first voxel in the second voxel sequence 71 and a key value 1 of a first voxel in the first voxel sequence 72, comparing, if the key values are the same, merging voxel parameters of the two voxels, and storing the merged voxel parameters into a target memory;
obtaining a key value 2 of a second voxel in the second voxel sequence 71 and a key value 2 of a second voxel in the first voxel sequence 72, comparing, if the key values are the same, merging voxel parameters of the two voxels, and storing the merged voxel parameters into a target memory;
obtaining a key value 3 of a third voxel in the second voxel sequence 71 and a key value 6 of a third voxel in the first voxel sequence 72, comparing, obtaining a voxel corresponding to 3 with a smaller key value, and storing the voxel in a target memory;
obtaining a key value 4 of a fourth voxel in the second voxel sequence 71 to be compared with a key value 6 of a third voxel in the first voxel sequence 72, obtaining a voxel corresponding to 4 with a smaller key value, and storing the voxel in a target memory;
obtaining a key value 5 of a fifth voxel in the second voxel sequence 71 and a key value 6 of a third voxel in the first voxel sequence 72, comparing, obtaining a voxel corresponding to 5 with a smaller key value, and storing the voxel in a target memory;
and by analogy, the key value of the next voxel is obtained in the voxel sequence with the smaller key value each time, and is compared with the current voxel of the other voxel sequence until the last voxel is compared, and the process is terminated.
Finally, a newly added voxel sequence 73 is obtained, and the specific key value sequences are 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 and 12.
The voxel parameters in the application support user-defined, and the user-defined voxel parameters in the application comprise point number, position information of a mass center and covariance. The voxel parameters are set to be the covariance, the covariance of the voxel is stored in the corresponding memory space, the coordinate values of all points in the voxel do not need to be stored, and the memory space of the memory can be saved. In addition, the method and the device provide a combination scheme of various voxel parameters, provide combination of the voxel parameters, realize that the voxel is newly added into the current map, and realize real-time update of the map.
In one embodiment, the above method for finding voxels in a map may further include:
in the case that the map coordinate system needs to be replaced, the map coordinate system needs to be updated simultaneously with the updating of the centroid and the covariance.
Specifically, when the origin of the coordinate system is replaced, it is required to ensure that the origin of the local map coordinate is close to 0 as much as possible, and at this time, the coordinate system needs to be replaced. The specific formula for the replacement coordinate system is as follows:
Figure BDA0003770984620000161
Figure BDA0003770984620000162
for the transformation of the old coordinates of the map to the new coordinates,
Figure BDA0003770984620000163
for the transformation of the new map to the world coordinate system,
Figure BDA0003770984620000164
is the transformation of the old map to the world coordinate system.
In case of changing coordinate system, the concrete formula of merging the centroids of the corresponding voxels may be as follows:
Figure BDA0003770984620000165
wherein the content of the first and second substances,
Figure BDA0003770984620000166
for transformation of old to new coordinates of a map, p new To merge the position information of the voxel's centroid, p old Position information of the centroid of the old voxels before merging.
In case of changing coordinate system, the specific formula of the combination of covariance of corresponding voxels may be as follows:
Figure BDA0003770984620000171
wherein the content of the first and second substances,
Figure BDA0003770984620000172
and
Figure BDA0003770984620000173
is a 3x3 rotation matrix. Cov new To merge the covariances of voxels, cov old Is the covariance of the old voxels before merging.
Under the condition that the coordinate system needs to be replaced, the method and the device correspondingly provide the combination scheme of the centroid and the covariance, so that the scheme is wider in application range and more flexible.
In one embodiment, the method for searching voxels in the map further includes:
if the key value of the combined voxel is the same as the key value of the existing voxel in the target memory, combining the voxel parameter of the combined voxel with the voxel parameter of the voxel with the same key value in the target memory, and storing the combined voxel parameter in the target memory.
In the present application, when comparing the first voxel sequence with the second voxel sequence, the comparison results of each time are sequentially obtained and stored in the target memory, and the comparison result of each time is the voxel parameter of the voxel with a smaller key value, so that if the current comparison result needs to be stored in the target memory, the comparison result also needs to be compared with the existing voxels in the target memory, and if the key values are found to be the same, the comparison result needs to be merged and then stored. The specific combination logic is the same as that of the centroid, the point number, and the covariance described above.
In one embodiment, the method for searching voxels in the map further includes:
when the size of the new map exceeds a preset threshold value, obtaining voxels to be deleted in the new map;
starting traversing from a first voxel in a new map by using a preset first pointer and a preset second pointer;
if the voxel pointed by the first pointer is a voxel to be deleted, the second pointer is not fixed, and the first pointer traverses backwards;
if the voxel pointed by the first pointer is the voxel to be reserved, moving the voxel pointed by the first pointer to the position pointed by the second pointer to replace the voxel pointed by the second pointer, and traversing backwards by the first pointer;
circularly executing the steps of enabling the second pointer to be motionless and enabling the first pointer to traverse backwards if the voxel pointed by the first pointer is the voxel to be deleted, and moving the voxel pointed by the first pointer to the position pointed by the second pointer to replace the voxel originally pointed by the second pointer and enabling the first pointer to traverse backwards if the voxel pointed by the first pointer is the voxel to be reserved;
when the first pointer traverses to the last voxel in the current map, all voxels after the voxel pointed to by the second pointer are deleted.
Referring to fig. 8, fig. 8 is a schematic flowchart illustrating voxel deletion according to an embodiment. In fig. 8, the above method for searching voxels in a map may further include:
s81, when the size of the new map exceeds a preset threshold value, obtaining voxels to be deleted in the new map;
s82, traversing from a first voxel in the new map by using a preset first pointer and a preset second pointer;
s83, judging whether the voxel pointed by the first pointer is a voxel to be deleted;
s84, if yes, the second pointer is not fixed, and the first pointer traverses backwards;
s85, if not, moving the voxel pointed by the first pointer to the position pointed by the second pointer to replace the voxel pointed by the second pointer, and traversing backwards by the first pointer;
s86, judging whether the voxel pointed by the first pointer is the last voxel;
and S87, if so, ending the process, otherwise, returning to the step of judging whether the voxel pointed by the first pointer is the voxel to be deleted.
In practical applications, the size of the local map needs to be maintained in real time, so that map data outside a certain range is deleted continuously according to the change of the vehicle position, which involves deletion of voxels.
When voxel deletion is performed, the traversal from the original position of the voxel sequence corresponding to the new map can be started by using the double pointers a and B according to a given voxel to be deleted (or a given method for judging whether the voxel needs to be deleted). Specifically, the a and B pointers initially point to the first voxel of the voxel sequence corresponding to the new map, and the specific method may be as follows:
step 1, if the voxel pointed by B is a voxel to be deleted, A is not moved, B + +;
step 2, if the voxel pointed to by B is a voxel to be reserved, moving the voxel pointed to by B to the position pointed to by a to replace the voxel pointed to by a (if a = = B, then the flight is not required), a + +, B + +;
step 3, repeating the step 1 and the step 2 until B traverses the last voxel of the voxel sequence corresponding to the new map;
and 4, deleting all voxels after A.
In the present application, this can be achieved by a multi-layer frame. Specifically, a bottom layer of acceleration merging logic support (framework layer) twin memory, a middle layer of user definition layer and an upper layer of map management layer are provided for searching adjacent voxels.
The framework layer provides support for the storage structure, and the logic definition of the bottom layer voxel combination can call user-defined behaviors.
The middle layer is used to define specific data included in the voxel parameters, such as characteristic point voxels with covariance. Meanwhile, a self-defined combination method is provided, namely the point number, the centroid and the covariance combination scheme.
And the upper layer is used for providing external interfaces such as nearest neighbor searching, map conversion (changing a coordinate system) and the like.
In one embodiment, as shown in fig. 9, there is provided an apparatus for finding voxels in a map, including: a receiving module 11, a determining module 12, a searching module 13 and a sending module 14, wherein:
a receiving module 11, configured to receive a query request sent by a terminal for a neighboring voxel of a point to be queried in a current map;
a determining module 12, configured to determine, according to the position information of the point to be queried in the query request and map data corresponding to the current map, information of a target height block corresponding to the point to be queried, where the map data includes information of a current voxel to which each point in the current map belongs and information of a height block to which each current voxel belongs;
the searching module 13 is configured to determine, according to the information of the target height block, the pointing information of a neighboring voxel corresponding to the point to be queried by using a nearest neighbor searching algorithm;
and a sending module 14, configured to send the pointing information to the terminal.
In one embodiment, the map data further includes voxel parameters of each current voxel, the voxel parameters of each current voxel include key values determined according to point cloud data of each point in each current voxel, the device for searching for voxels in the map further includes a newly added module (not shown), the newly added module can acquire point cloud data of the current frame, divide corresponding point cloud into a plurality of newly added voxels according to the point cloud data, determine voxel parameters of each newly added voxel according to the point cloud data of each point in each newly added voxel, the voxel parameters of each newly added voxel include key values of each newly added voxel, sort each newly added voxel according to a preset rule according to the key values of each newly added voxel to obtain a first voxel sequence, acquire a second voxel sequence formed by each current voxel in the current map, the second voxel sequence is a sequence generated by sorting according to the preset rule according to the voxel parameters of each current voxel, traverse from the head and compare the key values of each newly added voxel in the first voxel sequence with the key values of each current voxel in the second voxel sequence, sequentially acquire memory parameters of each newly added voxel in the results, store the memory parameters of each newly added voxel in the target voxel, and obtain the target voxel parameters of each newly added voxel according to the target voxel in the map.
In one embodiment, the device for searching for a voxel in a map may further include a dividing module (not shown), the dividing module may divide a three-dimensional coordinate space where each point of the current map is located to obtain each current voxel, and divide each current voxel to obtain each height block, the determining module 12 may determine information of the current voxel to which the point to be queried belongs according to the position information of the point to be queried and information of the current voxel to which each point in the map data belongs, determine information of the height block to which the point to be queried belongs according to the information of the current voxel to which the point to be queried belongs and the information of the height block to which each voxel in the map data belongs, and determine information of the target height block according to the information of the height block to which the point to be queried belongs and the information of the adjacent height blocks.
In one embodiment, the device for finding a voxel in a map further includes a creating module (not shown in the figure), where the creating module may obtain a sub-voxel sequence corresponding to each height block from the first voxel sequence, and create a corresponding kdtree for the sub-voxel sequence corresponding to each height block according to a coordinate value of each point in a current voxel corresponding to each height block, and the finding module may perform K neighborhood search on the kdtree corresponding to the target height block according to a nearest neighbor finding algorithm to obtain the pointing information of the neighboring voxel corresponding to the point to be queried.
In one embodiment, the voxel parameters of each of the current voxels further include a point number, a centroid and a covariance of each voxel, the voxel parameters of each newly added voxel further include a point number, a centroid and a covariance of each newly added voxel, the device for searching for a voxel in the map further may further include a first merging module (not shown), the first merging module may merge the current voxel and the newly added voxel having the same key value to obtain a point number of a merged voxel if the comparison result is that the newly added voxel and the current voxel have the same key value, merge the current voxel and the newly added voxel having the same key value to obtain a centroid of the merged voxel, merge the current voxel and the newly added voxel having the same key value to obtain a covariance of the merged voxel according to the point number and the covariance of the current voxel and the newly added voxel having the same key value to obtain a covariance of the merged voxel, and store the point number, the centroid and the covariance of the merged voxel into the target memory.
In one embodiment, the above device for finding a voxel in a map further may further include a second merging module (not shown), where the second merging module may merge a voxel parameter of a merged voxel with the same key value as a voxel parameter of a voxel in the target memory and store the merged voxel parameter in the target memory if the key value of the merged voxel is the same as the key value of the voxel already in the target memory.
In one embodiment, the above apparatus for finding voxels in a map further may further include a deletion module (not shown), where the deletion module may obtain a voxel to be deleted in the new map when the size of the new map exceeds a preset threshold, start traversing from a first voxel in the new map by using a preset first pointer and a preset second pointer, if the voxel pointed by the first pointer is the voxel to be deleted, the second pointer is not fixed, the first pointer traverses backward, if the voxel pointed by the first pointer is the voxel to be retained, the voxel pointed by the first pointer is moved to a position pointed by the second pointer to replace the original voxel pointed by the second pointer, the first pointer traverses backward, if the voxel pointed by the first pointer is the voxel to be deleted, the second pointer moves to the position pointed by the first pointer, and if the voxel pointed by the first pointer is the voxel to be retained, the voxel pointed by the first pointer moves to the second pointer to the position pointed by the second pointer to replace the original voxel pointed by the second pointer, the first pointer traverses backward, and when the voxel pointed by the first pointer is the voxel pointed by the first pointer, the last voxel in the map is moved backward.
In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as shown in fig. 10. The computer device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer equipment is used for storing data such as operation data of the intelligent household equipment. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a resource allocation method of a compiled virtual machine.
In one embodiment, a computer device is provided, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program: receiving a query request of a neighbor voxel of a point to be queried in a current map sent by a terminal; determining the information of a target height block corresponding to a point to be queried according to the position information of the point to be queried in the query request and map data corresponding to the current map, wherein the map data comprise the information of the current voxel to which each point in the current map belongs and the information of the height block to which each current voxel belongs; according to the information of the target height block, determining the direction information of a neighbor voxel corresponding to the point to be inquired by adopting a nearest neighbor searching algorithm; and sending the pointing information to the terminal.
In an embodiment, the map data further includes a voxel parameter of each current voxel, the voxel parameter of each current voxel includes a key value determined according to point cloud data of each point in each current voxel, and the processor when executing the computer program further specifically implements the following steps:
acquiring point cloud data of a current frame, and dividing corresponding point cloud into a plurality of newly added voxels according to the point cloud data;
determining voxel parameters of each newly added voxel according to point cloud data of each point in each newly added voxel, wherein the voxel parameters of each newly added voxel comprise key values of each newly added voxel;
sorting the newly added voxels according to a preset rule according to the key values of the newly added voxels to obtain a first voxel sequence;
acquiring a second voxel sequence formed by each current voxel in the current map, wherein the second voxel sequence is generated by sequencing according to the voxel parameters of each current voxel according to a preset rule;
traversing from the head and comparing the key values of each newly added voxel in the first voxel sequence with each current voxel in the second voxel sequence;
sequentially acquiring voxel parameters of voxels with smaller key values in the results of each pair, and storing the voxel parameters into a preset target memory;
and obtaining a new map according to each voxel parameter in the target memory.
In one embodiment, the processor when executing the computer program further specifically implements the following steps:
dividing a three-dimensional coordinate space where each point of a current map is located to obtain each current voxel;
dividing each current voxel to obtain each height block;
when the processor executes the computer program to realize the step of determining the information of the target height block corresponding to the point to be queried according to the position information of the point to be queried in the query request and the map data corresponding to the current map, the following steps are specifically realized:
determining the information of the current voxel to which the point to be inquired belongs according to the position information of the point to be inquired and the information of the current voxel to which each point in the map data belongs;
determining the information of the height block to which the point to be queried belongs according to the information of the current voxel to which the point to be queried belongs and the information of the height block to which each voxel belongs in the map data;
and determining the information of the target height block according to the information of the height block to which the point to be inquired belongs and the information of the adjacent height block.
In one embodiment, the processor when executing the computer program further specifically implements the following steps:
acquiring a sub-voxel sequence corresponding to each height block from the first voxel sequence;
according to the coordinate value of each point in the current voxel corresponding to each height block, creating a corresponding kdtree for the sub-voxel sequence corresponding to each height block;
when the processor executes a computer program to realize the step of determining the direction information of the neighbor voxel corresponding to the point to be inquired by adopting a nearest neighbor searching algorithm according to the information of the target height block, the following steps are specifically realized:
and performing K neighborhood search on the kdtree corresponding to the target height block according to a nearest neighbor search algorithm to obtain the pointing information of a nearest neighbor voxel corresponding to the point to be queried.
In an embodiment, the voxel parameters of each of the current voxels further include a point number, a centroid and a covariance of each voxel, the voxel parameters of each of the newly added voxels further include a point number, a centroid and a covariance of each newly added voxel, and the processor when executing the computer program further specifically implements the following steps:
if the comparison result is that the newly added voxel and the current voxel key value are the same, merging the points of the current voxel and the newly added voxel with the same key value to obtain the point of the merged voxel;
merging the current voxels with the same key value and the points and the centroids of the newly added voxels to obtain the centroids of the merged voxels;
combining the points and the covariance of the current voxel and the newly added voxel with the same key value to obtain the covariance of the combined voxel;
and storing the point number, the centroid and the covariance of the combined voxels into a target memory.
In one embodiment, the processor when executing the computer program further specifically implements the following steps:
if the key value of the combined voxel is the same as the key value of the existing voxel in the target memory, combining the voxel parameter of the combined voxel with the voxel parameter of the voxel with the same key value in the target memory, and storing the combined voxel parameter in the target memory.
In one embodiment, the processor when executing the computer program further specifically implements the following steps:
when the size of the new map exceeds a preset threshold value, obtaining voxels to be deleted in the new map;
starting traversal from a first voxel in a new map by using a preset first pointer and a preset second pointer;
if the voxel pointed by the first pointer is a voxel to be deleted, the second pointer is not moved, and the first pointer traverses backwards;
if the voxel pointed by the first pointer is the voxel to be reserved, moving the voxel pointed by the first pointer to the position pointed by the second pointer to replace the voxel pointed by the second pointer, and traversing backwards by the first pointer;
circularly executing the steps of enabling the second pointer to be motionless and enabling the first pointer to traverse backwards if the voxel pointed by the first pointer is the voxel to be deleted, and moving the voxel pointed by the first pointer to the position pointed by the second pointer to replace the voxel originally pointed by the second pointer and enabling the first pointer to traverse backwards if the voxel pointed by the first pointer is the voxel to be reserved;
when the first pointer traverses to the last voxel in the current map, all voxels after the voxel pointed to by the second pointer are deleted.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of: receiving a query request of a neighbor voxel of a point to be queried in a current map sent by a terminal; determining the information of a target height block corresponding to a point to be queried according to the position information of the point to be queried in the query request and map data corresponding to the current map, wherein the map data comprise the information of the current voxel to which each point in the current map belongs and the information of the height block to which each current voxel belongs; according to the information of the target height block, determining the direction information of a neighbor voxel corresponding to the point to be inquired by adopting a nearest neighbor searching algorithm; and sending the pointing information to the terminal.
In an embodiment, the map data further includes a voxel parameter of each current voxel, the voxel parameter of each current voxel includes a key value determined according to point cloud data of each point in each current voxel, and the computer program when executed by the processor further specifically implements the following steps:
acquiring point cloud data of a current frame, and dividing corresponding point cloud into a plurality of newly added voxels according to the point cloud data;
determining voxel parameters of each newly added voxel according to point cloud data of each point in each newly added voxel, wherein the voxel parameters of each newly added voxel comprise key values of each newly added voxel;
sorting the newly added voxels according to a preset rule according to the key values of the newly added voxels to obtain a first voxel sequence;
acquiring a second voxel sequence formed by each current voxel in the current map, wherein the second voxel sequence is generated by sequencing according to the voxel parameters of each current voxel according to a preset rule;
traversing and comparing the key values of each newly added voxel in the first voxel sequence and each current voxel in the second voxel sequence from the head respectively;
sequentially obtaining voxel parameters of voxels with smaller key values in the results of each comparison, and storing the voxel parameters into a preset target memory;
and obtaining a new map according to each voxel parameter in the target memory.
In one embodiment, the computer program when executed by the processor further embodies the steps of:
dividing a three-dimensional coordinate space where each point of a current map is located to obtain each current voxel;
dividing each current voxel to obtain each height block;
when the computer program is executed by the processor to realize the step of determining the information of the target height block corresponding to the point to be queried according to the position information of the point to be queried in the query request and the map data corresponding to the current map, the following steps are specifically realized:
determining the information of the current voxel to which the point to be inquired belongs according to the position information of the point to be inquired and the information of the current voxel to which each point in the map data belongs;
determining the information of the height block to which the point to be inquired belongs according to the information of the current voxel to which the point to be inquired belongs and the information of the height block to which each voxel belongs in the map data;
and determining the information of the target height block according to the information of the height block to which the point to be inquired belongs and the information of the adjacent height block.
In one embodiment, the computer program when executed by the processor further embodies the steps of:
acquiring a sub-voxel sequence corresponding to each height block from the first voxel sequence;
according to the coordinate value of each point in the current voxel corresponding to each height block, creating a corresponding kdtree for the sub-voxel sequence corresponding to each height block;
when the computer program is executed by the processor to realize the step of determining the direction information of the neighbor voxel corresponding to the point to be inquired by adopting a nearest neighbor searching algorithm according to the information of the target height block, the following steps are specifically realized:
and performing K neighborhood search on the kdtree corresponding to the target height block according to a nearest neighbor search algorithm to obtain the pointing information of a nearest neighbor voxel corresponding to the point to be queried.
In an embodiment, the voxel parameters of each of the above-mentioned current voxels further include a point number, a centroid and a covariance of each voxel, and the voxel parameters of each of the above-mentioned newly added voxels further include a point number, a centroid and a covariance of each newly added voxel, and when being executed by the processor, the computer program further specifically realizes the following steps:
if the comparison result is that the newly added voxel and the current voxel key value are the same, merging the points of the current voxel and the newly added voxel with the same key value to obtain the point of the merged voxel;
merging the current voxels with the same key value and the points and the centroids of the newly added voxels to obtain the centroids of the merged voxels;
combining the points and the covariance of the current voxel and the newly added voxel with the same key value to obtain the covariance of the combined voxel;
and storing the point number, the centroid and the covariance of the combined voxels into a target memory.
In one embodiment, the computer program when executed by the processor further embodies the steps of:
if the key value of the combined voxel is the same as that of the existing voxel in the target memory, combining the voxel parameter of the combined voxel with the voxel parameter of the voxel with the same key value in the target memory, and storing the voxel parameter into the target memory.
In one embodiment, the computer program when executed by the processor further embodies the steps of:
when the size of the new map exceeds a preset threshold value, obtaining voxels to be deleted in the new map;
starting traversal from a first voxel in a new map by using a preset first pointer and a preset second pointer;
if the voxel pointed by the first pointer is a voxel to be deleted, the second pointer is not fixed, and the first pointer traverses backwards;
if the voxel pointed by the first pointer is the voxel to be reserved, moving the voxel pointed by the first pointer to the position pointed by the second pointer to replace the voxel pointed by the second pointer, and traversing backwards by the first pointer;
circularly executing the steps of keeping the second pointer stationary and traversing backwards the first pointer if the voxel pointed by the first pointer is the voxel to be deleted, and moving the voxel pointed by the first pointer to the position pointed by the second pointer to replace the voxel originally pointed by the second pointer and traversing backwards the first pointer if the voxel pointed by the first pointer is the voxel to be reserved;
when the first pointer traverses to the last voxel in the current map, all voxels after the voxel pointed to by the second pointer are deleted.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware related to instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), rambus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above examples only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method for finding voxels in a map, the method comprising:
receiving a query request of a neighbor voxel of a point to be queried in a current map sent by a terminal;
determining information of a target height block corresponding to the point to be queried according to the position information of the point to be queried in the query request and map data corresponding to the current map, wherein the map data comprise information of current voxels to which each point in the current map belongs and information of height blocks to which each current voxel belongs;
according to the information of the target height block, determining the direction information of a neighbor voxel corresponding to the point to be inquired by adopting a nearest neighbor searching algorithm;
and sending the pointing information to the terminal.
2. The method of claim 1, wherein the map data further includes a voxel parameter for each of the current voxels, the voxel parameter for each of the current voxels including a key value determined from point cloud data for each of the points in each of the current voxels, the method further comprising:
acquiring point cloud data of a current frame, and dividing corresponding point cloud into a plurality of newly added voxels according to the point cloud data;
determining voxel parameters of each newly added voxel according to point cloud data of each point in each newly added voxel, wherein the voxel parameters of each newly added voxel comprise key values of each newly added voxel;
sequencing each newly added voxel according to a preset rule according to the key value of each newly added voxel to obtain a first voxel sequence;
acquiring a second voxel sequence formed by each current voxel in the current map, wherein the second voxel sequence is generated by sequencing according to the voxel parameters of each current voxel according to the preset rule;
respectively traversing from head to and comparing the key values of each newly-added voxel in the first voxel sequence with each current voxel in the second voxel sequence;
sequentially obtaining voxel parameters of voxels with smaller key values in each comparison result, and storing the voxel parameters into a preset target memory;
and obtaining a new map according to each voxel parameter in the target memory.
3. The method of claim 1, further comprising:
dividing a three-dimensional coordinate space where each point of the current map is located to obtain each current voxel;
dividing each current voxel to obtain each height block;
the determining, according to the position information of the point to be queried in the query request and the map data corresponding to the current map, information of a target height block corresponding to the point to be queried, includes:
determining the information of the current voxel to which the point to be inquired belongs according to the position information of the point to be inquired and the information of the current voxel to which each point in the map data belongs;
determining the information of the height block to which the point to be inquired belongs according to the information of the current voxel to which the point to be inquired belongs and the information of the height block to which each voxel belongs in the map data;
and determining the information of the target height block according to the information of the height block to which the point to be inquired belongs and the information of the adjacent height block.
4. The method of claim 2, further comprising:
acquiring a sub-voxel sequence corresponding to each height block from the first voxel sequence;
according to the coordinate value of each point in the current voxel corresponding to each height block, creating a corresponding kdtree for the sub-voxel sequence corresponding to each height block;
the determining, according to the information of the target height block, the pointing information of the neighbor voxel corresponding to the point to be queried by using a nearest neighbor search algorithm includes:
and performing K neighborhood search on the kdtree corresponding to the target height block according to the nearest neighbor search algorithm to obtain the direction information of the nearest neighbor voxel corresponding to the point to be queried.
5. The method of claim 2, wherein the voxel parameters of each of the current voxels further include a point, a centroid, and a covariance of each of the voxels, and the voxel parameters of each of the newly added voxels further include a point, a centroid, and a covariance of each of the newly added voxels, the method further comprising:
if the comparison result is that the key value of the newly added voxel is the same as the key value of the current voxel, combining the points of the current voxel and the newly added voxel with the same key value to obtain the point of the combined voxel;
merging the points and the mass centers of the current voxel and the newly added voxel with the same key value to obtain the mass center of the merged voxel;
combining the points and the covariance of the current voxel and the newly added voxel with the same key value to obtain the covariance of the combined voxel;
and storing the point number, the centroid and the covariance of the combined voxel into the target memory.
6. The method of claim 5, further comprising:
if the key value of the merged voxel is the same as the key value of the existing voxel in the target memory, merging the voxel parameter of the merged voxel with the voxel parameter of the voxel with the same key value in the target memory, and storing the merged voxel parameter in the target memory.
7. The method of claim 2, further comprising:
when the size of the new map exceeds a preset threshold value, obtaining voxels to be deleted in the new map;
starting traversal from a first voxel in the new map by using a preset first pointer and a preset second pointer;
if the voxel pointed by the first pointer is the voxel to be deleted, the second pointer is not moved, and the first pointer traverses backwards;
if the voxel pointed by the first pointer is a voxel to be reserved, moving the voxel pointed by the first pointer to the position pointed by the second pointer to replace the voxel pointed by the second pointer, and traversing backwards by the first pointer;
circularly executing the step of moving the second pointer and traversing backwards the first pointer if the voxel pointed by the first pointer is the voxel to be deleted, and the step of moving the voxel pointed by the first pointer to the position pointed by the second pointer to replace the voxel pointed by the second pointer originally and traversing backwards the first pointer if the voxel pointed by the first pointer is the voxel to be retained;
deleting all voxels after the voxel pointed to by the second pointer when the first pointer traverses to the last voxel in the current map.
8. An apparatus for finding voxels in a map, the apparatus comprising:
the receiving module is used for receiving a query request of a neighbor voxel of a point to be queried in a current map sent by a terminal;
a determining module, configured to determine, according to the position information of the point to be queried in the query request and map data corresponding to the current map, information of a target height block corresponding to the point to be queried, where the map data includes information of current voxels to which each point in the current map belongs and information of height blocks to which each current voxel belongs;
the searching module is used for determining the direction information of the adjacent voxel corresponding to the point to be inquired by adopting a nearest neighbor searching algorithm according to the information of the target height block;
and the sending module is used for sending the pointing information to the terminal.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method of any of claims 1 to 7 are implemented when the computer program is executed by the processor.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202210901348.2A 2022-07-28 2022-07-28 Method and device for searching voxels in map, computer equipment and storage medium Pending CN115393382A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210901348.2A CN115393382A (en) 2022-07-28 2022-07-28 Method and device for searching voxels in map, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210901348.2A CN115393382A (en) 2022-07-28 2022-07-28 Method and device for searching voxels in map, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115393382A true CN115393382A (en) 2022-11-25

Family

ID=84116173

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210901348.2A Pending CN115393382A (en) 2022-07-28 2022-07-28 Method and device for searching voxels in map, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115393382A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116052109A (en) * 2023-03-06 2023-05-02 安徽蔚来智驾科技有限公司 Point cloud characteristic acquisition method, target detection equipment, medium and vehicle

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116052109A (en) * 2023-03-06 2023-05-02 安徽蔚来智驾科技有限公司 Point cloud characteristic acquisition method, target detection equipment, medium and vehicle

Similar Documents

Publication Publication Date Title
Qi et al. Effectively learning spatial indices
US10916333B1 (en) Artificial intelligence system for enhancing data sets used for training machine learning-based classifiers
Najdataei et al. Continuous and parallel lidar point-cloud clustering
CN105138560A (en) Multilevel spatial index technology based distributed space vector data management method
CN111090712A (en) Data processing method, device and equipment and computer storage medium
CN109190052B (en) Spatial indexing method based on social perception in distributed environment
CN115393382A (en) Method and device for searching voxels in map, computer equipment and storage medium
Lee Fast k-nearest neighbor searching in static objects
CN112035586A (en) Spatial range query method based on extensible learning index
Drost et al. Almost constant-time 3D nearest-neighbor lookup using implicit octrees
Kocon et al. Point cloud indexing using Big Data technologies
CN114049463A (en) Binary tree data gridding and grid point data obtaining method and device
Chaves Carniel Defining and designing spatial queries: the role of spatial relationships
CN112395462A (en) Method, device, equipment and storage medium for searching matching subgraph in graph data stream
CN105740371A (en) Density-based incremental clustering data mining method and system
CN113821550B (en) Road network topological graph dividing method, device, equipment and computer program product
Gollub et al. A partitioned approach for efficient graph–based place recognition
CN110909097B (en) Polygonal electronic fence generation method and device, computer equipment and storage medium
CN115708079A (en) Spatial index query method, device, equipment and computer readable storage medium
Huang et al. Processing continuous K-nearest skyline query with uncertainty in spatio-temporal databases
CN110413716B (en) Data storage and data query method and device and electronic equipment
Thiemann et al. An automatic approach for generalization of land-cover data from topographic data
CN114117260A (en) Spatiotemporal trajectory indexing and query processing method, device, equipment and medium
CN110245151B (en) Data point group query method and device, computer equipment and storage medium
KR102202874B1 (en) Method and system for extension of walking network and location database

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination