Laser point cloud background difference method and system

By performing Morton coding and reordering on the point cloud, the problem of low efficiency in background subtraction of LiDAR point clouds is solved, the efficiency of neighbor point search and the speed of background subtraction are improved, and it is suitable for embedded devices.

CN120931691AActive Publication Date: 2025-11-11ZHEJIANG AIRPORT DIGITAL TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511454578.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-13
Publication Date
2025-11-11
Estimated Expiration
2045-10-13

AI Technical Summary

Technical Problem

In existing technologies, the background subtraction method for LiDAR point clouds suffers from low efficiency and high storage overhead, especially on embedded devices, which limits the real-time performance of the algorithm.

Method used

By reordering the point cloud after performing Morton encoding, spatially adjacent points in the point cloud are also as adjacent as possible in memory, reducing the time for subsequent neighbor point lookup and background difference. The sorting and difference processing are performed using grid partitioning and Morton index calculation, combined with parallel computing devices.

Benefits of technology

It improves the efficiency of nearest neighbor search, enhances the accuracy and speed of background subtraction, reduces storage overhead, and is suitable for embedded devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120931691A_ABST
    Figure CN120931691A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a laser point cloud background differencing method and system, and the method comprises the steps: obtaining a current frame point cloud; preprocessing the point cloud of the current frame according to the scene prior information to obtain a processed point cloud; performing grid division on the processing point cloud according to a preset grid side length, and calculating a grid coordinate of a grid corresponding to each point in the processing point cloud; performing Morton index calculation according to the grid coordinates and a preset rule to obtain a first index value corresponding to each point; sorting all points in the processing point cloud according to the first index value to obtain a first sorted point cloud; and traversing each point in the first sorted point cloud, searching adjacent points in the second sorted point cloud according to a preset search radius, and determining background points according to the number of the adjacent points. And the background difference efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of point cloud processing, and more particularly to a laser point cloud background subtraction method and system. Background Technology

[0002] Laser point cloud background subtraction technology constructs a baseline point cloud of a static scene and compares it in real time with the current frame data to eliminate fixed environmental point clouds, thereby retaining dynamic targets or newly added objects. Background subtraction can filter out a large amount of redundant data, greatly improving the processing efficiency of subsequent steps such as clustering, and helps reduce noise interference with target recognition, which is of great significance for boundary intrusion detection. However, LiDAR can generate hundreds of thousands of points per second, and the massive amount of input data can seriously affect the real-time performance of the algorithm.

[0003] Currently, the industry typically uses the KDTree data structure for background subtraction. This method suffers from double latency, as both tree structure construction and nearest neighbor search require significant time. Furthermore, KDTree requires pre-storing a large amount of spatial structure information to accelerate retrieval, resulting in storage overhead several times that of the original point cloud. This can lead to crashes on embedded devices due to insufficient memory.

[0004] There is currently no effective solution to the above problems in existing technologies. Summary of the Invention

[0005] To address the aforementioned issues, this invention provides a laser point cloud background subtraction method and system. By performing Morton coding on each point in the point cloud and then reordering them, spatially adjacent points in the point cloud are made as adjacent as possible in memory, reducing the time for subsequent neighbor point lookup and background subtraction, thereby solving the problem of low background subtraction efficiency in the prior art.

[0006] To achieve the above objectives, the present invention provides a laser point cloud background subtraction method, comprising: acquiring a current frame point cloud; preprocessing the current frame point cloud according to scene prior information to obtain a processed point cloud; dividing the processed point cloud into grids according to a preset grid side length, and calculating the grid coordinates of each point in the processed point cloud corresponding to the grid; wherein, the preset grid side length is a preset search radius; calculating the Morton index according to the grid coordinates according to a preset rule to obtain a first index value corresponding to each point; sorting all points in the processed point cloud according to the first index value to obtain a first sorted point cloud; traversing each point in the first sorted point cloud, searching for neighboring points in the second sorted point cloud according to the preset search radius, and determining background points according to the number of neighboring points; wherein, the second sorted point cloud is a sorted point cloud obtained in advance based on the background point cloud, and the step of obtaining the second sorted point cloud from the background point cloud is consistent with the step of obtaining the first sorted point cloud from the current frame point cloud.

[0007] Optionally, the step of calculating the Morton index according to the grid coordinates according to a preset rule to obtain the first index value corresponding to each point includes: for any point in the processed point cloud, according to the preset rule, shifting the x-coordinate of the grid coordinates to which the point belongs, performing a bitwise OR operation between the shifted coordinate and the original coordinate, and performing a bitwise AND operation between the bitwise OR operation and the mask to obtain the x-direction index value; according to the preset rule, shifting the y-coordinate of the grid coordinates to which the point belongs, performing a bitwise OR operation between the shifted coordinate and the original coordinate, and performing a bitwise AND operation between the bitwise OR operation and the mask to obtain the y-direction index value; according to the preset rule, shifting the z-coordinate of the grid coordinates to which the point belongs, performing a bitwise OR operation between the shifted coordinate and the original coordinate, and performing a bitwise AND operation between the bitwise OR operation and the mask to obtain the z-direction index value; and combining the shift and bitwise OR operations of the x-direction index value, y-direction index value, and z-direction index value to obtain the first index value of the point.

[0008] Optionally, the step of sorting all points in the processed point cloud according to the first index value to obtain a first sorted point cloud includes: forming an index pair between the first index value corresponding to each point and its original sequence number, and arranging them in ascending order according to the original sequence number to obtain sorted input data; dividing the sorted input data into multiple data segments, and assigning each data segment to a computing core for processing; dividing each data segment into multiple slices, and sequentially performing an input task, a sorting task, and an output task on each slice; wherein different tasks between different slices are processed in parallel; merging the sorting results of each slice to obtain a data segment sorting result, and then merging the sorting results of each data segment to obtain the first sorted point cloud.

[0009] Optionally, the step of traversing each point in the first sorted point cloud and searching for neighboring points in the second sorted point cloud according to the preset search radius, and determining background points based on the number of neighboring points, includes: dividing the corresponding grid of each point in the first and second sorted point clouds into layers according to the difference in the last digit of the index value; for the current point in the first sorted point cloud, finding the point in the second sorted point cloud whose second index value is closest to the first index value of the current point, and using that point as the search starting point; judging layer by layer from low to high whether the grid corresponding to the current point is the boundary grid of the current layer, if so, judging the boundary grid of the next higher layer; otherwise, recording the current layer as the target layer; when the target layer is less than the preset number of layers, starting from the search starting point, sequentially searching for the number of neighboring points in the positive and negative directions of the second sorted point cloud, if the number of neighboring points reaches the preset number... If a preset threshold is reached, the current point is determined to be a background point. If the number of neighboring points still does not reach the preset threshold by the end of the negative direction search, the current point is determined to be a foreground point. When the search point and the current point's grid are not on the same layer, the search in either direction ends. When the target layer is greater than or equal to a preset layer number, neighboring points are searched in the eight grids surrounding the grid corresponding to the search starting point, starting from the search starting point, in both the positive and negative directions of the second sorted point cloud. The total number of neighboring points is counted. If the total number is greater than the preset threshold, the current point is determined to be a background point. For remaining points whose status cannot be determined, a KDTree is constructed for all points in the adjacent grids of the grid corresponding to the search starting point, and a radius search is performed on the remaining points. When the number of neighboring points found is greater than or equal to the preset threshold, the remaining point is determined to be a background point; otherwise, it is a foreground point.

[0010] Further optionally, the step of preprocessing the current frame point cloud based on scene prior information to obtain a processed point cloud includes: performing pass-through filtering on the current frame point cloud according to the defense zone range; performing ground fitting; and removing points below the ground in the current frame point cloud based on the fitting result.

[0011] On the other hand, the present invention also provides a laser point cloud background difference system, comprising: a preprocessing module for acquiring a current frame point cloud; preprocessing the current frame point cloud according to scene prior information to obtain a processed point cloud; a grid division module for dividing the processed point cloud into grids according to a preset grid side length, and calculating the grid coordinates of each point in the processed point cloud corresponding to the grid; wherein the preset grid side length is a preset search radius; an index calculation module for calculating the Morton index according to the grid coordinates according to a preset rule to obtain a first index value corresponding to each point; a sorting module for sorting all points in the processed point cloud according to the first index value to obtain a first sorted point cloud; and a difference module for traversing each point in the first sorted point cloud, searching for neighboring points in the second sorted point cloud according to the preset search radius, and determining background points according to the number of neighboring points; wherein the second sorted point cloud is a sorted point cloud obtained in advance based on the background point cloud, and the step of obtaining the second sorted point cloud based on the background point cloud is the same as the step of obtaining the first sorted point cloud based on the current frame point cloud.

[0012] Further optionally, the index calculation includes: a first index value calculation submodule, used to, for any point in the processed point cloud, perform a shift operation on the x-coordinate of the raster coordinates to which the point belongs, a bitwise OR operation between the shifted coordinate and the original coordinate, and a bitwise AND operation between the bitwise OR operation coordinate and the mask, according to the preset rules, to obtain an x-direction index value; and a second index value calculation submodule, used to, according to the preset rules, perform a shift operation on the y-coordinate of the raster coordinates to which the point belongs, a bitwise OR operation between the shifted coordinate and the original coordinate. The first index module is used to perform a bitwise OR operation on the x-axis index value, y-axis index value, and z-axis index value, and then perform a bitwise OR operation on the coordinates and the mask to obtain the y-axis index value. The second index module is used to perform a bitwise OR operation on the z-axis coordinates of the grid coordinates to which the point belongs, and then perform a bitwise OR operation on the coordinates and the mask to obtain the z-axis index value. The third index module is used to perform a bitwise OR operation on the z-axis coordinates of the grid coordinates to obtain the z-axis index value. The fourth index module is used to perform a bitwise OR operation on the x-axis index value, y-axis index value, and z-axis index value to obtain the first index value of the point.

[0013] Further optionally, the sorting module includes: an index pair calculation submodule, used to form an index pair with the first index value corresponding to each point and its original sequence number, and arrange them in ascending order according to the original sequence number to obtain sorted input data; a data allocation submodule, used to divide the sorted input data into multiple data segments, and allocate each data segment to a computing core for processing; a slice sorting submodule, used to divide each data segment into multiple slices, and perform an import task, a sorting task, and an export task on each slice in sequence; wherein, different tasks between different slices are processed in parallel; and a merging submodule, used to merge the sorting results of each slice to obtain a data segment sorting result, and then merge the sorting results of each data segment to obtain a first sorted point cloud.

[0014] Further optionally, the difference module includes: a raster layering submodule, used to perform layer division on the raster corresponding to each point in the first sorted point cloud and the second sorted point cloud according to the difference in the last digits of the index values; a search start point determination submodule, used to, for the current point in the first sorted point cloud, find the point in the second sorted point cloud whose second index value is closest to the first index value of the current point, and take that point as the search start point; a target layer determination submodule, used to determine layer by layer from low to high whether the raster corresponding to the current point is the boundary raster of the current layer, and if so, to determine the boundary raster of the next higher layer; otherwise, to record the current layer as the target layer; and a first determination submodule, used to, when the target layer is less than a preset number of layers, start from the search start point and sequentially search for the number of neighboring points in the positive and negative directions of the second sorted point cloud, and if the number of neighboring points reaches a preset number threshold, then determine the current point as the target layer. If the number of neighboring points does not reach a preset threshold by the end of the negative direction search, the current point is determined to be a foreground point. When the search point and the current point's grid are not on the same layer, the search in either direction ends. A second determination submodule is used to, when the target layer is greater than or equal to a preset layer number, search for neighboring points in the eight grids surrounding the grid corresponding to the search starting point, starting from the search starting point, in both the positive and negative directions of the second sorted point cloud, and count the total number of neighboring points. If the total number is greater than a preset threshold, the current point is determined to be a background point. A third determination submodule is used to, for remaining points whose state is still uncertain, construct a KDTree for all points in the adjacent grids of the grid corresponding to the search starting point and perform a radius search on the remaining points. If the number of neighboring points found is greater than or equal to the preset threshold, the remaining point is determined to be a background point; otherwise, it is a foreground point.

[0015] Further optionally, the preprocessing module includes: a first redundant point removal submodule, used to perform pass-through filtering on the current frame point cloud according to the defense zone range; and a second redundant point removal submodule, used to perform ground fitting and remove points below the ground in the current frame point cloud based on the fitting result.

[0016] The above technical solution has the following beneficial effects: by performing grid division and Morton index calculation on the point cloud, and reallocating memory to sort the point cloud according to the index, spatially adjacent points in the point cloud are also adjacent in the sorted sequence, which improves the efficiency of neighbor point search, thereby improving the accuracy and speed of background difference. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a flowchart of the laser point cloud background subtraction method provided in the embodiments of the present invention;

[0019] Figure 2 This is a flowchart of the Morton index calculation method provided in the embodiments of the present invention;

[0020] Figure 3 This is a flowchart of the point cloud sorting method provided in the embodiments of the present invention;

[0021] Figure 4 This is a flowchart of the background point segmentation method provided in the embodiments of the present invention;

[0022] Figure 5 This is a flowchart of the point cloud preprocessing method provided in the embodiments of the present invention;

[0023] Figure 6 This is a schematic diagram of the structure of the laser point cloud background difference system provided in an embodiment of the present invention;

[0024] Figure 7 This is a schematic diagram of the structure of the index calculation module provided in an embodiment of the present invention;

[0025] Figure 8 This is a schematic diagram of the sorting module provided in an embodiment of the present invention;

[0026] Figure 9 This is a schematic diagram of the differential module provided in an embodiment of the present invention;

[0027] Figure 10 This is a schematic diagram of the preprocessing module provided in an embodiment of the present invention.

[0028] Reference numerals: 100-Preprocessing module; 1001-First redundant point removal submodule; 1002-Second redundant point removal submodule; 200-Raster partitioning module; 300-Index calculation module; 3001-First index value calculation submodule; 3002-Second index value calculation submodule; 3003-Third index value calculation submodule; 3004-Index combination submodule; 400-Sorting module; 4001-Index pair calculation submodule; 4002-Data allocation submodule; 4003-Slice sorting submodule; 4004-Merge submodule; 500-Differential module; 5001-Raster layering submodule; 5002-Search starting point determination submodule; 5003-Target layer determination submodule; 5004-First decision submodule; 5005-Second decision submodule; 5006-Third decision submodule. Detailed Implementation

[0029] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0030] To address the low efficiency of background subtraction in target recognition processes in existing technologies, this invention provides a laser point cloud background subtraction method. Figure 1 This is a flowchart of the laser point cloud background subtraction method provided in the embodiments of the present invention, such as... Figure 1 As shown, it includes:

[0031] S1. Obtain the point cloud of the current frame; preprocess the point cloud of the current frame based on the prior information of the scene to obtain the processed point cloud.

[0032] The current frame point cloud refers to the raw 3D spatial point cloud data acquired at the current moment through LiDAR or other 3D sensing devices. This point cloud data typically includes a large number of 3D coordinate points. These 3D coordinate points include background points (static environment structures) and foreground points (dynamic targets).

[0033] To improve the efficiency and accuracy of subsequent point cloud processing, the current frame's point cloud needs to be preprocessed using prior scene information to remove redundant data and obtain the processed point cloud. Prior information about the scene may include, but is not limited to: the installation height and angle of the lidar, the spatial boundaries of the monitored area, and ground feature models.

[0034] S2. Divide the processed point cloud into grids according to the preset grid side length, and calculate the grid coordinates of each point in the processed point cloud corresponding to the grid; wherein, the preset grid side length is the preset search radius.

[0035] Set the grid's side length Search radius for neighboring points For processing point clouds Each point in Its coordinates are ( , , ),but The raster coordinates of the given grid are calculated as follows:

[0036] ;

[0037] in, This indicates rounding down to the nearest integer.

[0038] S3. Calculate the Morton index according to the grid coordinates and preset rules to obtain the first index value corresponding to each point.

[0039] For the raster coordinates of each point obtained by raster division The three-dimensional grid coordinates are processed into one dimension using preset rules to obtain the first index value for sorting.

[0040] Specifically, the preset rule is as follows: the integer values ​​of the raster coordinates in the three directions are represented in binary, and then combined bitwise in an alternating manner so that the bits in the X, Y, and Z directions are arranged sequentially, thus forming a unique encoded value corresponding to the three-dimensional raster position, i.e., the Morton index. In this way, the point cloud positions originally distributed in three-dimensional space can be mapped to monotonically increasing one-dimensional values, ensuring that numerically similar indices correspond to spatially adjacent points.

[0041] S4. Sort all points in the processed point cloud according to the first index value to obtain the first sorted point cloud.

[0042] Using the first index value calculated for each point as the sorting criterion, a global sorting operation is performed on all points in the processed point cloud in ascending or descending order. This ensures that the sorted point cloud has continuity in the data sequence consistent with its spatial location. Through this sorting process, spatially adjacent points are also made as adjacent as possible in the storage structure, thereby reducing random access overhead in subsequent nearest-neighbor lookups and hierarchical partitioning, improving cache hit rate and overall processing efficiency.

[0043] Sorting can be performed sequentially on general-purpose processors or accelerated using parallel sorting algorithms on parallel computing devices such as GPUs and NPUs.

[0044] S5. Traverse each point in the first sorted point cloud, search for neighboring points in the second sorted point cloud according to a preset search radius, and determine the background point based on the number of neighboring points; wherein, the second sorted point cloud is a sorted point cloud obtained in advance based on the background point cloud, and the step of obtaining the second sorted point cloud based on the background point cloud is the same as the step of obtaining the first sorted point cloud based on the current frame point cloud.

[0045] Background point clouds refer to the set of static points that remain stable in a scene after multi-frame statistical analysis or scene modeling within a laser point cloud sequence. These points typically correspond to stationary objects or structures in the scene, such as the ground, walls, buildings, and fixed facilities. Their positions remain largely unchanged across multiple frames of point cloud data acquired at different times. The purpose of background point clouds is to serve as reference data in subsequent background subtraction processing, comparing them with the current frame's point cloud to distinguish newly appearing, moving, or disappearing points (i.e., foreground points), which is used for tasks such as object detection and dynamic object segmentation.

[0046] The background point cloud also needs to undergo the same preprocessing, raster division, Morton coding and sorting operations as the current frame point cloud to obtain the second sorted point cloud, which includes the second index value of the raster corresponding to each point.

[0047] Traverse each point in the first sorted point cloud. For the currently traversed point, perform a neighbor search operation in the second sorted point cloud. During the neighbor search, using the corresponding point of the currently traversed point in the second sorted point cloud as the center, set a preset search radius, and search for all points in the second sorted point cloud whose spatial distance from the current point is not greater than this search radius; these points are the neighbors of the current point. Count the number of these neighbors and compare it with a preset threshold. A comparison is made when the number of neighboring points is greater than or equal to the preset threshold. When the current point is determined to be the background point, it is then identified as such.

[0048] By using this neighbor search based on ordered point clouds, the consistency of the spatial arrangement between the first and second ordered point clouds can be utilized to quickly locate and retrieve potential neighbor set, reduce unnecessary distance calculations, and improve the efficiency and accuracy of background point determination.

[0049] As an optional implementation method, Figure 2 This is a flowchart of the Morton index calculation method provided in an embodiment of the present invention, such as... Figure 2 As shown, the Morton index is calculated according to the raster coordinates and preset rules to obtain the first index value corresponding to each point, including:

[0050] S301. For any point in the point cloud, according to preset rules, shift the x-coordinate of the grid coordinates to which the point belongs, perform a bitwise OR operation between the shifted coordinate and the original coordinate, and perform a bitwise AND operation between the bitwise OR operation and the mask to obtain the x-direction index value.

[0051] S302. According to the preset rules, shift the y-coordinate of the grid coordinates to which any point belongs, perform a bitwise OR operation between the shifted coordinate and the original coordinate, and perform a bitwise AND operation between the bitwise OR operation and the mask to obtain the y-direction index value.

[0052] S303. According to the preset rules, shift the z-coordinate of the grid coordinates to which any point belongs, perform a bitwise OR operation between the shifted coordinate and the original coordinate, and perform a bitwise AND operation between the bitwise OR operation coordinate and the mask to obtain the z-direction index value.

[0053] Based on the calculated grid coordinates, information from the X, Y, and Z directions is combined to create an index for sorting. The traditional index formula is as follows, where... and The total number of grid cells along the X and Y axes, respectively:

[0054]

[0055] Traditional methods of calculating the index result in spatially adjacent points being far apart in memory after sorting, which is not conducive to subsequent neighbor point retrieval. However, the fusion method in this embodiment allows the calculated index to grow in a Z-shape in three-dimensional space, enabling the indexes of adjacent points to be as close as possible.

[0056] For each point in the point cloud, the x, y, and z coordinates of its corresponding grid are processed according to preset rules. Taking the x-coordinate as an example, the preset rules are as follows: First, the x-coordinate is shifted to obtain the shifted coordinate. Then, a bitwise OR operation is performed between the shifted coordinate and the original coordinate. The calculated result is then bitwise ANDed with a mask to obtain a new coordinate value. This new coordinate value is then used as the input for the next round of processing, and the same operation is repeated. After multiple rounds of processing, the x-direction index value is obtained.

[0057] Specifically, assuming the computer uses 32-bit storage, expressed in raster x-coordinates... For example, the Morton encoding rules in this embodiment are as follows:

[0058] (1) Left shift by 16 bits is denoted as Then and Perform a bitwise OR operation, and then perform a bitwise AND operation between the result and 50331903. Record the result as... ;

[0059] (2) Left shift by 8 bits is denoted as Then and Perform a bitwise OR operation, and then perform a bitwise AND operation between the result and 50393103. Record the result as... ;

[0060] (3) Left shift by 4 bits is denoted as Then and Perform a bitwise OR operation, and then perform a bitwise AND operation between the result and 51130563. The result is denoted as... ;

[0061] (4) Left shift by 2 bits is denoted as Then and Perform a bitwise OR operation, and then perform a bitwise AND operation between the result and 153391689, recording the result as... , That is, the x-direction index value.

[0062] y-coordinate of the grid and z-coordinate After performing the same encoding operation, the y-direction index values ​​are obtained respectively. and z-direction index value .

[0063] S304. Based on the x-direction index value, y-direction index value, and z-direction index value, perform a combination of shifting and bitwise OR operations to obtain the first index value of any point.

[0064] The x-direction index values ​​obtained above y-direction index value and z-direction index value The integration will be carried out, and the specific integration method is as follows:

[0065] ;

[0066] in, Indicates a bitwise OR operation. This indicates a bitwise left shift.

[0067] The first index value corresponding to each point in the point cloud can be obtained through the above method.

[0068] As an optional implementation method, Figure 3 This is a flowchart of the point cloud sorting method provided in an embodiment of the present invention, such as... Figure 3As shown, all points in the processed point cloud are sorted according to the first index value to obtain the first sorted point cloud, including:

[0069] S401. Form an index pair with the first index value corresponding to each point and its original sequence number, and sort them in ascending order according to the original sequence number to obtain the sorted input data.

[0070] For the processed point cloud after index calculation, preprocessing is performed before sorting, that is, the first index value... and corresponding serial number As a pair, it is denoted as , and according to The sorted input data that constitutes the NPU is arranged from smallest to largest. Then input data Copying to the NPU device is denoted as Where, index i is the original index of each point in the point cloud of the current frame.

[0071] Parallel computing devices can be selected according to requirements, such as NVIDIA GPUs and Huawei Ascend NPUs. In this embodiment, the Ascend NPU device is selected to accelerate the point cloud sorting process.

[0072] S402. Divide the sorted input data into multiple data segments and assign each data segment to a computing core for processing.

[0073] Assuming the NPU device has With one core element, the sorted input data can be divided into... There are several data segments, each containing... The last part of the data is padded with memory to make up any missing data.

[0074] S403. Divide each data segment into multiple slices, and execute the import task, sorting task and import task in sequence for each slice; among them, different tasks between different slices are processed in parallel.

[0075] Slice the n data points in each data segment into slices. Assume the maximum amount of data that can be sorted in a single operation is... Then the total data n will be processed as a single data session. The data segment is divided into chunks. If the remaining data is insufficient for a single processing run, it is processed as a separate chunk, thus obtaining the total number of chunks for that data segment. .

[0076] Each slice needs to perform an import task sequentially (importing data from...). (Into the computing unit), sorting operations, and outgoing tasks (moving the sorted results from the computing unit back to the computing unit). For the same slice, the operations of loading, sorting, and loading out are processed sequentially, while for different slices, multiple tasks can be processed in parallel at the same time.

[0077] The following is an example of a parallel processing flow between different slices:

[0078] At time ①, slice a performs the import task, transferring data from... Move it into the computing unit.

[0079] At time ②, slice a performs a sorting task, while slice b performs an ingestion task.

[0080] At time ③, slice a performs the move-out task, moving the sorting results from the computation unit back to the computation unit. Slice b performs the sorting task; slice c performs the import task.

[0081] At time ④, slice b performs the outgoing task; slice c performs the sorting task; and slice d performs the incoming task.

[0082] At time ⑤, slice c performs the outgoing task; slice d performs the sorting task; and slice e performs the incoming task.

[0083] Time 6, and so on.

[0084] S404. Merge the sorting results of each slice to obtain the data segment sorting result, and then merge the sorting results of each data segment to obtain the first sorted point cloud.

[0085] After the data segment is sliced ​​and sorted, a merge sort is performed within the data segment to synthesize ordered data. This pipelined processing will result in... Segmented ordered data, Merging and sorting ordered segments of data pairwise will result in... =( Segmented ordered data. And so on, when... Continue merging point clouds pairwise until only one ordered segment remains. Merge data from different segments in the same way, and reallocate memory for the sorted point cloud, ensuring that spatially adjacent points are also adjacent in memory, thus obtaining the first sorted point cloud. .

[0086] As an optional implementation method, Figure 4 This is a flowchart of the background point segmentation method provided in the embodiments of the present invention, such as... Figure 4 As shown, each point in the first sorted point cloud is traversed, and neighboring points are searched in the second sorted point cloud according to a preset search radius. Background points are determined based on the number of neighboring points, including:

[0087] S501. Based on the difference in the last digit of the index value, perform hierarchical division on the raster corresponding to each point in the first sorted point cloud and the second sorted point cloud respectively.

[0088] Background point cloud and current frame point cloud After sorting, the second sorted point clouds are obtained respectively. and the first sorted point cloud Before searching for neighboring points, the following definitions are made: First, points with the same index value are defined as belonging to the same grid cell, i.e., layer 0; points with index values ​​where the last 3 bits are different and the rest are the same are defined as belonging to layer 1, a total of 8 grid cells; points with index values ​​where the last 6 bits are different and the rest are the same are defined as belonging to layer 2, a total of 64 grid cells; and so on. Based on this definition, the total number of leaf grid cells in layer n is... The number of leaf grids (not located at the layer boundary in the X, Y, and Z directions) within this layer is: .

[0089] S502. For the current point in the first sorted point cloud, find the point in the second sorted point cloud whose second index value is closest to the first index value of the current point, and take that point as the starting point for the search.

[0090] Traversing the first sorted point cloud Let the points in the first sorted point cloud be... The point currently visited is the current point. Its first index value is Due to the second sorted point cloud and the first sorted point cloud The indexes are all ordered, so as long as the second sorted point cloud is used... By searching sequentially, we can find the first index value of the current point. The closest point will be used to sort the second point cloud. The point found is recorded as the search starting point. It is in the second sorted point cloud The serial number in is The Morton index corresponding to each point in the second sorted point cloud is the second index value. In the second sorted point cloud after sorting according to the second index value, each point is numbered according to the sorted order, thus obtaining the sequence number of each point in the second sorted point cloud.

[0091] S503. Determine whether the grid corresponding to the current point is a boundary grid of the current layer from low to high. If it is, determine the boundary grid of the next higher layer. Otherwise, record the current layer as the target layer.

[0092] Calculate the current point The minimum layer number at which the current point is not on the boundary. Specifically, the determination of the current point starts from layer 2. The system checks if the current point is a boundary cell; if so, it determines whether the current point is a boundary point of the current layer. If it is a boundary point, the search continues to the third layer; otherwise, the calculation stops, and the current point is reset. The current layer is denoted as the target layer. .

[0093] S504. When the target layer is less than the preset number of layers, starting from the search starting point, search for the number of neighboring points in the positive and negative directions of the second sorted point cloud in sequence. If the number of neighboring points reaches the preset number threshold, the current point is determined to be a background point. If the number of neighboring points still does not reach the preset number threshold by the end of the search in the negative direction, the current point is determined to be a foreground point. When the grid of the search point and the current point are not on the same layer, the search in either direction ends.

[0094] Target layer The larger the value, the higher the value of the current point. It requires traversing more grid cells to find all potential neighboring points, therefore, to improve search efficiency, when the target layer... Less than the preset number of layers When a pre-set comparison threshold is reached (preferably 6 or 7 layers), the following operations are performed:

[0095] From the starting point number To begin, start with the second sorted point cloud. China The search is in the positive direction, and the current search point is... The second index value is denoted as ,judge Does it meet the following conditions, where Indicates bitwise right shift:

[0096]

[0097] a. If this condition is met, it indicates that the current point... with search point Continue calculating the search point on the same level. and current point Distance between :

[0098] when When, then the current point Find a neighboring point in the second sorted point cloud. Add one;

[0099] when Then, continue searching for the next point. ;in, This is the preset search radius.

[0100] b. If this condition is not met, it indicates the search point It can't be The nearest points, and due to the second sorted point cloud The second index value of the midpoint is ordered. It couldn't be. The search terminates when the nearest neighbor is found.

[0101] Preset preset quantity threshold If during the search process , considering the current point The background point requirement has been met. If the forward search is complete, < Then search for the starting point number. The negative direction search is used to find the search point. The second index value is denoted as ,judge Does it meet the following conditions:

[0102]

[0103] When the condition is met, execute step a and continue accumulating. If the condition is not met, proceed to step b. If the condition is met during the search process... Then the current point is considered For the background point, otherwise if When going beyond the same floor, Still smaller Then determine the current point. This is the foreground attraction.

[0104] S505. When the target layer is greater than or equal to the preset number of layers, within the eight grids surrounding the grid corresponding to the search starting point, starting from the search starting point, search for neighboring points in the positive and negative directions of the second sorted point cloud respectively, and count the total number of neighboring points. If the total number is greater than the preset number threshold, determine the current point as a background point.

[0105] When the target layer Greater than or equal to the preset number of layers At that time, it was considered that traversing all points within the same level of the raster would take too much time. Based on the characteristics of the Morton index, there are a total of 8 raster values ​​related to the first index value of the current point. If the last three bits are different while the remaining bits are the same, these grids may have neighboring points and are contiguous in memory, making them easy to search. Therefore, we only check if there are neighboring points within these 8 grids. The determination of such grids is as follows:

[0106]

[0107] Search for the starting point number Search for points within these 8 grid cells in both positive and negative directions, and calculate the distance from these points to the current point. The distance d is calculated for all distances d less than the preset search radius. Number of points .if Then the current point Used as a background point.

[0108] S506. For the remaining points whose status is still uncertain, construct a KDTree for all points in the adjacent grids of the grid corresponding to the search starting point and perform a radius search for the remaining points. When the number of neighboring points found is greater than or equal to a preset threshold, the remaining points are determined to be background points; otherwise, they are foreground points.

[0109] The ratio of the number of leaf grids within each layer to the total number of grids is: Therefore, when the preset number of layers When the setting is large, most points are found, and step S504 above is executed, allowing them to be quickly identified as background or foreground points. A portion of the remaining points are identified as background points in step S505 above. For the remaining points whose status cannot be determined after steps S504 and S505 above, further evaluation is required. These points are all... The boundary points of the layer, and the coordinates of the grid they occupy. If any of the following conditions are met, where For the remainder:

[0110] ;

[0111] Therefore, the possible neighboring points of the remaining points only exist within the adjacent grid cells of the grid that meet this condition, that is, the grid coordinates meet the condition. In the second sorted point cloud, a KDTree is constructed for the points within these grids. A radius search is then performed on the remaining points, and the search results show that the number of neighboring points is greater than or equal to [the specified value]. If a point is a background point, then it is a foreground point; otherwise, it is a background point.

[0112] By following the steps above, the state of all points in the first sorted point cloud can be determined, thus completing the background subtraction.

[0113] As an optional implementation method, Figure 5 This is a flowchart of the point cloud preprocessing method provided in the embodiments of the present invention, such as... Figure 5 As shown, the current frame point cloud is preprocessed based on prior scene information to obtain a processed point cloud, including:

[0114] S101. Perform pass-through filtering on the current frame point cloud according to the defense zone range;

[0115] S102. Perform ground fitting and remove points below the ground in the current frame point cloud based on the fitting results.

[0116] First, based on the pre-defined defense zone spatial range, a pass-through filtering operation is performed on the current frame point cloud. By limiting the value range in each coordinate axis direction, point cloud data located outside the defense zone is removed, thereby reducing the amount of data to be processed and improving computational efficiency.

[0117] The current frame point cloud is then subjected to ground fitting processing, which can be achieved using algorithms such as Random Sample Consensus (RANSAC) to construct a ground model that conforms to the current scene. After fitting, point cloud data below the ground is removed based on the height benchmark of the ground model to eliminate interference caused by ground undulations, low-lying obstacles, or environmental noise, ensuring that the retained point cloud data only includes valid target points above the ground within the defense zone.

[0118] Furthermore, to reduce the amount of data processing, the point cloud of the current frame can be downsampled.

[0119] After the above preprocessing steps, a processed point cloud is obtained for subsequent sorting and background point determination.

[0120] This invention also provides a laser point cloud background difference system. Figure 6 This is a schematic diagram of the structure of the laser point cloud background difference system provided in an embodiment of the present invention, as shown below. Figure 6 As shown, the system includes:

[0121] The preprocessing module 100 is used to acquire the point cloud of the current frame; and to preprocess the point cloud of the current frame according to the prior information of the scene to obtain the processed point cloud.

[0122] The current frame point cloud refers to the raw 3D spatial point cloud data acquired at the current moment through LiDAR or other 3D sensing devices. This point cloud data typically includes a large number of 3D coordinate points. These 3D coordinate points include background points (static environment structures) and foreground points (dynamic targets).

[0123] To improve the efficiency and accuracy of subsequent point cloud processing, the current frame's point cloud needs to be preprocessed using prior scene information to remove redundant data and obtain the processed point cloud. Prior information about the scene may include, but is not limited to: the installation height and angle of the lidar, the spatial boundaries of the monitored area, and ground feature models.

[0124] The grid division module 200 is used to divide the processed point cloud into grids according to a preset grid side length, and to calculate the grid coordinates of each point in the processed point cloud corresponding to the grid; wherein, the preset grid side length is a preset search radius.

[0125] Set the grid's side length Search radius for neighboring points For processing point clouds Each point in Its coordinates are ( , , ),but The raster coordinates of the given grid are calculated as follows:

[0126] ;

[0127] in, This indicates rounding down to the nearest integer.

[0128] The index calculation module 300 is used to calculate the Morton index according to the grid coordinates and preset rules to obtain the first index value corresponding to each point.

[0129] For the raster coordinates of each point obtained by raster division The three-dimensional grid coordinates are processed into one dimension using preset rules to obtain the first index value for sorting.

[0130] Specifically, the preset rule is as follows: the integer values ​​of the raster coordinates in the three directions are represented in binary, and then combined bitwise in an alternating manner so that the bits in the X, Y, and Z directions are arranged sequentially, thus forming a unique encoded value corresponding to the three-dimensional raster position, i.e., the Morton index. In this way, the point cloud positions originally distributed in three-dimensional space can be mapped to monotonically increasing one-dimensional values, ensuring that numerically similar indices correspond to spatially adjacent points.

[0131] The sorting module 400 is used to sort all points in the processed point cloud according to the first index value to obtain the first sorted point cloud.

[0132] Using the first index value calculated for each point as the sorting criterion, a global sorting operation is performed on all points in the processed point cloud in ascending or descending order. This ensures that the sorted point cloud has continuity in the data sequence consistent with its spatial location. Through this sorting process, spatially adjacent points are also made as adjacent as possible in the storage structure, thereby reducing random access overhead in subsequent nearest-neighbor lookups and hierarchical partitioning, improving cache hit rate and overall processing efficiency.

[0133] Sorting can be performed sequentially on general-purpose processors or accelerated using parallel sorting algorithms on parallel computing devices such as GPUs and NPUs.

[0134] The difference module 500 is used to traverse each point in the first sorted point cloud, search for neighboring points in the second sorted point cloud according to a preset search radius, and determine the background point based on the number of neighboring points; wherein, the second sorted point cloud is a sorted point cloud obtained in advance based on the background point cloud, and the step of obtaining the second sorted point cloud based on the background point cloud is the same as the step of obtaining the first sorted point cloud based on the current frame point cloud.

[0135] Background point clouds refer to the set of static points that remain stable in a scene after multi-frame statistical analysis or scene modeling within a laser point cloud sequence. These points typically correspond to stationary objects or structures in the scene, such as the ground, walls, buildings, and fixed facilities. Their positions remain largely unchanged across multiple frames of point cloud data acquired at different times. The purpose of background point clouds is to serve as reference data in subsequent background subtraction processing, comparing them with the current frame's point cloud to distinguish newly appearing, moving, or disappearing points (i.e., foreground points), which is used for tasks such as object detection and dynamic object segmentation.

[0136] The background point cloud also needs to undergo the same preprocessing, raster division, Morton coding and sorting operations as the current frame point cloud to obtain the second sorted point cloud, which includes the second index value of the raster corresponding to each point.

[0137] Traverse each point in the first sorted point cloud. For the currently traversed point, perform a neighbor search operation in the second sorted point cloud. During the neighbor search, using the corresponding point of the currently traversed point in the second sorted point cloud as the center, set a preset search radius, and search for all points in the second sorted point cloud whose spatial distance from the current point is not greater than this search radius; these points are the neighbors of the current point. Count the number of these neighbors and compare it with a preset threshold. A comparison is made when the number of neighboring points is greater than or equal to the preset threshold. When the current point is determined to be the background point, it is then identified as such.

[0138] By using this neighbor search based on ordered point clouds, the consistency of the spatial arrangement between the first and second ordered point clouds can be utilized to quickly locate and retrieve potential neighbor set, reduce unnecessary distance calculations, and improve the efficiency and accuracy of background point determination.

[0139] As an optional implementation method, Figure 7 This is a schematic diagram of the structure of the index calculation module provided in an embodiment of the present invention, as shown below. Figure 7 As shown, the index calculation module 300 includes:

[0140] The first index value calculation submodule 3001 is used to perform a shift operation on the x-coordinate of the raster coordinates to which the point belongs, a bitwise OR operation between the shifted coordinate and the original coordinate, and a bitwise AND operation between the bitwise OR operation coordinate and the mask for any point in the point cloud, in accordance with preset rules, to obtain the x-direction index value.

[0141] The second index value calculation submodule 3002 is used to perform a shift operation on the y-coordinate of the grid coordinates to which any point belongs, a bitwise OR operation between the shifted coordinate and the original coordinate, and a bitwise AND operation between the bitwise OR operation coordinate and the mask, according to preset rules, to obtain the y-direction index value.

[0142] The third index value calculation submodule 3003 is used to perform a shift operation on the z-coordinate of the grid coordinates to which any point belongs, a bitwise OR operation between the shifted coordinate and the original coordinate, and a bitwise AND operation between the bitwise OR operation coordinate and the mask, according to preset rules, to obtain the z-direction index value.

[0143] Based on the calculated grid coordinates, information from the X, Y, and Z directions is combined to create an index for sorting. The traditional index formula is as follows, where... and The total number of grid cells along the X and Y axes, respectively:

[0144]

[0145] Traditional methods of calculating the index result in spatially adjacent points being far apart in memory after sorting, which is not conducive to subsequent neighbor point retrieval. However, the fusion method in this embodiment allows the calculated index to grow in a Z-shape in three-dimensional space, enabling the indexes of adjacent points to be as close as possible.

[0146] For each point in the point cloud, the x, y, and z coordinates of its corresponding grid are processed according to preset rules. Taking the x-coordinate as an example, the preset rules are as follows: First, the x-coordinate is shifted to obtain the shifted coordinate. Then, a bitwise OR operation is performed between the shifted coordinate and the original coordinate. The calculated result is then bitwise ANDed with a mask to obtain a new coordinate value. This new coordinate value is then used as the input for the next round of processing, and the same operation is repeated. After multiple rounds of processing, the x-direction index value is obtained.

[0147] Specifically, assuming the computer uses 32-bit storage, expressed in raster x-coordinates... For example, the Morton encoding rules in this embodiment are as follows:

[0148] (1) Left shift by 16 bits is denoted as Then and Perform a bitwise OR operation, and then perform a bitwise AND operation between the result and 50331903. Record the result as... ;

[0149] (2) Left shift by 8 bits is denoted as Then and Perform a bitwise OR operation, and then perform a bitwise AND operation between the result and 50393103. Record the result as... ;

[0150] (3) Left shift by 4 bits is denoted as Then and Perform a bitwise OR operation, and then perform a bitwise AND operation between the result and 51130563. The result is denoted as... ;

[0151] (4) Left shift by 2 bits is denoted as Then and Perform a bitwise OR operation, and then perform a bitwise AND operation between the result and 153391689, recording the result as... , That is, the x-direction index value.

[0152] y-coordinate of the grid and z-coordinate After performing the same encoding operation, the y-direction index values ​​are obtained respectively. and z-direction index value .

[0153] The index combination submodule 3004 is used to obtain the first index value of any point by performing shifting and bitwise OR operations based on the index values ​​in the x, y, and z directions.

[0154] The x-direction index values ​​obtained above y-direction index value and z-direction index value The integration will be carried out, and the specific integration method is as follows:

[0155] ;

[0156] in, Indicates a bitwise OR operation. This indicates a bitwise left shift.

[0157] The first index value of each corresponding point in the processed point cloud can be obtained through the above method.

[0158] As an optional implementation method, Figure 8 This is a schematic diagram of the sorting module provided in an embodiment of the present invention, as shown below. Figure 8 As shown, the sorting module 400 includes:

[0159] The index pair calculation submodule 4001 is used to form an index pair with the first index value corresponding to each point and its original sequence number, and arrange them in ascending order according to the original sequence number to obtain sorted input data.

[0160] For the processed point cloud after index calculation, preprocessing is performed before sorting, that is, the first index value... and corresponding serial number As a pair, it is denoted as , and according to The sorted input data that constitutes the NPU is arranged from smallest to largest. Then input data Copying to the NPU device is denoted as Where, index i is the original index of each point in the point cloud of the current frame.

[0161] Parallel computing devices can be selected according to requirements, such as NVIDIA GPUs and Huawei Ascend NPUs. In this embodiment, the Ascend NPU device is selected to accelerate the point cloud sorting process.

[0162] The data allocation submodule 4002 is used to divide the sorted input data into multiple data segments and assign each data segment to a computing core for processing.

[0163] Assuming the NPU device has With one core element, the sorted input data can be divided into... There are several data segments, each containing... The last part of the data is padded with memory to make up any missing data.

[0164] The slice sorting submodule 4003 is used to divide each data segment into multiple slices and execute the import task, sorting task and import task in sequence for each slice; among them, different tasks between different slices are processed in parallel.

[0165] Slice the n data points in each data segment into slices. Assume the maximum amount of data that can be sorted in a single operation is... Then the total data n will be processed as a single data session. The data segment is divided into chunks. If the remaining data is insufficient for a single processing run, it is processed as a separate chunk, thus obtaining the total number of chunks for that data segment. .

[0166] Each slice needs to perform an import task sequentially (importing data from...). (Into the computing unit), sorting tasks, and outgoing tasks (moving the sorting results from the computing unit back to the computing unit). For the same slice, the tasks of loading, sorting, and loading out are processed sequentially, while for different slices, multiple tasks can be processed in parallel at the same time.

[0167] The following is an example of a parallel processing flow between different slices:

[0168] At time ①, slice a performs the import task, transferring data from... Move it into the computing unit.

[0169] At time ②, slice a performs a sorting task, while slice b performs an ingestion task.

[0170] At time ③, slice a performs the move-out task, moving the sorting results from the computation unit back to the computation unit. Slice b performs the sorting task; slice c performs the import task.

[0171] At time ④, slice b performs the outgoing task; slice c performs the sorting task; and slice d performs the incoming task.

[0172] At time ⑤, slice c performs the outgoing task; slice d performs the sorting task; and slice e performs the incoming task.

[0173] Time 6, and so on.

[0174] The merge submodule 4004 is used to merge the sorting results of each slice to obtain the sorting result of the data segment, and then merge the sorting results of each data segment to obtain the first sorted point cloud.

[0175] After the data segment is sliced ​​and sorted, a merge sort is performed within the data segment to synthesize ordered data. This pipelined processing will result in... Segmented ordered data, Merging and sorting ordered segments of data pairwise will result in... =( Segmented ordered data. And so on, when... Continue merging point clouds pairwise until only one ordered segment remains. Merge data from different segments in the same way, and reallocate memory for the sorted point cloud, ensuring that spatially adjacent points are also adjacent in memory, thus obtaining the first sorted point cloud. .

[0176] As an optional implementation method, Figure 9 This is a schematic diagram of the differential module provided in an embodiment of the present invention, as shown below. Figure 9 As shown, the differential module 500 includes:

[0177] The raster layering submodule 5001 is used to perform layer division on the raster corresponding to each point in the first sorted point cloud and the second sorted point cloud according to the difference in the last digit of the index value.

[0178] Background point cloud and current frame point cloud After sorting, the second sorted point clouds are obtained respectively. and the first sorted point cloud Before searching for neighboring points, the following definitions are made: First, points with the same index value are defined as belonging to the same grid cell, i.e., layer 0; points with index values ​​where the last 3 bits are different and the rest are the same are defined as belonging to layer 1, a total of 8 grid cells; points with index values ​​where the last 6 bits are different and the rest are the same are defined as belonging to layer 2, a total of 64 grid cells; and so on. Based on this definition, the total number of leaf grid cells in layer n is... The number of leaf grids (not located at the layer boundary in the X, Y, and Z directions) within this layer is: .

[0179] The starting point determination submodule 5002 is used to find, for the current point in the first sorted point cloud, the point in the second sorted point cloud whose second index value is closest to the first index value of the current point, and use that point as the starting point for the search.

[0180] Traversing the first sorted point cloud Let the points in the first sorted point cloud be... The point currently visited is the current point. Its corresponding first index value is Due to the second sorted point cloud and the first sorted point cloud The indexes are all ordered, so as long as the second sorted point cloud is used... By searching sequentially, we can find the first index value of the current point. The closest point will be used to sort the second point cloud. The point found is recorded as the search starting point. It is in the second sorted point cloud The serial number in is The Morton index corresponding to each point in the second sorted point cloud is the second index value. In the second sorted point cloud after sorting according to the second index value, each point is numbered according to the sorted order, thus obtaining the sequence number of each point in the second sorted point cloud.

[0181] The target layer determination submodule 5003 is used to determine whether the grid corresponding to the current point is a boundary grid of the current layer layer by layer from low to high. If it is, the boundary grid of the next higher layer is determined; otherwise, the current layer is recorded as the target layer.

[0182] Calculate the current point The minimum layer number at which the current point is not on the boundary. Specifically, the determination of the current point starts from layer 2. The system checks if the current point is a boundary cell; if so, it determines whether the current point is a boundary point of the current layer. If it is a boundary point, the search continues to the third layer; otherwise, the calculation stops, and the current point is reset. The current layer is denoted as the target layer. .

[0183] The first determination submodule 5004 is used to search for the number of neighboring points in the positive and negative directions of the second sorted point cloud in sequence, starting from the search starting point, when the target layer is less than the preset number of layers. If the number of neighboring points reaches the preset number threshold, the current point is determined to be a background point. If the number of neighboring points still does not reach the preset number threshold by the end of the search in the negative direction, the current point is determined to be a foreground point. When the grid of the search point and the current point are not on the same layer, the search in either direction ends.

[0184] Target layer The larger the value, the higher the value of the current point. It requires traversing more grid cells to find all potential neighboring points, therefore, to improve search efficiency, when the target layer... Less than the preset number of layers When a pre-set comparison threshold is reached (preferably 6 or 7 layers), the following operations are performed:

[0185] From the starting point number To begin, start with the second sorted point cloud. China The search is in the positive direction, and the current search point is... The second index value is denoted as ,judge Does it meet the following conditions, where Indicates bitwise right shift:

[0186]

[0187] a. If this condition is met, it indicates that the current point... with search point Continue calculating the search point on the same level. and current point Distance between :

[0188] when When, then the current point Find a neighboring point in the second sorted point cloud. Add one;

[0189] when Then, continue searching for the next point. ;in, This is the preset search radius.

[0190] b. If this condition is not met, it indicates the search point It can't be The nearest points, and due to the second sorted point cloud The second index value of the midpoint is ordered. It couldn't be. The search terminates when the nearest neighbor is found.

[0191] Preset preset quantity threshold If during the search process , considering the current point The background point requirement has been met. If the forward search is complete, < Then search for the starting point number. The negative direction search is used to find the search point. The second index value is denoted as ,judge Does it meet the following conditions:

[0192]

[0193] When the condition is met, execute step a and continue accumulating. If the condition is not met, proceed to step b. If the condition is met during the search process... Then the current point is considered For the background point, otherwise if When going beyond the same floor, Still smaller Then determine the current point. This is the foreground attraction.

[0194] The second determination submodule 5005 is used to search for neighboring points in the eight grids surrounding the grid corresponding to the search starting point, taking the search starting point as the starting point, and searching in the positive and negative directions of the second sorted point cloud respectively, when the target layer is greater than or equal to the preset number of layers. The total number of neighboring points is counted. If the total number is greater than the preset number threshold, the current point is determined to be a background point.

[0195] When the target layer Greater than or equal to the preset number of layers At that time, it was considered that traversing all points within the same level of the raster would take too much time. Based on the characteristics of the Morton index, there are a total of 8 raster values ​​related to the first index value of the current point. If the last three bits are different while the remaining bits are the same, these grids may have neighboring points and are contiguous in memory, making them easy to search. Therefore, we only check if there are neighboring points within these 8 grids. The determination of such grids is as follows:

[0196]

[0197] Search for the starting point number Search for points within these 8 grid cells in both positive and negative directions, and calculate the distance from these points to the current point. The distance d is calculated for all distances d less than the preset search radius. Number of points .if Then the current point Used as a background point.

[0198] The third determination submodule 5006 is used to construct a KDTree for all points in the adjacent grids of the grid corresponding to the search starting point and perform a radius search for the remaining points for which the status cannot be determined. When the number of neighboring points found is greater than or equal to a preset number threshold, the remaining points are determined to be background points; otherwise, they are foreground points.

[0199] The ratio of the number of leaf grids within each layer to the total number of grids is: Therefore, when the preset number of layers When the setting is large, most points found will be quickly identified as background or foreground points by executing the steps of the first determination submodule. A portion of the remaining points will be identified as background points in the second determination submodule. For the remaining points whose status cannot be determined after the first and second determination submodules, further judgment is required. These points are all... The boundary points of the layer, and the coordinates of the grid they occupy. If any of the following conditions are met, where For the remainder:

[0200] ;

[0201] Therefore, the possible neighboring points of the remaining points only exist within the adjacent grid cells of the grid that meet this condition, that is, the grid coordinates meet the condition. In the second sorted point cloud, a KDTree is constructed for the points within these grids. A radius search is then performed on the remaining points, and the search results show that the number of neighboring points is greater than or equal to [the specified value]. If a point is a background point, then it is a foreground point; otherwise, it is a background point.

[0202] By following the steps above, the state of all points in the first sorted point cloud can be determined, thus completing the background subtraction.

[0203] As an optional implementation method, Figure 10 This is a schematic diagram of the preprocessing module provided in an embodiment of the present invention, as shown below. Figure 10 As shown, the preprocessing module 100 includes:

[0204] The first redundant point removal submodule 1001 is used to perform pass-through filtering on the current frame point cloud according to the defense zone range;

[0205] The second redundant point removal submodule 1002 is used to perform ground fitting and remove points below the ground in the current frame point cloud based on the fitting results.

[0206] First, based on the pre-defined defense zone spatial range, a pass-through filtering operation is performed on the current frame point cloud. By limiting the value range in each coordinate axis direction, point cloud data located outside the defense zone is removed, thereby reducing the amount of data to be processed and improving computational efficiency.

[0207] The current frame point cloud is then subjected to ground fitting processing, which can be achieved using algorithms such as Random Sample Consensus (RANSAC) to construct a ground model that conforms to the current scene. After fitting, point cloud data below the ground is removed based on the height benchmark of the ground model to eliminate interference caused by ground undulations, low-lying obstacles, or environmental noise, ensuring that the retained point cloud data only includes valid target points above the ground within the defense zone.

[0208] Furthermore, to reduce the amount of data processing, the point cloud of the current frame can be downsampled.

[0209] After the above preprocessing steps, a processed point cloud is obtained for subsequent sorting and background point determination.

[0210] The above technical solution has the following beneficial effects: By dividing the point cloud into grids and calculating the Morton index, and reallocating memory to sort the point cloud according to the index, spatially adjacent points in the point cloud are also adjacent in the sorted sequence, improving the efficiency of neighbor point search; by introducing the decision rules of the hierarchical grid, the search range can be quickly limited when the target point is at a low level, and only a small number of adjacent grids are checked when the level is high. For a small number of points whose status cannot be determined, the search range can be narrowed and a simplified KDTree can be constructed for radius search, avoiding large-scale invalid searches, thus reducing computational complexity and improving data processing efficiency; by using and computing to perform segmented slicing of the sorting process, the data import, calculation and import tasks can be executed in parallel between different slices, thereby giving full play to the parallel processing capabilities of the hardware and further shortening the overall computation time.

[0211] The above-described specific embodiments of the invention further illustrate the purpose, technical solution, and beneficial effects of the invention. It should be understood that the above content is only for specific embodiments of the invention and is not intended to limit the scope of protection of the invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the invention should be included within the scope of protection of the invention.

Claims

1. A laser point cloud background subtraction method, characterized in that, include: Obtain the point cloud of the current frame; The current frame point cloud is preprocessed based on prior scene information to obtain a processed point cloud; The processed point cloud is divided into grids according to a preset grid side length, and the grid coordinates of each point in the processed point cloud corresponding to the grid are calculated; wherein, the preset grid side length is a preset search radius; Based on the grid coordinates, the Morton index is calculated according to preset rules to obtain the first index value corresponding to each point; Sort all points in the processed point cloud according to the first index value to obtain a first sorted point cloud; Traverse each point in the first sorted point cloud, search for neighboring points in the second sorted point cloud according to the preset search radius, and determine the background point based on the number of neighboring points; wherein, the second sorted point cloud is a sorted point cloud obtained in advance based on the background point cloud, and the step of obtaining the second sorted point cloud based on the background point cloud is the same as the step of obtaining the first sorted point cloud based on the current frame point cloud.

2. The laser point cloud background subtraction method according to claim 1, characterized in that, The step of calculating the Morton index according to the grid coordinates and a preset rule to obtain the first index value corresponding to each point includes: For any point in the processed point cloud, according to the preset rules, the x-coordinate of the grid coordinates to which the point belongs is shifted, the coordinate after shifting is bitwise ORed with the coordinate before shifting, and the coordinate after bitwise ORed is bitwise ANDed with the mask to obtain the x-direction index value. According to the preset rules, the y-coordinate of any point in the grid coordinates is shifted, the coordinate after shifting is bitwise ORed with the coordinate before shifting, and the coordinate after bitwise ORing is bitwise ANDed with the mask to obtain the y-direction index value. According to the preset rules, the z-coordinate of the grid coordinates to which any point belongs is shifted, the coordinate after shifting is bitwise ORed with the coordinate before shifting, and the coordinate after bitwise ORed is bitwise ANDed with the mask to obtain the z-direction index value. The first index value of any point is obtained by combining shift and bitwise OR operations based on the x-direction index value, y-direction index value, and z-direction index value.

3. The laser point cloud background subtraction method according to claim 1, characterized in that, The step of sorting all points in the processed point cloud according to the first index value to obtain a first sorted point cloud includes: For each point, the first index value and its original sequence number are combined to form an index pair, which are then sorted in ascending order according to the original sequence number to obtain the sorted input data. The sorted input data is divided into multiple data segments, and each data segment is assigned to a computing core for processing; Each data segment is divided into multiple slices, and the import, sorting and import tasks are executed sequentially for each slice; different tasks between different slices are processed in parallel. The sorting results of each slice are merged to obtain the sorting result of the data segment. Then, the sorting results of each data segment are merged to obtain the first sorted point cloud.

4. The laser point cloud background subtraction method according to claim 1, characterized in that, The step of traversing each point in the first sorted point cloud, searching for neighboring points in the second sorted point cloud according to the preset search radius, and determining background points based on the number of neighboring points includes: Based on the difference in the last digit of the index value, the raster corresponding to each point in the first sorted point cloud and the second sorted point cloud is divided into layers. For the current point in the first sorted point cloud, find the point in the second sorted point cloud whose second index value is closest to the first index value of the current point, and use that point as the starting point for the search. The system checks each layer from low to high to determine whether the grid corresponding to the current point is the boundary grid of the current layer. If it is, the system checks the boundary grid of the next higher layer. Otherwise, the system records the current layer as the target layer. When the target layer is less than a preset number of layers, starting from the search starting point, the number of neighboring points is searched sequentially in the positive and negative directions of the second sorted point cloud. If the number of neighboring points reaches a preset threshold, the current point is determined to be a background point. If the number of neighboring points still does not reach the preset threshold by the end of the search in the negative direction, the current point is determined to be a foreground point. When the search point and the current point are not on the same layer, the search in either direction ends. When the target layer is greater than or equal to the preset number of layers, within the eight grids surrounding the grid corresponding to the search starting point, starting from the search starting point, search for neighboring points in the positive and negative directions of the second sorted point cloud respectively, count the total number of neighboring points, and if the total number is greater than the preset number threshold, determine the current point as a background point. For the remaining points whose status is still uncertain, construct a KDTree for all points in the adjacent grids of the grid corresponding to the search starting point and perform a radius search for the remaining points. When the number of neighboring points found is greater than or equal to the preset number threshold, the remaining points are determined to be background points; otherwise, they are foreground points.

5. The laser point cloud background subtraction method according to claim 1, characterized in that, The step of preprocessing the current frame point cloud based on prior scene information to obtain a processed point cloud includes: Perform pass-through filtering on the current frame point cloud according to the defense zone range; Perform ground fitting, and remove points below the ground in the current frame point cloud based on the fitting results.

6. A laser point cloud background difference system, characterized in that, include: The preprocessing module is used to obtain the point cloud of the current frame; The current frame point cloud is preprocessed based on prior scene information to obtain a processed point cloud; The grid division module is used to divide the processed point cloud into grids according to a preset grid side length, and to calculate the grid coordinates of each point in the processed point cloud corresponding to the grid; wherein, the preset grid side length is a preset search radius; The index calculation module is used to calculate the Morton index according to the grid coordinates and preset rules to obtain the first index value corresponding to each point. The sorting module is used to sort all points in the processed point cloud according to the first index value to obtain a first sorted point cloud. The difference module is used to traverse each point in the first sorted point cloud, search for neighboring points in the second sorted point cloud according to the preset search radius, and determine the background point based on the number of neighboring points; wherein, the second sorted point cloud is a sorted point cloud obtained in advance based on the background point cloud, and the step of obtaining the second sorted point cloud based on the background point cloud is the same as the step of obtaining the first sorted point cloud based on the current frame point cloud.

7. The laser point cloud background difference system according to claim 6, characterized in that, The index calculation includes: The first index value calculation submodule is used to perform the following operations on any point in the processed point cloud: shifting the x-coordinate of the grid coordinates to which the point belongs, performing a bitwise OR operation between the shifted coordinate and the original coordinate, and performing a bitwise AND operation between the bitwise OR operation coordinate and the mask, to obtain the x-direction index value. The second index value calculation submodule is used to perform a shift operation on the y-coordinate of the grid coordinates to which any point belongs, a bitwise OR operation between the shifted coordinate and the original coordinate, and a bitwise AND operation between the bitwise OR operation coordinate and the mask, according to the preset rules, to obtain the y-direction index value. The third index value calculation submodule is used to perform a shift operation on the z-coordinate of the grid coordinates to which any point belongs, a bitwise OR operation between the shifted coordinate and the original coordinate, and a bitwise AND operation between the bitwise OR operation coordinate and the mask, according to the preset rules, to obtain the z-direction index value. The index combination submodule is used to perform shifting and bitwise OR operations on the x-direction index value, y-direction index value and z-direction index value to obtain the first index value of any point.

8. The laser point cloud background difference system according to claim 6, characterized in that, The sorting module includes: The index pair calculation submodule is used to form an index pair with the first index value corresponding to each point and its original sequence number, and sort them in ascending order according to the original sequence number to obtain the sorted input data; The data allocation submodule is used to divide the sorted input data into multiple data segments and assign each data segment to a computing core for processing; The slice sorting submodule is used to divide each data segment into multiple slices and execute the import task, sorting task and import task in sequence for each slice; different tasks between different slices are processed in parallel. The merge submodule is used to merge the sorting results of each slice to obtain the sorting result of the data segment, and then merge the sorting results of each data segment to obtain the first sorted point cloud.

9. The laser point cloud background difference system according to claim 6, characterized in that, The differential module includes: The raster layering submodule is used to divide the raster corresponding to each point in the first sorted point cloud and the second sorted point cloud into layers according to the difference in the last digit of the index value. The starting point determination submodule is used to find, for the current point in the first sorted point cloud, the point in the second sorted point cloud that has the closest second index value to the first index value of the current point, and take that point as the starting point for the search. The target layer determination submodule is used to determine, layer by layer from low to high, whether the grid corresponding to the current point is the boundary grid of the current layer. If it is, the boundary grid of the next higher layer is determined; otherwise, the current layer is recorded as the target layer. The first determination submodule is used to, when the target layer is less than a preset number of layers, start from the search starting point and sequentially search for the number of neighboring points in the positive and negative directions of the second sorted point cloud. If the number of neighboring points reaches a preset threshold, the current point is determined to be a background point. If the number of neighboring points still does not reach the preset threshold by the end of the search in the negative direction, the current point is determined to be a foreground point. When the search point and the current point are not on the same layer, the search in either direction ends. The second determination submodule is used to, when the target layer is greater than or equal to a preset number of layers, search for neighboring points in the eight grids surrounding the grid corresponding to the search starting point, with the search starting point as the starting point, in the positive and negative directions of the second sorted point cloud respectively, count the total number of neighboring points, and if the total number is greater than a preset number threshold, determine the current point as a background point. The third determination submodule is used to construct a KDTree for all points in the adjacent grids of the grid corresponding to the search starting point and perform a radius search for the remaining points for the remaining points. When the number of neighboring points found is greater than or equal to the preset number threshold, the remaining points are determined to be background points; otherwise, they are foreground points.

10. The laser point cloud background difference system according to claim 6, characterized in that, The preprocessing module includes: The first redundant point removal submodule is used to perform pass-through filtering on the current frame point cloud according to the defense zone range; The second redundant point removal submodule is used to perform ground fitting and remove points below the ground in the current frame point cloud based on the fitting result.

Citation Information

Patent Citations

  • Laser radar identification method and device, electronic equipment and storage medium

    CN114495026A

  • Morton code construction method, encoder, decoder and storage medium

    CN114868153A

  • Data processing method and device, automatic driving system, electronic equipment and storage medium

    CN119268710A

  • Reflective material robot grabbing pose detection method based on background plane point cloud

    CN120543638A

  • Point cloud data transmission method, point cloud data transmission device, point cloud data reception method, and point cloud data reception device

    US20240242390A1