Disordered point cloud search method and device based on sparse matrix
Through the disordered point cloud search method based on sparse matrix, the problem of inefficient point cloud search in the existing technology is solved, and fast and efficient point cloud search is realized, which is suitable for large-scale point cloud processing.
Patent Information
- Application Number
- CN202510041250.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-10
- Publication Date
- 2025-05-09
- Estimated Expiration
- 2045-01-10
AI Technical Summary
In the prior art, the method of point cloud searching has a high time complexity in creating a tree, and it is necessary to obtain adjacent point clouds to obtain local features, resulting in inefficient search in large-scale point clouds.
The unordered point cloud search method based on sparse matrix is adopted. By constructing a sparse matrix corresponding to the global point cloud, and determining the raster position subscript of each point, the sample pair composed of the subscript of the point and the raster position subscript are stored in the array, and the corresponding relationship between the array subscript and the subscript of the sparse matrix is established to achieve fast point cloud search.
It reduces the complexity of point cloud search, improves search efficiency, and can quickly obtain adjacent point cloud data corresponding to target points, which is suitable for large-scale point cloud processing.
Smart Images

Figure CN119963849A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of point cloud processing, and in particular to a method and device for searching an unordered point cloud based on a sparse matrix. Background Art
[0002] Point cloud is a data set composed of a large number of three-dimensional points, each of which contains coordinate information in space. Point cloud can be applied in many fields and used to perform a variety of tasks, such as terrain analysis, urban planning, autonomous driving and navigation. When completing corresponding tasks based on point cloud, how to quickly realize point cloud search is the key to completing the task.
[0003] At present, the main method of point cloud search is tree search (KD-tree, octree, etc.), but this method has a high time complexity in creating a tree, and needs to obtain adjacent point clouds to obtain local features. Especially when the point cloud is large, there are many points to traverse, and the program takes a long time, which seriously affects the processing efficiency of the task.
[0004] Based on this, there is an urgent need for an unordered point cloud search method and device based on a sparse matrix to solve the above problems. Summary of the invention
[0005] The present invention provides a method and device for searching an unordered point cloud based on a sparse matrix, which has high search efficiency and can quickly obtain corresponding point cloud data. The technical solution is as follows:
[0006] In a first aspect, an embodiment of the present invention provides an unordered point cloud search method based on a sparse matrix, the method comprising:
[0007] Determine the dimensions of the first sparse matrix and the second sparse matrix based on the boundary of the global point cloud and the preset grid size;
[0008] Based on the grid size, determining the position subscript of the spatial grid corresponding to each point in the global point cloud;
[0009] The subscript of each point and the subscript of its corresponding grid position are taken as a data pair, and each data pair is sorted based on the size of the grid position subscript, and each sorted data pair is saved in a preset array in sequence, and each data pair corresponds to an array subscript;
[0010] Based on the grid position subscripts in the array, establishing a correspondence between the subscripts of the array and the subscripts of the first sparse matrix and the second sparse matrix;
[0011] Based on the spatial coordinates of the target point to be queried, determine the target grid position where the target point is located;
[0012] Based on the target grid position, calculating the subscripts of the first sparse matrix and the second sparse matrix corresponding to the target grid;
[0013] Based on the correspondence between the subscripts of the first sparse matrix and the second sparse matrix and the subscript of the array, neighboring point cloud data corresponding to the target point is obtained from the array.
[0014] In a second aspect, an embodiment of the present invention further provides an unordered point cloud search device based on a sparse matrix, the device comprising:
[0015] A first determining unit, configured to determine dimensions of the first sparse matrix and the second sparse matrix based on a boundary of the global point cloud and a preset grid size;
[0016] A second determining unit, configured to determine, based on a grid size, a position subscript of a spatial grid corresponding to each point in the global point cloud;
[0017] A saving unit is used to treat the subscript of each point and the position subscript of its corresponding grid as a data pair, sort each data pair based on the size of the grid position subscript, and save each sorted data pair in a preset array in sequence, each data pair corresponding to an array subscript;
[0018] An establishing unit, configured to establish a correspondence between the subscript of the array and the subscripts of the first sparse matrix and the second sparse matrix based on the grid position subscripts in the array;
[0019] A third determining unit, used to determine the target grid position where the target point is located based on the spatial coordinates of the target point to be queried;
[0020] A calculation unit, used for calculating the subscripts of the first sparse matrix and the second sparse matrix corresponding to the target grid based on the target grid position;
[0021] An acquisition unit is used to acquire neighboring point cloud data corresponding to the target point from the array based on the correspondence between the subscripts of the first sparse matrix and the second sparse matrix and the subscript of the array.
[0022] In a third aspect, an embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method described in any embodiment of this specification is implemented.
[0023] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, enables the computer to execute the method described in any embodiment of this specification.
[0024] In a fifth aspect, an embodiment of the present invention further provides a computer program product, including a computer program, which implements the steps of the method described above when executed by a processor.
[0025] The embodiment of the present invention provides an unordered point cloud search method and device based on a sparse matrix. First, a sparse matrix corresponding to the global point cloud is constructed, and the grid position subscript of each point in the global point cloud is determined. Then, the sample pairs consisting of the subscript of the point and the grid position subscript are stored in an array, and a correspondence between the array subscript and the sparse matrix subscript is established. In this way, after the target point is determined, it is only necessary to calculate the subscripts of the corresponding first sparse matrix and the second sparse matrix based on the target grid position where the target point is located, and the neighboring point cloud data corresponding to the target point can be obtained from the array based on the correspondence between the sparse matrix and the array, thereby realizing a fast search. It can be seen from this that the present application can not only use a 3D grid to represent the point cloud, and use a sparse matrix to reduce storage space, but also reduce the complexity of spatial search and realize a fast search. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0027] Figure 1 It is a flow chart of an unordered point cloud search method based on a sparse matrix provided by an embodiment of the present invention;
[0028] Figure 2 It is a structural diagram of an unordered point cloud search device based on a sparse matrix provided by an embodiment of the present invention;
[0029] Figure 3 It is a hardware architecture diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0031] The specific implementation of the above concept is described below.
[0032] Please refer to Figure 1 , an embodiment of the present invention provides an unordered point cloud search method based on a sparse matrix, the method comprising:
[0033] Step 100, determining the dimensions of the first sparse matrix and the second sparse matrix based on the boundary of the global point cloud and a preset grid size;
[0034] Step 102, based on the grid size, determine the position subscript of the spatial grid corresponding to each point in the global point cloud;
[0035] Step 104, taking the subscript of each point and the position subscript of its corresponding grid as a data pair, and sorting each data pair based on the size of the grid position subscript, and saving each sorted data pair in a preset array in sequence, each data pair corresponding to an array subscript;
[0036] Step 106, based on the grid position subscripts in the array, establish a correspondence between the subscripts of the array and the subscripts of the first sparse matrix and the second sparse matrix;
[0037] Step 108, based on the spatial coordinates of the target point to be queried, determining the target grid position where the target point is located;
[0038] Step 110, based on the target grid position, calculating the subscripts of the first sparse matrix and the second sparse matrix corresponding to the target grid;
[0039] Step 112: based on the correspondence between the subscripts of the first sparse matrix and the second sparse matrix and the subscripts of the array, obtain the neighboring point cloud data corresponding to the target point from the array.
[0040] In this embodiment, a sparse matrix corresponding to the global point cloud is first constructed, and the grid position subscript of each point in the global point cloud is determined. Then, the sample pairs consisting of the subscript of the point and the grid position subscript are stored in an array, and a corresponding relationship between the array subscript and the sparse matrix subscript is established. In this way, after the target point is determined, it is only necessary to calculate the subscripts of the corresponding first sparse matrix and the second sparse matrix based on the target grid position where the target point is located, and the neighboring point cloud data corresponding to the target point can be obtained from the array based on the corresponding relationship between the sparse matrix and the array, thereby realizing a fast search. It can be seen from this that the present application can not only use a 3D grid to represent the point cloud and use a sparse matrix to reduce storage space, but also reduce the complexity of spatial search and realize a fast search.
[0041] Described below Figure 1 How the various steps are performed.
[0042] First, with respect to step 100 , the dimensions of the first sparse matrix and the second sparse matrix are determined based on the boundary of the global point cloud and a preset grid size.
[0043] In this step, first traverse the global point cloud to obtain the minimum and maximum coordinates of the global point cloud in each direction in the three-dimensional space. Here, the minimum and maximum values of the three directions of x, y, and z are set as: Min x ,Min y ,min z ,Max x ,Max y ,Max z .
[0044] Secondly, for each direction, the difference between the maximum coordinate and the minimum coordinate of the global point cloud in that direction is calculated, and the quotient of the difference and the grid length in that direction is rounded upward, and the rounded value is used as the dimension of each sparse matrix in that direction.
[0045] Assume that the dimensions of the sparse matrix in the x, y, and z directions are Dim x 、Dim y 、Dim z , then the calculation formulas for the dimensions in each direction are:
[0046]
[0047] In the formula, vox x 、vox y and vox z are the dimensions of the grid in the x, y, and z directions respectively.
[0048] It should be noted that the preset grid size can be determined according to the range of the global point cloud, and the smaller the grid size, the more accurate the calculation, but the larger the amount of calculation; conversely, the smaller the amount of calculation, the lower the accuracy. This application does not make specific restrictions on the grid size, and users can determine it independently according to their needs.
[0049] For step 102, based on the grid size, determining the position subscript of the spatial grid corresponding to each point in the global point cloud includes:
[0050] For each point in the global point cloud, execute:
[0051] Based on the spatial coordinates (x, y, z) of the point, the following formula is used to calculate the position coordinates (x', y', z') of the grid where the point is located relative to the entire spatial grid:
[0052]
[0053] Based on the position coordinates of the grid where the point is located relative to the entire spatial grid, the position subscript key of the grid where the point is located is calculated using the following formula:
[0054] key=x′+y′*Dimx +z′*Dim x *Dim y
[0055] In the formula, key is the position subscript of the grid where the point is located; x, y, and z are the spatial coordinates of the point; x′, y′, and z′ are the position coordinates of the grid where the point is located relative to the entire spatial grid; floor means rounding down; vox x 、vox y and vox z are the dimensions of the grid in the x, y and z directions respectively; Min x 、Min y and Min z Dim are the minimum coordinates of the global point cloud in the x, y and z directions respectively; x and Dim y are the dimensions of the sparse matrix in the x and y directions respectively.
[0056] In this step, once the global point cloud is determined, the subscript index of each point in the global point cloud and its spatial coordinates (x, y, z) are determined accordingly. Then, the corresponding grid position (x′, y′, z′) can be determined according to the spatial coordinates of the point and the grid size, that is, the number of the current grid in each direction of the entire spatial grid. For example, (x′, y′, z′) = (3, 4, 5), which means that the current grid position is the third in the x direction, the fourth in the y direction, and the fifth in the z direction of the entire spatial grid. Then, the grid position subscript key is calculated based on the grid position to implement grid encoding.
[0057] For step 104, the subscript of each point and its corresponding grid position subscript are taken as a data pair, and each data pair is sorted based on the size of the grid position subscript, and each sorted data pair is saved in a preset array in turn, and each data pair corresponds to an array subscript.
[0058] In this step, (index, key) is taken as a data pair, index represents the subscript of the point, and key represents the position subscript of the corresponding grid. Each data pair is sorted based on the size of the grid position subscript, such as sorting in the order of grid position subscript from small to large, or sorting in the order of grid position subscript from large to small. When the grid position subscripts in multiple data pairs are the same, for each data pair with the same grid position subscript, it can be sorted in the order of the subscripts of the points in the data pairs from small to large, or in the order of the subscripts of the points in the data pairs from large to small, or in the order of appearance of each data pair during the traversal process. For example, several data pairs are (1, 2), (8, 2), (11, 3), (20, 2), (15, 0), (34, 1), then after sorting, they can be (15, 0), (34, 1), (1, 2), (8, 2), (20, 2) and (11, 3). Finally, each sorted data pair is saved in the preset array in turn, so that each data pair corresponds to an array subscript. For example, the data pair (15, 0) corresponds to the array subscript 1, which means that the data pair with the point subscript 15 and the grid position subscript 0 is stored in the first position of the array.
[0059] With respect to step 106 , based on the grid position subscripts in the array, a corresponding relationship between the subscripts of the array and the subscripts of the first sparse matrix and the second sparse matrix is established.
[0060] In some implementations, step 106 is implemented as follows:
[0061] Step A1, traverse each data pair in the array in turn to obtain the grid position index in each data pair;
[0062] Step A2, for multiple identical grid position subscripts, determining their starting subscript and ending subscript in the array;
[0063] Step A3, for a single grid position subscript, use its subscript in the array as both the starting subscript and the ending subscript;
[0064] Step A4, calculating the first sparse matrix subscript and the second sparse matrix subscript corresponding to each grid position subscript; using the calculated position corresponding to the first sparse matrix subscript to store the starting subscript of the corresponding grid position subscript in the array, and using the calculated position corresponding to the second sparse matrix subscript to store the ending subscript of the corresponding grid position subscript in the array;
[0065] Step A5, and so on, until the corresponding relationship between the subscript of the array and the subscripts of the first sparse matrix and the second sparse matrix is obtained.
[0066] For steps A1 to A3, still taking the data pairs (15, 0), (34, 1), (1, 2), (8, 2), (20, 2) and (11, 3) as examples, assume that the above 6 data pairs correspond to array subscripts 1 to 6 respectively. Then the data pair with grid position subscript 0 corresponds to array subscript 1, and the starting subscript and ending subscript of grid position subscript 0 in the array are both 1; since there are 3 data pairs with grid position subscript 2, corresponding to array subscripts 3, 4, and 5 respectively, the starting subscript of grid position subscript 2 in the array is 3 and the ending subscript is 5.
[0067] For steps A4 and A5, the following formula is used to calculate the first sparse matrix subscript and the second sparse matrix subscript corresponding to each grid position subscript key (index x , indexy):
[0068]
[0069] In the formula, the index of the sparse matrix x , index y ) represents the index of the sparse matrix x row, index y Column; key is the grid position subscript; Dim x and Dim y The dimensions of the sparse matrix in the x and y directions respectively; key%Dim x Indicates the remainder.
[0070] Assuming that vecUtil is used to represent the array, start idx Indicates the starting subscript of the array, end idx Indicates the end subscript of the array. startIndexSP represents the first sparse matrix (used to store the starting position of the points in the small grid in vecUtil), and endIndexSp represents the second sparse matrix endIndexSp (used to store the ending position of the points in the small grid in vecUtil). Then there is the following corresponding relationship:
[0071]
[0072] From the above formula, we can see that: in the first sparse matrix tartIndexSP, the index x row, index y The column stores the array subscript start idx , in the index of the second sparse matrix endIndexSp x row, index y The column stores the array subscript end idx .
[0073] With respect to step 108 , based on the spatial coordinates of the target point to be queried, the target grid position where the target point is located is determined.
[0074] In this step, based on the spatial coordinates of the target point, the target grid position of the target point is obtained by using the following formula:
[0075]
[0076] For step 110, based on the target grid position, the following formula is used to calculate the subscripts of the first sparse matrix and the second sparse matrix corresponding to the target grid:
[0077]
[0078] In the formula, the subscript of the sparse matrix (idx x , idx y ) represents the idxth of the sparse matrix x row, idx y Column; x′, y′, z′ are the position coordinates of the target grid respectively; Dim y is the dimension of the sparse matrix in the y direction.
[0079] For step 112, since there is a corresponding relationship between the sparse matrix subscript and the starting subscript and the ending subscript of the array, after determining the subscript of the first sparse matrix and the subscript of the second sparse matrix, the starting subscript and the ending subscript of the array corresponding to the target point can be determined, such as:
[0080]
[0081] Then, all data pairs from the start to the end position are obtained from the array vecUtil, and all points in the data pairs are used as the neighboring point cloud data corresponding to the target point, thereby completing the point cloud search.
[0082] By adopting the above steps, this application can quickly complete the point cloud search, and the complexity of the point cloud space search is O(1). In addition, the point cloud is represented by a 3D grid, and the storage space can be reduced by using a sparse matrix. Finally, this method is the basic method of point cloud processing and is applicable to all unordered point cloud processing algorithms.
[0083] like Figure 2 , Figure 3 As shown, an embodiment of the present invention provides an unordered point cloud search device based on a sparse matrix. The device embodiment can be implemented by software, or by hardware or a combination of software and hardware. From the hardware level, Figure 2As shown in FIG. 1 , a hardware architecture diagram of a computing device in which a sparse matrix-based disordered point cloud search device is provided in an embodiment of the present invention is provided. Figure 2 In addition to the processor, memory, network interface, and non-volatile memory shown in the figure, the computing device in which the device is located in the embodiment may also generally include other hardware, such as a forwarding chip responsible for processing messages, etc. Taking software implementation as an example, Figure 3 As shown, as a device in a logical sense, the CPU of the computing device in which it is located reads the corresponding computer program in the non-volatile memory into the internal memory and runs it.
[0084] Please refer to Figure 3 , an embodiment of the present invention provides an unordered point cloud search device based on a sparse matrix, the device comprising:
[0085] A first determining unit, configured to determine dimensions of the first sparse matrix and the second sparse matrix based on a boundary of the global point cloud and a preset grid size;
[0086] A second determining unit is used to determine the position subscript of the spatial grid corresponding to each point in the global point cloud based on the grid size;
[0087] A saving unit is used to treat the subscript of each point and the position subscript of its corresponding grid as a data pair, sort each data pair based on the size of the grid position subscript, and save each sorted data pair in a preset array in sequence, each data pair corresponding to an array subscript;
[0088] An establishing unit, used for establishing a corresponding relationship between the subscript of the array and the subscripts of the first sparse matrix and the second sparse matrix based on the grid position subscripts in the array;
[0089] A third determining unit, used to determine the target grid position where the target point is located based on the spatial coordinates of the target point to be queried;
[0090] A calculation unit, used for calculating the subscripts of the first sparse matrix and the second sparse matrix corresponding to the target grid based on the target grid position;
[0091] The acquisition unit is used to acquire the neighboring point cloud data corresponding to the target point from the array based on the corresponding relationship between the subscripts of the first sparse matrix and the second sparse matrix and the subscript of the array.
[0092] In some implementations, the first determining unit 300 is configured to perform the following operations:
[0093] Traverse the global point cloud to obtain the minimum and maximum coordinates of the global point cloud in all directions in three-dimensional space;
[0094] For each direction, the difference between the maximum coordinate and the minimum coordinate of the global point cloud in that direction is calculated, and the quotient of the difference and the grid length in that direction is rounded upward, and the rounded value is used as the dimension of each sparse matrix in that direction.
[0095] In some implementations, the second determining unit 302 is configured to perform the following operations:
[0096] For each point in the global point cloud, execute:
[0097] Based on the spatial coordinates (x, y, z) of the point, the following formula is used to calculate the position coordinates (x', y', z') of the grid where the point is located relative to the entire spatial grid:
[0098]
[0099] Based on the position coordinates of the grid where the point is located relative to the entire spatial grid, the position subscript key of the grid where the point is located is calculated using the following formula:
[0100] key=x′+y′*Dim x +z′*Dim x *Dim v
[0101] In the formula, key is the position subscript of the grid where the point is located; x, y, and z are the spatial coordinates of the point; x′, y′, and z′ are the position coordinates of the grid where the point is located relative to the entire spatial grid; floor means rounding down; vox x 、vox y and vox z are the dimensions of the grid in the x, y and z directions respectively; Min x 、Min y and Min z Dim are the minimum coordinates of the global point cloud in the x, y and z directions respectively; x and Dim y are the dimensions of the sparse matrix in the x and y directions respectively.
[0102] In some implementations, the establishing unit 306 is configured to perform the following operations:
[0103] Traverse each data pair in the array in turn to obtain the grid position subscript in each data pair;
[0104] For multiple identical grid position subscripts, determine their starting subscript and ending subscript in the array;
[0105] For a single grid position subscript, its subscript in the array is used as both the starting subscript and the ending subscript;
[0106] Calculate the first sparse matrix subscript and the second sparse matrix subscript corresponding to each grid position subscript; use the calculated position corresponding to the first sparse matrix subscript to store the starting subscript of the corresponding grid position subscript in the array, and use the calculated position corresponding to the second sparse matrix subscript to store the ending subscript of the corresponding grid position subscript in the array;
[0107] And so on, until the corresponding relationship between the subscript of the array and the subscripts of the first sparse matrix and the second sparse matrix is obtained.
[0108] In some embodiments, the following formula is used to calculate the first sparse matrix subscript and the second sparse matrix subscript corresponding to each grid position subscript key (index x , index y ):
[0109]
[0110] In the formula, the index of the sparse matrix x , index y ) represents the index of the sparse matrix x row, index y Column; key is the grid position subscript; Dim x and Dim y The dimensions of the sparse matrix in the x and y directions respectively; key%Dim x Indicates the remainder.
[0111] In some implementations, based on the target grid position, the following formula is used to calculate the subscripts of the first sparse matrix and the second sparse matrix corresponding to the target grid:
[0112]
[0113] In the formula, the subscript of the sparse matrix (idx x , idx y ) represents the idxth of the sparse matrix x row, idx y Column; x′, y′, z′ are the position coordinates of the target grid respectively; Dim y is the dimension of the sparse matrix in the y direction.
[0114] In some implementations, the acquisition unit 312 is configured to perform the following operations:
[0115] Determine the starting subscript of the array based on the corresponding relationship between the subscript of the first sparse matrix and the subscript of the array;
[0116] Determine the end subscript of the array based on the correspondence between the subscript of the second sparse matrix and the subscript of the array;
[0117] The starting subscript, the ending subscript, and the points in the data pairs between the starting subscript and the ending subscript of the array are used as the neighboring point cloud data corresponding to the target point.
[0118] It should be noted that the unordered point cloud search device based on a sparse matrix provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the unordered point cloud search device based on a sparse matrix provided in the above embodiment and the unordered point cloud search method embodiment based on a sparse matrix belong to the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0119] The embodiment of the present application also provides a computer device, please refer to Figure 3 The computer device includes a processor and a memory, in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, at least one program, a code set or an instruction set is loaded and executed by the processor to implement the sparse matrix-based unordered point cloud search method provided by the above-mentioned method embodiments.
[0120] An embodiment of the present application also provides a computer-readable storage medium, on which is stored at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded and executed by a processor to implement the sparse matrix-based unordered point cloud search method provided in the above-mentioned method embodiments.
[0121] An embodiment of the present application also provides a computer program product, which includes a computer program. A processor of a computer device reads the computer program from a computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the sparse matrix-based unordered point cloud search method described in any of the above embodiments.
[0122] For the convenience of description, the above system or device is described by dividing it into various modules or units according to its functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0123] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.
[0124] Finally, it should be noted that, in this article, relational terms such as first, second, third and fourth are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0125] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A sparse matrix-based unordered point cloud search method, characterized in that: The method comprises: Determine the dimensions of the first sparse matrix and the second sparse matrix based on the boundary of the global point cloud and the preset grid size; Based on the grid size, determining the position subscript of the spatial grid corresponding to each point in the global point cloud; The subscript of each point and the subscript of its corresponding grid position are taken as a data pair, and each data pair is sorted based on the size of the grid position subscript, and each sorted data pair is saved in a preset array in sequence, and each data pair corresponds to an array subscript; Based on the grid position subscripts in the array, establishing a correspondence between the subscripts of the array and the subscripts of the first sparse matrix and the second sparse matrix; Based on the spatial coordinates of the target point to be queried, determine the target grid position where the target point is located; Based on the target grid position, calculating the subscripts of the first sparse matrix and the second sparse matrix corresponding to the target grid; Based on the correspondence between the subscripts of the first sparse matrix and the second sparse matrix and the subscript of the array, neighboring point cloud data corresponding to the target point is obtained from the array.
2. The method according to claim 1, characterized in that The determining the dimensions of the first sparse matrix and the second sparse matrix based on the boundary of the global point cloud and the preset grid size includes: Traversing the global point cloud to obtain the minimum coordinate and the maximum coordinate of the global point cloud in each direction in the three-dimensional space; For each direction, the difference between the maximum coordinate and the minimum coordinate of the global point cloud in that direction is calculated, and the quotient of the difference and the grid length in that direction is rounded upward, and the rounded value is used as the dimension of each sparse matrix in that direction.
3. The method according to claim 1, characterized in that The step of determining the position subscript of the spatial grid corresponding to each point in the global point cloud based on the grid size includes: For each point in the global point cloud, execute: Based on the spatial coordinates (x, y, z) of the point, the following formula is used to calculate the position coordinates (x ′ ,y ′ , z ′ ): Based on the position coordinates of the grid where the point is located relative to the entire spatial grid, the position subscript key of the grid where the point is located is calculated using the following formula: key=x′+y′*Dim x +z′*Dim x *Dim y In the formula, key is the position subscript of the grid where the point is located; x, y, and z are the spatial coordinates of the point; x′, y′, and z′ are the position coordinates of the grid where the point is located relative to the entire spatial grid; floor means rounding down; vox x 、vox y and vox z are the dimensions of the grid in the x, y and z directions respectively; Min x 、Min y and Min z Dim are the minimum coordinates of the global point cloud in the x, y and z directions respectively; x and Dim y are the dimensions of the sparse matrix in the x and y directions respectively.
4. The method according to claim 1, characterized in that: The step of establishing a correspondence between the subscript of the array and the subscripts of the first sparse matrix and the second sparse matrix based on the grid position subscript in the array includes: Traversing each data pair in the array in turn to obtain the grid position subscript in each data pair; For multiple identical grid position subscripts, determine their starting subscript and ending subscript in the array; For a single grid position subscript, use its subscript in the array as both the starting subscript and the ending subscript; Calculate the first sparse matrix subscript and the second sparse matrix subscript corresponding to each grid position subscript; use the calculated position corresponding to the first sparse matrix subscript to store the starting subscript of the corresponding grid position subscript in the array, and use the calculated position corresponding to the second sparse matrix subscript to store the ending subscript of the corresponding grid position subscript in the array; And so on, until the corresponding relationship between the subscript of the array and the subscript of the first sparse matrix and the second sparse matrix is obtained.
5. The method according to claim 4, characterized in that The following formula is used to calculate the first sparse matrix subscript and the second sparse matrix subscript corresponding to each grid position subscript key (index x , index y ): In the formula, the index of the sparse matrix x , index y ) represents the index of the sparse matrix x row, index y Column; key is the grid position subscript; Dim x and Dim y The dimensions of the sparse matrix in the x and y directions respectively; key%Dim x Indicates the remainder.
6. The method according to claim 1, characterized in that Based on the target grid position, the following formula is used to calculate the subscripts of the first sparse matrix and the second sparse matrix corresponding to the target grid: In the formula, the subscript of the sparse matrix (idx x , idx y ) represents the idxth of the sparse matrix x row, idx y Column; x′, y′, z′ are the position coordinates of the target grid respectively; Dim y is the dimension of the sparse matrix in the y direction.
7. The method according to claim 4, characterized in that The acquiring, from the array, neighboring point cloud data corresponding to the target point based on the correspondence between the subscripts of the first sparse matrix and the second sparse matrix and the subscript of the array comprises: Determine a starting subscript of the array based on a correspondence between the subscripts of the first sparse matrix and the subscripts of the array; Determine the end subscript of the array based on the correspondence between the subscript of the second sparse matrix and the subscript of the array; The starting subscript, the ending subscript, and the points in the data pairs between the starting subscript and the ending subscript of the array are used as the neighboring point cloud data corresponding to the target point.
8. A sparse matrix-based unordered point cloud search device, characterized in that: The device comprises: A first determining unit, configured to determine dimensions of the first sparse matrix and the second sparse matrix based on a boundary of the global point cloud and a preset grid size; A second determining unit, configured to determine, based on a grid size, a position subscript of a spatial grid corresponding to each point in the global point cloud; A saving unit is used to treat the subscript of each point and the position subscript of its corresponding grid as a data pair, sort each data pair based on the size of the grid position subscript, and save each sorted data pair in a preset array in sequence, each data pair corresponding to an array subscript; An establishing unit, configured to establish a correspondence between the subscript of the array and the subscripts of the first sparse matrix and the second sparse matrix based on the grid position subscripts in the array; A third determining unit, used to determine the target grid position where the target point is located based on the spatial coordinates of the target point to be queried; A calculation unit, used for calculating the subscripts of the first sparse matrix and the second sparse matrix corresponding to the target grid based on the target grid position; An acquisition unit is used to acquire neighboring point cloud data corresponding to the target point from the array based on the correspondence between the subscripts of the first sparse matrix and the second sparse matrix and the subscript of the array.
9. A computing device, comprising a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Point cloud searching method and device and terminal equipment
CN116681767A
Method and device for searching nearest neighbor point cloud in massive point cloud data scene
CN118193586A
Method and device for constructing spatial index of massive point cloud data
US20180081034A1
Point cloud data processing method, point cloud data processing system, and computer storage medium
WO2024230436A1