Point cloud filtering method and computer device
By converting the point cloud data collected by the laser scanning device to the lidar coordinate system and classifying and filtering it, the problem of filtering without distinguishing distance in the existing technology is solved, and accurate filtering and feature preservation of point cloud data are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI SHUANGWEI NAVIGATION TECH CO LTD
- Filing Date
- 2023-06-28
- Publication Date
- 2026-07-14
Smart Images

Figure CN116819487B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of point cloud filtering technology, and more specifically, to a point cloud filtering method and computer device. Background Technology
[0002] LiDAR is a radar system that uses emitted laser beams to detect the position, velocity, and other characteristics of targets. As a type of high-precision 3D data, LiDAR point cloud data is increasingly widely used in 3D modeling. The purpose of point cloud filtering is to remove noise from point cloud data and smooth the surface of the point cloud data. Therefore, LiDAR point cloud filtering is of great significance for the analysis of point cloud data.
[0003] Research has found that the level of point cloud noise varies significantly when the distance between the target and the lidar is different. Existing lidar point cloud filtering methods use the same filtering algorithm to filter point cloud data of targets at different distances without differentiating the point cloud filtering algorithm used according to the different distances of the target. This leads to excessive filtering of point cloud noise and an overly smooth surface of the point cloud data, which loses the original characteristics of the point cloud data. Summary of the Invention
[0004] The purpose of this application is to address the shortcomings of the prior art by providing a point cloud filtering method and computer device, so as to solve the problem that existing filtering algorithms do not differentiate between point cloud filtering algorithms used based on different distances from the target object.
[0005] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows:
[0006] In a first aspect, embodiments of this application provide a point cloud filtering method, including:
[0007] Acquire initial point cloud data collected by a laser scanning device for a preset scene and the movement trajectory of the laser scanning device; the movement trajectory includes: the translation amount and rotation vector of each point cloud in the initial point cloud data;
[0008] Based on the initial point cloud data and the movement trajectory, each point cloud in the initial point cloud data is transformed from the device coordinate system of the laser scanning device to the laser coordinate system of the lidar in the laser scanning device to obtain the transformed point cloud data.
[0009] Based on the coordinates of the transformed point cloud data, the transformed point cloud data is classified to obtain at least two types of point cloud data;
[0010] Based on at least two types of filtering algorithms, the point cloud data of the at least two types are filtered respectively to obtain the filtered point cloud data of the at least two types.
[0011] The filtered point cloud data of the at least two types are merged to generate the target point cloud data of the preset scene.
[0012] In one embodiment, the at least two types of point cloud data include: non-ground point cloud data and ground point cloud data;
[0013] The step of filtering the point cloud data according to at least two types of filtering algorithms to obtain the filtered point cloud data of at least two types includes:
[0014] The non-ground point cloud data is filtered according to the filtering algorithm of the non-ground point cloud data to obtain non-ground filtered point cloud data.
[0015] The ground point cloud data is filtered according to the filtering algorithm to obtain filtered ground point cloud data.
[0016] In one embodiment, the step of classifying the transformed point cloud data according to its coordinates to obtain at least two categories of point cloud data includes:
[0017] Based on the values of preset coordinate axes in the coordinates of the transformed point cloud data, the transformed point cloud data is classified to obtain the non-ground point cloud data and the ground point cloud data.
[0018] In one embodiment, before filtering the non-ground point cloud data according to the filtering algorithm of the non-ground point cloud data to obtain the non-ground filtered point cloud data, the method further includes:
[0019] Based on the coordinates of each first point cloud in the non-ground point cloud data, calculate the curvature parameter of each first point cloud;
[0020] Based on the curvature parameters of each first point cloud, the non-ground point cloud data is classified by curvature to obtain non-ground point cloud data with at least one curvature range.
[0021] The step of filtering the non-ground point cloud data according to the filtering algorithm to obtain filtered non-ground point cloud data includes:
[0022] The filtering algorithm corresponding to the at least one curvature range is used to filter the non-ground point cloud data of the at least one curvature range respectively to obtain the filtered non-ground point cloud data of the at least one curvature range.
[0023] The filtered non-ground point cloud data within the at least one curvature range are merged to obtain the filtered non-ground point cloud data.
[0024] In one embodiment, calculating the curvature parameter of each first point cloud based on the coordinates of each first point cloud in the non-ground point cloud data includes:
[0025] The curvature parameters of each first point cloud are calculated based on the coordinates of each first point cloud in the non-ground point cloud data and the coordinates of a first preset number of adjacent point clouds.
[0026] In one embodiment, the at least one curvature range includes: a first curvature range that is less than a preset curvature threshold;
[0027] The step of using a filtering algorithm corresponding to at least one curvature range to filter the non-ground point cloud data within the at least one curvature range to obtain filtered non-ground point clouds within at least one curvature range includes:
[0028] Using the distance smoothing algorithm corresponding to the first curvature range, the distance between each first non-ground point cloud in the first curvature range and a second preset number of adjacent first non-ground point clouds is adjusted to obtain the filtered non-ground point cloud of the first curvature range.
[0029] In one embodiment, the at least one curvature range further includes a second curvature range that is greater than or equal to the preset curvature threshold;
[0030] The step of using a filtering algorithm corresponding to at least one curvature range to filter the non-ground point cloud data within the at least one curvature range to obtain filtered non-ground point clouds within at least one curvature range includes:
[0031] According to the radius filtering algorithm corresponding to the second curvature range, the non-ground point clouds in the non-ground point cloud of the second curvature range that are closest to each second non-ground point cloud and whose distance is greater than or equal to a preset distance threshold are filtered out, so as to obtain the filtered non-ground point cloud of the second curvature range.
[0032] In one embodiment, before filtering the ground point cloud data according to the filtering algorithm of the ground point cloud data to obtain filtered ground point cloud data, the method further includes:
[0033] Based on the coordinates of each second point cloud in the ground point cloud data, calculate the distance between each second point cloud and the laser scanning device;
[0034] Based on the distance between each of the second point clouds and the laser scanning device, ground point cloud data within a first distance range is determined from each of the second point clouds;
[0035] The step of filtering the ground point cloud data according to the filtering algorithm to obtain filtered ground point cloud data includes:
[0036] Using the distance smoothing algorithm corresponding to the first distance range, the distance between each first ground point cloud and a third preset number of adjacent first ground point clouds in the ground point cloud data of the first distance range is adjusted to obtain the ground filtered point cloud data.
[0037] In one embodiment, before merging the filtered point cloud data of the at least two types to generate the target point cloud data of the preset scene, the method further includes:
[0038] Based on the distance between each of the second point clouds and the laser scanning device, ground point cloud data within a second distance range is determined from each of the second point clouds;
[0039] The step of merging the filtered point cloud data of the at least two types to generate the target point cloud data of the preset scene includes:
[0040] Based on the coordinates of the ground point cloud data within the second distance range, the non-ground filtered point cloud data, the ground filtered point cloud data, and the ground point cloud data within the second distance range are merged to generate the target point cloud data of the preset scene.
[0041] Secondly, embodiments of this application also provide a computer device, including: a processor, a storage medium, and a bus. The storage medium stores program instructions executable by the processor. When the computer device is running, the processor communicates with the storage medium via the bus, and the processor executes the program instructions to perform the steps of the point cloud filtering method as described in the above embodiments.
[0042] Thirdly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the point cloud filtering method as described in the above embodiments.
[0043] Fourthly, embodiments of this application provide a point cloud filtering device, comprising:
[0044] The acquisition module is used to acquire initial point cloud data collected by the laser scanning device for a preset scene and the movement trajectory of the laser scanning device; the movement trajectory includes: the trajectory translation amount and rotation vector of each point cloud in the initial point cloud data;
[0045] The conversion module is used to convert each point cloud in the initial point cloud data from the device coordinate system of the laser scanning device to the laser coordinate system of the lidar in the laser scanning device, based on the initial point cloud data and the movement trajectory, to obtain the converted point cloud data.
[0046] The classification module is used to classify the transformed point cloud data according to the coordinates of the transformed point cloud data to obtain point cloud data of at least two categories.
[0047] A filtering module is used to filter the at least two types of point cloud data according to at least two types of filtering algorithms to obtain the at least two types of filtered point cloud data.
[0048] The merging module is used to merge the filtered point cloud data of the at least two types to generate the target point cloud data of the preset scene.
[0049] The beneficial effects of this application are as follows: This application provides a point cloud filtering method and a computer device. The method includes: acquiring initial point cloud data collected by a laser scanning device for a preset scene and the movement trajectory of the laser scanning device; the movement trajectory includes: the trajectory translation and rotation vector of each point cloud in the initial point cloud data; based on the initial point cloud data and the movement trajectory, transforming each point cloud in the initial point cloud data from the device coordinate system of the laser scanning device to the laser coordinate system of the lidar in the laser scanning device to obtain transformed point cloud data; classifying the transformed point cloud data according to the coordinates of the transformed point cloud data to obtain at least two types of point cloud data; filtering the at least two types of point cloud data according to the at least two types of filtering algorithms to obtain at least two types of filtered point cloud data; merging the at least two types of filtered point cloud data to generate target point cloud data for the preset scene.
[0050] The point cloud filtering method of this application can divide point cloud data into at least two different types according to coordinates. Furthermore, different types of filtering algorithms that match the data structure of different types of point cloud data can be used to preserve the original features of the point cloud data and avoid over-filtering and excessive smoothing of point cloud data caused by using mismatched filtering algorithms. Attached Figure Description
[0051] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0052] Figure 1A schematic flowchart of the point cloud filtering method provided in the embodiments of this application;
[0053] Figure 2 A schematic flowchart of a method for filtering at least two types of point cloud data according to an embodiment of this application;
[0054] Figure 3 This is a schematic flowchart of a method for filtering non-terrestrial point cloud data according to an embodiment of this application;
[0055] Figure 4 One of the schematic flowcharts of a method for filtering ground point cloud data provided in this application;
[0056] Figure 5 This application provides a second schematic flowchart of a method for filtering ground point cloud data according to an embodiment;
[0057] Figure 6 A schematic diagram of the structure of a computer device provided in one embodiment of this application;
[0058] Figure 7 This is a schematic diagram of the structure of a point cloud filtering device provided in an embodiment of this application. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of this application, but not all embodiments.
[0060] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0061] Furthermore, the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Additionally, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0062] It should be noted that, where there is no conflict, the features in the embodiments of this application can be combined with each other.
[0063] As a high-precision 3D data, LiDAR point cloud data is increasingly widely used in 3D modeling in computer vision, robotics, and geographic information systems. Point cloud filtering can remove noise and smooth the surface of point cloud data. Therefore, point cloud filtering is an essential tool for LiDAR point cloud data analysis. Noise removal can help remove irregular noise caused by LiDAR sensor noise, speckle, or other interference factors, while surface smoothing can smooth the surface of point cloud data and eliminate local high-frequency oscillations. Point cloud filtering is of great significance for the analysis of point cloud data.
[0064] Research has found that the level of point cloud noise varies significantly depending on the distance between the target and the lidar. Therefore, to make the filtered point cloud data more consistent with the true values, different filtering algorithms should be used for point cloud data at different distances. However, existing lidar point cloud filtering algorithms use the same filtering algorithm to filter point cloud data from targets at different distances, without differentiating the filtering algorithm used based on the different distances of the target. This leads to excessive filtering of point cloud noise, an overly smooth point cloud data surface, and loss of the original characteristics of the point cloud data, resulting in distortion of the 3D model image built from the point cloud data.
[0065] Therefore, this application provides a point cloud filtering method, which can solve the problems existing in the prior art. It should be noted that the point cloud filtering method can be generated by any computer device that integrates a preset point cloud filtering method generation algorithm. The computer device can be, for example, a terminal-facing computer device or a backend server.
[0066] The point cloud filtering method provided in this application is illustrated below with reference to the accompanying drawings and several examples.
[0067] Figure 1 This is a flowchart illustrating the point cloud filtering method provided in an embodiment of this application. Figure 1 As shown, the method includes:
[0068] S101. Acquire the initial point cloud data collected by the laser scanning device for the preset scene and the movement trajectory of the laser scanning device.
[0069] First, an example of the application scenario of this embodiment is given. The point cloud filtering method in this embodiment can be used to filter point cloud data collected by a laser scanning device for a preset scene. The laser scanning device can be, for example, a laser radar device that includes a laser radar, and the preset scene can be any scene determined according to actual sampling requirements. This embodiment does not limit the preset scene.
[0070] In this embodiment, the point cloud data collected by the laser scanning device for the preset scene is point cloud data in the device coordinate system of the laser scanning device. The laser scanning device contains a lidar and other devices. If the point cloud data of the preset scene is to be classified so that different types of point cloud filtering algorithms are used according to the different types of the classified point cloud data, the point cloud data in the device coordinate system of the laser scanning device needs to be converted to the laser coordinate system of the lidar in the laser scanning device.
[0071] Therefore, in this embodiment, firstly, it is necessary to acquire the initial point cloud data collected by the laser scanning device for the preset scene and the movement trajectory of the laser scanning device. Based on the initial point cloud data and the movement trajectory, each point cloud in the initial point cloud data is transformed from the device coordinate system of the laser scanning device to the laser coordinate system of the lidar in the laser scanning device. The movement trajectory includes the trajectory translation and rotation vector of each point cloud in the initial point cloud data. That is, after the trajectory translation and rotation vector transformation, each point cloud in the initial point cloud data can be transformed into the laser coordinate system of the lidar in the laser scanning device. See step S102 for a detailed description.
[0072] S102. Based on the initial point cloud data and the movement trajectory, transform each point cloud in the initial point cloud data from the device coordinate system of the laser scanning device to the laser coordinate system of the lidar in the laser scanning device to obtain the transformed point cloud data, as shown in formula (1).
[0073] Pn = R -1 (Ps-t) (1)
[0074] Where Ps represents the initial point cloud data in the device coordinate system of the laser scanning device, R represents the trajectory rotation matrix that transforms the initial point cloud data into the laser coordinate system of the lidar based on the rotation vector in the movement trajectory, t represents the trajectory translation vector that transforms the initial point cloud data into the laser coordinate system of the lidar based on the trajectory translation amount, and Pn represents the transformed point cloud data in the laser coordinate system of the lidar.
[0075] S103. Based on the coordinates of the converted point cloud data, classify the converted point cloud data to obtain at least two types of point cloud data.
[0076] In this embodiment, the point cloud data of the initial point cloud data in the device coordinate system of the laser scanning device, and the transformed point cloud data in the laser coordinate system of the lidar, can both be represented in three-dimensional coordinate form.
[0077] Once the converted point cloud data is obtained, it can be classified according to its coordinates. Since this embodiment uses different point cloud filtering algorithms to filter the point cloud data based on its different types, at least two types of point cloud data must be obtained. For a detailed description of the at least two types of point cloud data, please refer to the following embodiment.
[0078] S104. Based on at least two types of filtering algorithms, filter at least two types of point cloud data respectively to obtain at least two types of filtered point cloud data.
[0079] Once at least two types of point cloud data are obtained, filtering algorithms of at least two types can be applied to each type of point cloud data to obtain filtered point cloud data of at least two types. Specifically, the at least two types of filtering algorithms are matched to the data structures of the at least two types of point cloud data; that is, filtering the at least two types of point cloud data using at least two types of filtering algorithms can preserve the original geometric, texture, or other structural features of the filtered point cloud data.
[0080] S105. Merge at least two types of filtered point cloud data to generate target point cloud data for a preset scene.
[0081] After filtering at least two types of point cloud data to obtain at least two types of filtered point cloud data, merging these filtered point cloud data yields the target point cloud data for a preset scene. Target point cloud data refers to the point cloud data obtained after filtering the transformed point cloud data in the laser coordinate system of the LiDAR. In practical applications, after obtaining the target point cloud data, it can also be converted to the device coordinate system of the laser scanning equipment for easier subsequent use.
[0082] In summary, this embodiment provides a point cloud filtering method: First, initial point cloud data collected by a laser scanning device for a preset scene and the movement trajectory of the laser scanning device are acquired; then, based on the initial point cloud data and the movement trajectory, each point cloud in the initial point cloud data is transformed from the device coordinate system of the laser scanning device to the laser coordinate system of the lidar in the laser scanning device, resulting in transformed point cloud data; second, based on the coordinates of the transformed point cloud data, the transformed point cloud data is classified to obtain at least two types of point cloud data; third, based on the filtering algorithms of at least two types, the at least two types of point cloud data are filtered respectively to obtain at least two types of filtered point cloud data; finally, the at least two types of filtered point cloud data are merged to generate target point cloud data for the preset scene.
[0083] The point cloud filtering method provided in this embodiment can divide the point cloud data into at least two different types based on the coordinates of the point cloud data. Furthermore, different types of filtering algorithms that match the data structure are used for different types of point cloud data, which can preserve the original features of the point cloud data and avoid point cloud data filtering or over-smoothing caused by using mismatched filtering algorithms.
[0084] In one embodiment of this application, in step S103, the point cloud data of at least two types may include non-ground point cloud data and ground point cloud data. Specifically, the point cloud data can be divided as follows: based on the values of preset coordinate axes in the coordinates of the converted point cloud data, the converted point cloud data is classified to obtain non-ground point cloud data and ground point cloud data. Here, the preset coordinate axis refers to the direction perpendicular to the horizontal direction. Taking the coordinate axes of a three-dimensional coordinate system in the horizontal direction as the x-axis and y-axis as an example, the preset coordinate axis in this embodiment can be understood as the z-axis. Non-ground point cloud data is point cloud data where z>0m, and ground point cloud data is point cloud data where z<0m.
[0085] If the point cloud data includes at least two types of non-ground point cloud data and ground point cloud data, then in step S104, the point cloud data of at least two types is filtered according to the filtering algorithms of at least two types to obtain the filtered point cloud data of at least two types. This means that the non-ground point cloud data and the ground point cloud data are filtered according to the filtering algorithms of the corresponding types of non-ground point cloud data and ground point cloud data.
[0086] Figure 2 This is a schematic flowchart of a method for filtering at least two types of point cloud data according to an embodiment of this application, as shown below. Figure 2 As shown, in step S104, at least two types of point cloud data are filtered according to at least two types of filtering algorithms to obtain at least two types of filtered point cloud data, including:
[0087] S201. Based on the filtering algorithm for non-ground point cloud data, filter the non-ground point cloud data to obtain filtered non-ground point cloud data.
[0088] S202. Based on the filtering algorithm of the ground point cloud data, filter the ground point cloud data to obtain the filtered ground point cloud data.
[0089] In this embodiment, the converted point cloud data is classified to obtain non-ground point cloud data and ground point cloud data. The non-ground point cloud data and ground point cloud data are filtered according to at least two types of filtering algorithms to obtain at least two types of filtered point cloud data. This achieves the purpose of determining the corresponding filtering algorithm based on the type of converted point cloud data, making the filtering algorithm more compatible with the structure of the converted point cloud data.
[0090] In one embodiment, the non-ground point cloud data can be divided into point cloud data at corner locations and point cloud data at wall locations. The curvature value of the point cloud data at corner locations is larger, while the curvature value of the point cloud data at wall locations is smaller. Therefore, the non-ground point cloud data can be further divided based on the curvature value.
[0091] Figure 3 This is a schematic flowchart of a method for filtering non-terrestrial point cloud data according to an embodiment of this application, as shown below. Figure 3 As shown, before step S201 filters the non-ground point cloud data according to the filtering algorithm for non-ground point cloud data to obtain the filtered non-ground point cloud data, it may further include:
[0092] S301. Calculate the curvature parameters of each first point cloud based on the coordinates of each first point cloud in the non-ground point cloud data.
[0093] Obtaining the non-ground point cloud data means obtaining the coordinates of each first point cloud in the non-ground point cloud data. Based on the coordinates of each first point cloud in the non-ground point cloud data, the curvature parameters of each first point cloud can be calculated. Here, the first point cloud refers to each point cloud data in the non-ground point cloud data.
[0094] Specifically, it can be done by: calculating the curvature parameter C of each first point cloud based on the coordinates of each first point cloud in the non-ground point cloud data and the coordinates of the first preset number of adjacent point clouds. The calculation formula can be found in formulas (2)-(3).
[0095]
[0096]
[0097] Where k is 20, indicating that each first point cloud uses its 20 adjacent point clouds to calculate the curvature parameter C, p i This represents the coordinates of the adjacent point clouds corresponding to each first point cloud. λ represents the average coordinates of the corresponding adjacent point clouds. j This represents the j-th eigenvalue of the feature matrix corresponding to non-ground point cloud data. This represents the eigenvector corresponding to the j-th eigenvalue.
[0098] S302. Based on the curvature parameters of each first point cloud, perform curvature classification on the non-ground point cloud data to obtain non-ground point cloud data with at least one curvature range.
[0099] After calculating the curvature parameters of each first point cloud, the non-ground point cloud data can be classified according to the curvature parameters of each first point cloud to obtain non-ground point cloud data with at least one curvature range, thereby completing the classification of non-ground point cloud data. This facilitates the use of different types of filtering algorithms to filter non-ground point cloud data of different classifications. For a detailed description of the classification method, please refer to the following embodiments.
[0100] In step S201, filtering the non-ground point cloud data according to the filtering algorithm for non-ground point cloud data to obtain filtered non-ground point cloud data may include:
[0101] S303. Using at least one filtering algorithm corresponding to at least one curvature range, filter the non-ground point cloud data of at least one curvature range respectively to obtain filtered non-ground point cloud data of at least one curvature range.
[0102] If the non-ground point cloud data is divided into at least one curvature range, then when filtering the non-ground point cloud data, a filtering algorithm corresponding to at least one curvature range can be used to filter the non-ground point cloud data of at least one curvature range respectively, so as to obtain filtered non-ground point cloud data of at least one curvature range.
[0103] S304. Merge the filtered non-ground point cloud data within at least one curvature range to obtain filtered non-ground point cloud data.
[0104] After filtering non-ground point cloud data within at least one curvature range to obtain filtered non-ground point cloud data within at least one curvature range, the filtered non-ground point cloud data within at least one curvature range are merged to obtain filtered non-ground point cloud data, thus completing the filtering of non-ground point cloud data.
[0105] In this embodiment, the non-ground point cloud data is divided into at least one curvature range, which realizes the classification of the non-ground point cloud data. The corresponding filtering algorithm can be determined according to the type of non-ground point cloud data, so that the filtering algorithm is more compatible with the structure of the non-ground point cloud data.
[0106] One embodiment of this application provides a possible implementation of at least one curvature range, which may include: a first curvature range less than a preset curvature threshold.
[0107] The preset curvature threshold is a value determined according to actual needs. For example, the curvature boundary value between the corner position and the wall position can be used as the preset curvature threshold. Thus, the corner position and the wall position can be classified according to the preset curvature threshold. This embodiment does not limit the specific value of the preset curvature threshold.
[0108] In step S303, at least one filtering algorithm corresponding to a curvature range is used to filter the non-ground point cloud data of at least one curvature range to obtain a filtered non-ground point cloud of at least one curvature range. This may include: using a distance smoothing algorithm corresponding to a first curvature range to adjust the distance between each first non-ground point cloud in the first curvature range and a second preset number of adjacent first non-ground point clouds to obtain a filtered non-ground point cloud of the first curvature range.
[0109] After dividing the non-ground point cloud data smaller than the preset curvature threshold into a first curvature range, as described in the above embodiments, the non-ground point cloud data in the first curvature range is generally located on walls, the ground, etc. Due to the inherent errors of the lidar itself and the calculation errors of the laser scanning equipment on the point cloud data obtained by the lidar, the thickness of the non-ground point cloud data in these locations is generally 6-8 cm. When using point cloud data for surveying, mapping, and other applications, a larger thickness will cause errors in the results. Therefore, this embodiment uses a distance smoothing algorithm based on distance weight to adjust the distance between each first non-ground point cloud in the first curvature range and a second preset number of adjacent first non-ground point clouds to obtain the filtered non-ground point cloud in the first curvature range. Here, the first non-ground point cloud refers to the non-ground point cloud data in the first curvature range, and the second preset number can be, for example, 30 or other values. Specifically:
[0110] A kd-tree (short for k-dimensional tree) is a data structure for partitioning k-dimensional data space. It is mainly used for searching key data in multi-dimensional space (such as range search and nearest neighbor search). In this embodiment, outputting non-ground point cloud data as a kd-tree structure can speed up the search of point clouds. The distance between each first non-ground point cloud and its 30 adjacent first non-ground point clouds in the non-ground point cloud data under the first curvature range is found. The distance is used to calculate the distance weight for filtering each first non-ground point cloud. The method for calculating the distance weight can be referred to formulas (4)-(5).
[0111] P=∑λ i p i (4)
[0112] λ i =S i / S, i∈{0,1,2,……30} (5)
[0113] Where Si represents the distance from a point cloud adjacent to a first non-ground point cloud to that point cloud, S represents the sum of the distances from all adjacent point clouds to that point cloud, Pi represents the three-dimensional coordinate information of the corresponding nearest neighbor point, and P represents the three-dimensional coordinates of the point cloud obtained after filtering the first non-ground point cloud.
[0114] In this embodiment, a distance smoothing algorithm based on distance weight is used to adjust the distance between each of the first non-ground point clouds in the non-ground point cloud of the first curvature range and a second preset number of adjacent first non-ground point clouds. This can be understood as follows: for point clouds in the first non-ground point cloud that are located higher, the point cloud can be pulled down by a certain range; for point clouds in the first non-ground point cloud that are located lower, the point cloud can be pulled up by a certain range. Through the distance smoothing algorithm, the thickness of the first non-ground point cloud is optimized while filtering.
[0115] One embodiment of this application provides another possible implementation of at least one curvature range, which may further include a second curvature range that is greater than or equal to a preset curvature threshold.
[0116] In step S303, at least one filtering algorithm corresponding to a curvature range is used to filter the non-ground point cloud data of at least one curvature range to obtain a filtered non-ground point cloud of at least one curvature range. This may include: according to the radius filtering algorithm corresponding to the second curvature range, filtering out the non-ground point clouds in the non-ground point cloud of the second curvature range whose distance to the nearest adjacent second non-ground point clouds is greater than or equal to a preset distance threshold, to obtain a filtered non-ground point cloud of the second curvature range. The second non-ground point cloud refers to the non-ground point cloud data in the second curvature range.
[0117] After dividing the non-ground point cloud data with a curvature threshold greater than or equal to the preset curvature threshold into a second curvature range, as described in the above embodiments, the non-ground point cloud data in the second curvature range is generally located at corner positions and usually contains obvious noise points, such as sky points and wall noise points. These noise points are usually a certain distance away from non-noise points. Therefore, this embodiment uses a radius filtering algorithm to effectively remove noise from the non-ground point cloud data in the second curvature range. The radius filtering algorithm is as follows:
[0118] The non-ground point cloud data is output as a kd-tree structure. The non-ground point cloud that is closest to each other in the non-ground point cloud of the second curvature range is found to be a non-ground point cloud with a distance greater than or equal to a preset distance threshold. The non-ground point clouds with a distance greater than or equal to the preset distance threshold are filtered out to obtain the filtered non-ground point cloud of the second curvature range.
[0119] The preset distance threshold is a value determined according to actual needs, such as 1cm or other values. Taking a preset distance threshold of 1cm as an example, in this embodiment, the non-ground point cloud with the closest adjacent second non-ground point cloud to each second non-ground point cloud is calculated, and the non-ground point cloud with a distance greater than or equal to 1cm is filtered out to obtain the filtered non-ground point cloud of the second curvature range.
[0120] In this embodiment, a radius filtering algorithm is used to filter out second non-ground point clouds whose distance from other second non-ground point clouds is greater than or equal to a preset distance threshold, thereby achieving filtering of the second non-ground point clouds.
[0121] In one embodiment, the ground point cloud data can also be divided into two different types based on the distance between the ground point cloud data and the laser scanning device.
[0122] Figure 4 One embodiment of this application provides a schematic flowchart of a method for filtering ground point cloud data, such as... Figure 4 As shown, in step S202, before filtering the ground point cloud data according to the filtering algorithm to obtain the filtered ground point cloud data, the following steps may also be included:
[0123] S401. Calculate the distance between each second point cloud and the laser scanning device based on the coordinates of each second point cloud in the ground point cloud data.
[0124] Obtaining the ground point cloud data means obtaining the coordinates of each second point cloud in the ground point cloud data. Based on the coordinates of each second point cloud in the ground point cloud data, the distance between each second point cloud and the laser scanning device can be calculated, and the ground point cloud data can be classified based on this distance. Here, the second point cloud refers to each point cloud data in the ground point cloud data, and the calculation method can be referred to formula (6).
[0125]
[0126] Where S represents the distance from each second point cloud to the lidar in the laser scanning device, and (x,y,z) represents the three-dimensional coordinates of the second point cloud.
[0127] S402. Based on the distance between each second point cloud and the laser scanning device, determine the ground point cloud data within a first distance range from each second point cloud.
[0128] First, based on the distance between each second point cloud and the laser scanning device, ground point cloud data within a first distance range is determined from each second point cloud. The first distance range is ground point cloud data whose distance from the laser scanning device is less than a preset value. In this embodiment, the preset value can be, for example, 20m. That is, the ground point cloud data within the first distance range is ground point cloud data whose distance from the laser scanning device is less than 20m.
[0129] In step S202, the ground point cloud data is filtered according to the filtering algorithm to obtain filtered ground point cloud data, which may include:
[0130] S403. Using a distance smoothing algorithm corresponding to the first distance range, the distance between each first ground point cloud and a third preset number of adjacent first ground point clouds in the ground point cloud data of the first distance range is adjusted to obtain ground filtered point cloud data.
[0131] The first ground point cloud refers to the ground point cloud data within the first distance range. The distance smoothing algorithm can refer to the formulas (4)-(5) provided in the above embodiment. This embodiment will not repeat them. The third preset number can be any value determined according to actual needs. Taking the third preset number as 20 as an example, it means that the distance weight in the distance smoothing algorithm is calculated based on the distance between each first ground point cloud and 20 adjacent first ground point clouds in the ground point cloud data within the first distance range.
[0132] In one embodiment, it can be assumed that ground point cloud data that are more than a preset value away from the laser scanning device do not need to be merged into the filtered point cloud data of the above embodiment. However, if they are not merged at all, there will be some defects at the boundary after merging the filtered point cloud data of the above embodiment. Therefore, an embodiment of this application provides a possible implementation method for merging ground point cloud data that are more than a preset value away.
[0133] Figure 5 This application provides a second schematic flowchart of a method for filtering ground point cloud data according to an embodiment, as shown below. Figure 5 As shown, before merging the filtered point cloud data of at least two types in step S105 to generate the target point cloud data of the preset scene, the following may also be included:
[0134] S501. Based on the distance between each second point cloud and the laser scanning device, determine the ground point cloud data within the second distance range from each second point cloud.
[0135] Based on the distance between each second point cloud and the laser scanning device, ground point cloud data within a second distance range is determined from each second point cloud. The second distance range is ground point cloud data whose distance from the laser scanning device is greater than or equal to a preset value. In this embodiment, the preset value can be, for example, 20m. That is, the ground point cloud data within the second distance range is ground point cloud data whose distance from the laser scanning device is greater than or equal to 20m.
[0136] In step S105, merging at least two types of filtered point cloud data to generate target point cloud data for a preset scene may include:
[0137] S502. Based on the coordinates of the ground point cloud data within the second distance range, merge the non-ground filtered point cloud data, the ground filtered point cloud data, and the ground point cloud data within the second distance range to generate target point cloud data for the preset scene.
[0138] In this embodiment, the non-ground filtered point cloud data, the ground filtered point cloud data, and the ground point cloud data within the second distance range are first merged. Then, based on the z-axis distance between the ground point cloud data within the second distance range and the merged point cloud, the ground point cloud data within the second distance range is merged with the non-ground filtered point cloud data, the ground filtered point cloud data, and the ground point cloud data within the second distance range. This can be divided into three cases:
[0139] 1. If the z-axis distance between the ground point cloud data in the second distance range and the point cloud data merged in the above embodiment is less than 1 cm, the ground point cloud data in this second distance range is considered to be non-noise points and is merged with the filtered point cloud data.
[0140] 2. If the z-axis distance between the ground point cloud data in the second distance range and the point cloud data merged in the above embodiment is greater than 1 cm, and the x-axis and y-axis distance is less than 5 cm, then the ground point cloud data in this second distance range is considered to be point cloud boundary points and is merged with the filtered point cloud data.
[0141] 3. If the z-axis distance between the ground point cloud data in the second distance range and the point cloud data merged in the above embodiment is greater than 1cm, and the x-axis and y-axis distance is greater than 5cm, such points are considered to be non-boundary noise points and are directly removed.
[0142] In this embodiment, the ground point cloud data is divided into a first distance range and a second distance range, which realizes the classification of the ground point cloud data. The corresponding filtering algorithm can be determined according to the type of ground point cloud data, so that the filtering algorithm is more compatible with the structure of the ground point cloud data.
[0143] The following will continue to explain the computer equipment, storage medium and apparatus corresponding to the point cloud filtering method provided in any of the above embodiments of this application. The specific implementation process and the resulting technical effects are the same as those in the corresponding method embodiments. For the sake of brevity, the parts not mentioned in this embodiment can be referred to the corresponding content in the method embodiments.
[0144] One embodiment of this application also provides a computer device. Figure 6 A schematic diagram of the structure of a computer device provided in one embodiment of this application is shown below. Figure 6 As shown, the computer device includes a processor 601, a storage medium 602, and a bus 603. The storage medium stores program instructions that can be executed by the processor. When the computer device is running, the processor communicates with the storage medium through the bus, and the processor executes the program instructions to perform the steps of the point cloud filtering method provided in the above embodiments.
[0145] Optionally, one embodiment of this application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the point cloud filtering method provided in the above embodiments.
[0146] Optionally, one embodiment of this application provides a point cloud filtering device. Figure 7 This is a schematic diagram of the structure of a point cloud filtering device provided in an embodiment of this application, as shown below. Figure 7 As shown, the device includes:
[0147] The acquisition module 701 is used to acquire the initial point cloud data collected by the laser scanning device for a preset scene and the movement trajectory of the laser scanning device; the movement trajectory includes: the trajectory translation amount and rotation vector of each point cloud in the initial point cloud data.
[0148] The conversion module 702 is used to convert each point cloud in the initial point cloud data from the device coordinate system of the laser scanning device to the laser coordinate system of the lidar in the laser scanning device, based on the initial point cloud data and the movement trajectory, to obtain the converted point cloud data.
[0149] The classification module 703 is used to classify the transformed point cloud data according to the coordinates of the transformed point cloud data to obtain point cloud data of at least two categories.
[0150] The filtering module 704 is used to filter the at least two types of point cloud data according to at least two types of filtering algorithms to obtain the at least two types of filtered point cloud data.
[0151] The merging module 705 is used to merge the filtered point cloud data of the at least two types to generate the target point cloud data of the preset scene.
[0152] In a possible implementation example, the at least two types of point cloud data include: non-ground point cloud data and ground point cloud data; the filtering module 704 is further configured to filter the non-ground point cloud data according to the filtering algorithm of the non-ground point cloud data to obtain non-ground filtered point cloud data; and to filter the ground point cloud data according to the filtering algorithm of the ground point cloud data to obtain ground filtered point cloud data.
[0153] In a possible implementation example, the classification module 703 is further configured to classify the transformed point cloud data according to the values of preset coordinate axes in the coordinates of the transformed point cloud data, so as to obtain the non-ground point cloud data and the ground point cloud data.
[0154] In a possible implementation example, the point cloud filtering device further includes a calculation module for calculating the curvature parameters of each first point cloud based on the coordinates of each first point cloud in the non-ground point cloud data.
[0155] The classification module 703 is further configured to perform curvature classification on the non-ground point cloud data according to the curvature parameters of each first point cloud, so as to obtain non-ground point cloud data with at least one curvature range.
[0156] The filtering module 704 is used to filter the non-ground point cloud data of the at least one curvature range using the filtering algorithm corresponding to the at least one curvature range, so as to obtain the filtered non-ground point cloud data of the at least one curvature range.
[0157] The merging module 705 is used to merge the filtered non-ground point cloud data of the at least one curvature range to obtain the filtered non-ground point cloud data.
[0158] In a possible implementation example, the calculation module is further configured to calculate the curvature parameters of each first point cloud based on the coordinates of each first point cloud in the non-ground point cloud data and the coordinates of a first preset number of adjacent point clouds.
[0159] In a possible implementation example, the at least one curvature range includes: a first curvature range less than a preset curvature threshold; the filtering module 704 is further configured to use a distance smoothing algorithm corresponding to the first curvature range to adjust the distance between each first non-ground point cloud in the non-ground point cloud of the first curvature range and a second preset number of adjacent first non-ground point clouds, so as to obtain the filtered non-ground point cloud of the first curvature range.
[0160] In a possible implementation example, the at least one curvature range further includes: a second curvature range greater than or equal to the preset curvature threshold; the filtering module 704 is further configured to filter out non-ground point clouds in the non-ground point cloud of the second curvature range that are the closest adjacent second non-ground point clouds to each second non-ground point cloud and whose distance is greater than or equal to the preset distance threshold, according to the radius filtering algorithm corresponding to the second curvature range, so as to obtain the filtered non-ground point cloud of the second curvature range.
[0161] In a possible implementation example, the calculation module is further configured to calculate the distance between each second point cloud and the laser scanning device based on the coordinates of each second point cloud in the ground point cloud data.
[0162] The point cloud filtering device also includes a determination module, used to determine ground point cloud data within a first distance range from the second point clouds based on the distance between the second point clouds and the laser scanning device.
[0163] The filtering module 704 is further configured to use a distance smoothing algorithm corresponding to the first distance range to adjust the distance between each first ground point cloud and a third preset number of adjacent first ground point clouds in the ground point cloud data of the first distance range, so as to obtain the ground filtered point cloud data.
[0164] In a possible implementation example, the determining module is further configured to determine ground point cloud data of a second distance range from the respective second point clouds based on the distance between the respective second point clouds and the laser scanning device.
[0165] The merging module 705 is further configured to merge the non-ground filtered point cloud data, the ground filtered point cloud data, and the ground point cloud data within the second distance range according to the coordinates of the ground point cloud data within the second distance range, to generate the target point cloud data of the preset scene.
[0166] The above-described device is used to execute the method provided in the foregoing embodiments, and its implementation principle and technical effect are similar, so they will not be described again here.
[0167] These modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more microprocessors, or one or more Field Programmable Gate Arrays (FPGAs). Alternatively, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a system-on-a-chip (SOC).
[0168] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0169] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0170] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in a combination of hardware and software functional units.
[0171] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0172] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A point cloud filtering method, characterized in that, include: Acquire the initial point cloud data collected by the laser scanning device for a preset scene and the movement trajectory of the laser scanning device; The movement trajectory includes: the translation and rotation vectors of each point cloud in the initial point cloud data; Based on the initial point cloud data and the movement trajectory, each point cloud in the initial point cloud data is transformed from the device coordinate system of the laser scanning device to the laser coordinate system of the lidar in the laser scanning device to obtain the transformed point cloud data. Based on the coordinates of the transformed point cloud data, the transformed point cloud data is classified to obtain at least two types of point cloud data; Based on at least two types of filtering algorithms, the point cloud data of the at least two types are filtered respectively to obtain the filtered point cloud data of the at least two types. The filtered point cloud data of the at least two types are merged to generate the target point cloud data of the preset scene; The at least two types of point cloud data include: non-ground point cloud data and ground point cloud data; The step of filtering the point cloud data according to at least two types of filtering algorithms to obtain the filtered point cloud data of at least two types includes: According to the filtering algorithm of the non-ground point cloud data, the non-ground point cloud data is filtered to obtain non-ground filtered point cloud data; The ground point cloud data is filtered according to the filtering algorithm of the ground point cloud data to obtain filtered ground point cloud data. Before filtering the non-ground point cloud data according to the filtering algorithm for the non-ground point cloud data to obtain the filtered non-ground point cloud data, the method further includes: Based on the coordinates of each first point cloud in the non-ground point cloud data, calculate the curvature parameters of each first point cloud; Based on the curvature parameters of each first point cloud, the non-ground point cloud data is classified by curvature to obtain non-ground point cloud data with at least one curvature range. The step of filtering the non-ground point cloud data according to the filtering algorithm of the non-ground point cloud data to obtain filtered non-ground point cloud data includes: The filtering algorithm corresponding to the at least one curvature range is used to filter the non-ground point cloud data of the at least one curvature range respectively to obtain the filtered non-ground point cloud data of the at least one curvature range. The filtered non-ground point cloud data within the at least one curvature range are merged to obtain the filtered non-ground point cloud data.
2. The method according to claim 1, characterized in that, The transformed point cloud data is classified according to its coordinates to obtain at least two categories of point cloud data, including: Based on the values of preset coordinate axes in the coordinates of the transformed point cloud data, the transformed point cloud data is classified to obtain the non-ground point cloud data and the ground point cloud data.
3. The method according to claim 1, characterized in that, The step of calculating the curvature parameters of each first point cloud based on the coordinates of each first point cloud in the non-ground point cloud data includes: The curvature parameters of each first point cloud are calculated based on the coordinates of each first point cloud in the non-ground point cloud data and the coordinates of a first preset number of adjacent point clouds.
4. The method according to claim 1, characterized in that, The at least one curvature range includes: a first curvature range that is less than a preset curvature threshold; The step of using a filtering algorithm corresponding to at least one curvature range to filter the non-ground point cloud data within the at least one curvature range to obtain filtered non-ground point clouds within at least one curvature range includes: Using the distance smoothing algorithm corresponding to the first curvature range, the distance between each first non-ground point cloud in the first curvature range and a second preset number of adjacent first non-ground point clouds is adjusted to obtain the filtered non-ground point cloud of the first curvature range.
5. The method according to claim 1, characterized in that, The at least one curvature range further includes: a second curvature range that is greater than or equal to a preset curvature threshold; The step of using a filtering algorithm corresponding to at least one curvature range to filter the non-ground point cloud data within the at least one curvature range to obtain filtered non-ground point clouds within at least one curvature range includes: According to the radius filtering algorithm corresponding to the second curvature range, the non-ground point clouds in the non-ground point cloud of the second curvature range that are closest to each second non-ground point cloud and whose distance is greater than or equal to a preset distance threshold are filtered out, so as to obtain the filtered non-ground point cloud of the second curvature range.
6. The method according to claim 1, characterized in that, Before filtering the ground point cloud data according to the filtering algorithm to obtain filtered ground point cloud data, the method further includes: Based on the coordinates of each second point cloud in the ground point cloud data, calculate the distance between each second point cloud and the laser scanning device; Based on the distance between each of the second point clouds and the laser scanning device, ground point cloud data within a first distance range is determined from each of the second point clouds; The step of filtering the ground point cloud data according to the filtering algorithm to obtain filtered ground point cloud data includes: Using the distance smoothing algorithm corresponding to the first distance range, the distance between each first ground point cloud and a third preset number of adjacent first ground point clouds in the ground point cloud data of the first distance range is adjusted to obtain the ground filtered point cloud data.
7. The method according to claim 6, characterized in that, Before merging the filtered point cloud data of the at least two types to generate the target point cloud data of the preset scene, the method further includes: Based on the distance between each of the second point clouds and the laser scanning device, ground point cloud data within a second distance range is determined from each of the second point clouds; The step of merging the filtered point cloud data of the at least two types to generate the target point cloud data of the preset scene includes: Based on the coordinates of the ground point cloud data within the second distance range, the non-ground filtered point cloud data, the ground filtered point cloud data, and the ground point cloud data within the second distance range are merged to generate the target point cloud data of the preset scene.
8. A computer device, characterized in that, include: The computer device includes a processor, a storage medium, and a bus, wherein the storage medium stores program instructions executable by the processor, and when the computer device is running, the processor communicates with the storage medium via the bus, and the processor executes the program instructions to perform the steps of the point cloud filtering method as described in any one of claims 1 to 7.