Sampling method and device of three-dimensional laser point cloud, computer device and medium
Patent Information
- Application Number
- CN202310715214.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-15
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-06-15
AI Technical Summary
[0004]有鉴于此,本发明实施例提供了一种三维激光点云的采样方法、装置、计算机设备及介质,以解决三维激光点云的采样质量较差的问题
[0020]获取待采样的第一点云集合,第一点云集合包含至少一个样本点,对预设的第二点云集合进行初始化,从第一点云集合中随机选择一个样本点作为采样点加入第二点云集合,初始化采样次数,计算第一点云集合中每个样本点到第二点云集合中所有采样点的距离总和,将最大的距离总和对应的样本点变更为采样点,更新第一点云集合和第二点云集合,返回执行计算第一点云集合中每个样本点到第二点云集合中所有采样点的距离总和,将最大的距离总和对应的样本点确定为采样点,更新第一点云集合和第二点云集合的步骤,直至采样次数与预设值相同,停止迭代,确定停止迭代后的第二点云集合内的所有采样点为点云采样结果,根据样本点和采样点的实时距离信息,进行后续采样的采样点确定,使得所有采样点在空域上是均匀分布的,且能够有效表征原始点云数据的形态特征,从而提高了三维激光点云的采样质量,为医疗场景下的智能机器人提供更准确的三维点云信息,辅助智能机器人更好的执行寻址、患者引导等功能。
Smart Images

Figure CN116894953B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of point cloud data processing technology, and in particular to a sampling method, apparatus, computer equipment, and medium for three-dimensional laser point clouds. Background Technology
[0002] Currently, with the development of 3D laser scanning technology, point cloud technology has become a research hotspot that has attracted much attention. It has been widely applied in the field of architectural modeling to obtain high-precision 3D building information. For example, in medical scenarios, intelligent robots are used to model the interior space of medical buildings, thereby providing a 3D model space of the medical scene as the basis for the intelligent robot's functions such as navigation and addressing. The aforementioned intelligent robot can support functions such as location guidance and assisting in drug retrieval within the medical scene.
[0003] As point clouds grow larger, the computational demands on point cloud processing tasks also increase. An effective solution is to downsample the point cloud. Existing downsampling methods typically employ random or uniform sampling. However, because 3D LiDAR scanning is sensor-centric, it often leads to a "near-dense, far-sparse" problem—a large number of sample points close to the sensor and a very small number of sample points far from the sensor. This results in an uneven distribution of sample points in the 3D LiDAR point cloud, leading to poor sampling quality. Therefore, improving the sampling quality of 3D LiDAR point clouds has become an urgent problem to solve. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a sampling method, apparatus, computer equipment, and medium for three-dimensional laser point clouds to solve the problem of poor sampling quality of three-dimensional laser point clouds.
[0005] In a first aspect, embodiments of the present invention provide a sampling method for three-dimensional laser point clouds, the sampling method comprising:
[0006] Obtain a first point cloud set to be sampled, the first point cloud set containing at least one sample point;
[0007] The preset second point cloud set is initialized, and a sample point is randomly selected from the first point cloud set as a sampling point and added to the second point cloud set;
[0008] Initialize the number of samplings, calculate the total distance from each sample point in the first point cloud set to all sample points in the second point cloud set, change the sample point corresponding to the largest total distance to the sample point, and update the first point cloud set and the second point cloud set;
[0009] Return to the steps of calculating the sum of distances from each sample point in the first point cloud set to all sample points in the second point cloud set, determining the sample point corresponding to the largest sum of distances as the sample point, and updating the first point cloud set and the second point cloud set, until the number of samplings is the same as the preset value, and stop iterating;
[0010] All sampling points within the second point cloud set after stopping iteration are determined as the point cloud sampling results.
[0011] Secondly, embodiments of the present invention provide a sampling device for three-dimensional laser point clouds, the sampling device comprising:
[0012] The set acquisition module is used to acquire a first point cloud set to be sampled, wherein the first point cloud set contains at least one sample point;
[0013] An initialization module is used to initialize a preset second point cloud set by randomly selecting a sample point from the first point cloud set as a sampling point and adding it to the second point cloud set.
[0014] The set update module is used to initialize the number of samplings, calculate the total distance from each sample point in the first point cloud set to all sample points in the second point cloud set, change the sample point corresponding to the largest total distance to the sample point, and update the first point cloud set and the second point cloud set;
[0015] The iterative sampling module is used to return the steps of performing the calculation of the sum of distances from each sample point in the first point cloud set to all sample points in the second point cloud set, determining the sample point corresponding to the largest sum of distances as the sample point, and updating the first point cloud set and the second point cloud set, until the number of samplings is the same as the preset value, and then stopping the iteration;
[0016] The result determination module is used to determine all sampling points in the second point cloud set after the iteration stops as point cloud sampling results.
[0017] Thirdly, embodiments of the present invention provide a computer device, the computer device including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the sampling method as described in the first aspect.
[0018] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the sampling method as described in the first aspect.
[0019] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows:
[0020] Obtain a first point cloud set to be sampled, which contains at least one sample point. Initialize a pre-defined second point cloud set. Randomly select a sample point from the first point cloud set as the sampling point and add it to the second point cloud set. Initialize the number of sampling iterations. Calculate the sum of distances from each sample point in the first point cloud set to all sample points in the second point cloud set. Change the sample point corresponding to the largest sum of distances to the second point cloud set. Update the first and second point cloud sets. Return to the previous step and repeat the process of calculating the sum of distances from each sample point in the first point cloud set to all sample points in the second point cloud set, and change the sample point corresponding to the largest sum of distances to the second point cloud set. The process of identifying sampling points and updating the first and second point cloud sets continues until the number of samplings matches the preset value. Then, the iteration stops, and all sampling points within the second point cloud set after the iteration stops are considered point cloud sampling results. Based on the real-time distance information between the sample points, subsequent sampling points are determined, ensuring that all sampling points are uniformly distributed in the spatial domain and effectively characterize the morphological features of the original point cloud data. This improves the sampling quality of the 3D laser point cloud, providing more accurate 3D point cloud information for intelligent robots in medical scenarios, and assisting intelligent robots in better performing functions such as addressing and patient guidance. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of the present invention, 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.
[0022] Figure 1 This is a schematic diagram of an application environment for a three-dimensional laser point cloud sampling method provided in Embodiment 1 of the present invention;
[0023] Figure 2 This is a flowchart illustrating a three-dimensional laser point cloud sampling method provided in Embodiment 1 of the present invention;
[0024] Figure 3 This is a schematic diagram of the structure of a three-dimensional laser point cloud sampling device provided in Embodiment 2 of the present invention;
[0025] Figure 4 This is a schematic diagram of the structure of a computer device provided in Embodiment 3 of the present invention. Detailed Implementation
[0026] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of the invention. However, those skilled in the art will understand that the invention can be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of the invention with unnecessary detail.
[0027] It should be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0028] It should also be understood that the term “and / or” as used in this specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0029] As used in this specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if [described condition or event] is detected" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once [described condition or event] is detected," or "in response to detection of [described condition or event]."
[0030] Furthermore, in the description of this invention and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0031] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of the invention include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0032] It should be understood that the sequence number of each step in the following embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0033] To illustrate the technical solution of the present invention, specific embodiments are described below.
[0034] The sampling method for three-dimensional laser point clouds provided in Embodiment 1 of this invention can be applied to, for example... Figure 1 In this application environment, the client communicates with the server. The client includes, but is not limited to, handheld computers, desktop computers, laptops, ultra-mobile personal computers (UMPCs), netbooks, cloud terminal devices, and personal digital assistants (PDAs). The server can be a standalone server or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0035] The client and server can be deployed in medical settings to obtain high-precision 3D building information. For example, intelligent robots can be used to model the interior space of medical buildings, thereby providing a 3D model space of the medical setting as the basis for the intelligent robot's functions such as navigation and addressing. The aforementioned intelligent robots can support functions such as location guidance and assisting in medication retrieval within the medical setting.
[0036] See Figure 2 This is a flowchart illustrating a three-dimensional laser point cloud sampling method provided in Embodiment 1 of the present invention. The above-described three-dimensional laser point cloud sampling method can be applied to... Figure 1 The client, whose corresponding computer device connects to the server, obtains the first point cloud set to be sampled from the server. This first point cloud set can be a 3D point cloud set directly acquired by a 3D LiDAR. For example... Figure 2 As shown, the sampling method for this three-dimensional laser point cloud may include the following steps:
[0037] Step S201: Obtain the first set of point clouds to be sampled.
[0038] The first point cloud set can be a three-dimensional point cloud set directly acquired by a three-dimensional LiDAR. The first point cloud set contains at least one sample point. The sample point can refer to the acquisition point acquired by the three-dimensional LiDAR. The point to be sampled can refer to the point cloud data that needs to be reduced in dimensionality through sampling operations.
[0039] Specifically, since 3D LiDAR has a high density when collecting point clouds, the amount of point cloud data obtained is also large. Therefore, it is necessary to perform dimensionality reduction processing on the collected raw point cloud data to ensure that the calculation of application tasks can be completed with a small amount of computation when the point cloud data is used in practical applications. Application tasks can refer to digital elevation model establishment, earthwork calculation, geological condition detection, etc., and can be applied to fields such as 3D modeling, metaverse, medical research, digital protection of cultural relics, game software development, and engineering applications.
[0040] The first point cloud set contains several sample points, each of which can be represented by three-dimensional coordinates. In this embodiment, there are no restrictions on the scene of point cloud acquisition, the acquisition method of three-dimensional LiDAR, or the deployment location. It can be applied to various point cloud data processing scenarios and plays a role in preprocessing point cloud data.
[0041] The steps described above for obtaining the first set of point clouds to be sampled acquire the raw point cloud data collected by the 3D LiDAR, thereby obtaining detailed shape information of the sampled object. This facilitates the provision of raw point cloud data with sufficient detailed information for subsequent point cloud sampling, thereby improving the sampling quality of the 3D LiDAR point cloud.
[0042] Step S202: Initialize the preset second point cloud set by randomly selecting a sample point from the first point cloud set as a sampling point and adding it to the second point cloud set.
[0043] Here, the second point cloud set can refer to the point cloud set composed of sampled points, initialization can refer to initially determining a point as the initial element of the second point cloud set, random selection can refer to selecting each sample point in the first point cloud set with equal probability, and sampling point can refer to the sampled point.
[0044] Specifically, if the first point cloud contains N sample points, then each sample point is assigned the same random sampling probability, which can be set to 1 / N. In the implementation process, the implementer can directly set the interval [1,N], where each integer in the interval corresponds to a sample point, and generate a random integer in the interval. The corresponding sample point is determined as the sampling point based on the generated random number.
[0045] The above steps of initializing the preset second point cloud set and randomly selecting a sample point from the first point cloud set as a sampling point to add to the second point cloud set initialize the second point cloud set, so that the sampling point can be determined according to the distance between the points in the future, thereby preserving the shape information of the point cloud data and improving the sampling quality of the three-dimensional laser point cloud.
[0046] Step S203: Initialize the number of samplings, calculate the total distance from each sample point in the first point cloud set to all sample points in the second point cloud set, change the sample point corresponding to the largest total distance to the sample point, and update the first point cloud set and the second point cloud set.
[0047] Here, the number of samplings can refer to the target number of sampling points, the total distance can refer to the sum of the distances from a sample point to each sampling point in the second point cloud set, and the change can refer to changing the label of the point from the sample point label to the sampling point label. The sample point label can refer to the preset first label value, and the sampling point label can refer to the preset second label value.
[0048] Specifically, in this embodiment, the distance calculation can use Euclidean distance. The preset first marker value can be 0, and the preset second marker value can be 1. Then, the coordinates of a point can be represented as (x, y, z, k), where k is the marker value. When calculating the Euclidean distance, the Euclidean distance d between points (x1, y1, z1, k1) and (x2, y2, z2, k2) can be represented as: For the sampled point i, its coordinates are determined by (x... i ,y i ,z i ,0) changed to (x i ,y i ,z i ,1), to represent the set of point clouds to which it belongs.
[0049] Optionally, the above sampling method also includes:
[0050] The first point cloud set is divided into S grid subsets using a pre-defined grid.
[0051] Accordingly, the sum of distances from each sample point in the first point cloud set to all sample points in the second point cloud set is calculated, and the sample point corresponding to the largest sum of distances is changed to a sample point including:
[0052] For any grid subset, calculate the sum of distances from each sample point in the first point cloud set to all sample points in the grid subset. Iterate through all grid subsets to obtain S sums of distances.
[0053] Sample from the grid subset corresponding to the largest sum of distances, and change the sampled points to sample points.
[0054] Here, a grid can refer to a three-dimensional spatial region, a grid subset can refer to a subset of all sample points contained within a grid, the grid subset is contained in the first point cloud set, and S is an integer greater than zero.
[0055] Specifically, when performing 3D laser point cloud sampling, the grid to be sampled is determined first, and sampling is performed from the determined grid to obtain sampling points. When sampling from the determined grid, the sampling method with equal probability can still be used.
[0056] Considering that the distribution of sample points in the point cloud set may be uneven, for example, a large number of sample points may be distributed in relatively peripheral areas, then according to the conventional sampling method, when enough sample points are sampled, most of them may be very close together, which makes it difficult for the sampling results to effectively represent the shape information of the original point cloud data. Therefore, a grid method is used to divide the first point cloud set, so that the grid to be sampled is determined first, and then the sampled points are determined from the grid. This allows for a greater selection space for the sampled points, rather than being limited to the point with the largest sum of distances to all sampled points in the second point cloud set.
[0057] In this embodiment, the first point cloud set is divided into grids, so that determining the grids to be sampled is a preliminary step for point cloud sampling. This avoids the situation where the sampling points are too close together during point cloud sampling, thereby improving the ability of the sampling results of the three-dimensional laser point cloud to represent the shape information of the original point cloud data, that is, improving the sampling quality of the three-dimensional laser point cloud.
[0058] Optionally, sampling can be performed from the subset of grids corresponding to the largest sum of distances, and the sampled points can be changed to include:
[0059] Assign a preset sampling probability to each sample point in the grid subset corresponding to the maximum total distance, and obtain the sampling probability distribution corresponding to all sample points in the grid subset corresponding to the maximum total distance;
[0060] Based on the sampling probability distribution, sampling is performed from the grid subset corresponding to the largest sum of distances, and the sampled points are changed to sampling points.
[0061] The preset sampling probability can refer to the probability of a sample point being sampled when sampling according to the probability distribution, and the sampling probability distribution can refer to the probability distribution obtained by combining the sampling probabilities of all sample points in the grid subset.
[0062] Specifically, in this embodiment, the sampling probability can be set by human preset. For example, in equal probability sampling, if the grid subset contains M sample points, the sampling probability corresponding to each sample point can be 1 / M. In the implementation process, the implementer can directly set the interval [1,M], where each integer in the interval corresponds to a sample point, and generate a random integer in the interval. The corresponding sample point is determined as the sampling point based on the generated random number.
[0063] In one embodiment, clustering operations can be performed on M sample points within a grid subset. Clustering algorithms such as mean-shift clustering and DBSCAN clustering can be used to obtain multiple cluster sets. During the clustering operation, the distance between sample points is used as the clustering criterion. Then, the sample points in each cluster set are a group of sample points that are relatively close in the spatial domain. At this time, the implementer can set the sampling probability according to the clustering results. For example, a larger sampling probability is assigned to the sample point closest to the cluster center in each cluster set, and a smaller sampling probability is assigned to the other sample points in the cluster set accordingly, thereby improving the uniformity of sampling of each cluster set, that is, the uniformity of sampling of sample points in the spatial domain, i.e., the uniformity of sampling of sample points in each spatial region.
[0064] In this embodiment, the sampling probability distribution of the grid subset is obtained by pre-setting the sampling probability, and then the sample points in the grid subset are sampled according to the sampling probability distribution. This can effectively improve the uniformity of the distribution of sampling points. Furthermore, by flexibly adjusting the sampling probability, different sampling effects can be achieved, improving the generalization ability of 3D laser point cloud sampling in different scenarios, thereby improving the sampling quality of 3D laser point cloud.
[0065] Optionally, a preset sampling probability is assigned to each sample point in the grid subset corresponding to the largest total distance, including:
[0066] Each sample point in the first point cloud set is input into a preset filter for filtering, and the filtered and retained sample points are determined as key points.
[0067] The first preset value is used as the first sampling probability of the key point, and the second preset value is used as the second sampling probability of the unretained sample points;
[0068] Based on the first sampling probability and the second sampling probability, assign a corresponding sampling probability to each sample point in the grid subset corresponding to the largest total distance.
[0069] The preset filter can refer to a preset filter template, and filtering can refer to a convolution operation. The convolution operation will produce a large response value when the sample point meets the filter template, and a small response value when the sample point does not meet the filter template. Based on the response value and the preset response value threshold, the sample points can be filtered. The sample points that are filtered and retained are the sample points that meet the filter template, which are also the key points.
[0070] The first and second preset values can be values that are set by humans in advance. The first sampling probability can refer to the sampling probability of key points, and the second sampling probability can refer to the sampling probability of non-key points.
[0071] Specifically, the input to the preset filter can be the feature descriptor of the sample point. For example, in this embodiment, RSD feature descriptor, ESF feature descriptor, etc. can be used. Correspondingly, when the feature descriptor of the sample point is an RSD feature descriptor, the corresponding preset filter template is an RSD filter template. The RSD filter template can be the RSD feature descriptor of a specific sample point. Obviously, when performing convolution operation using the RSD feature descriptor and the RSD filter template, if the sample point is similar to the specific sample point, a larger response value can be obtained. If the sample point is not similar to the specific sample point, the response value is close to zero. At this time, by setting the response value threshold to a value greater than zero, sample points similar to the feature sample point can be extracted. In this embodiment, the response value threshold can be set to 10. It should be noted that if the RSD feature descriptor is used, each sample point should have normal information.
[0072] When the feature descriptor of a sample point is an ESF feature descriptor, the corresponding preset filtering template is an ESF filtering template. The ESF filtering template can be the ESF feature descriptor of a specific sample point. Similarly, when performing a convolution operation using the ESF feature descriptor and the ESF filtering template, if the sample point is similar to the specific sample point, a larger response value can be obtained. If the sample point is not similar to the specific sample point, the response value is close to zero. In this case, setting the response value threshold to a value greater than zero can extract sample points similar to the feature sample point. In this embodiment, the response value threshold can also be set to 10.
[0073] In this embodiment, the first preset value can be set to 1, and the second preset value can be set to 0.5. It should be noted that when the first preset value or the second preset value is used as the sampling probability, normalization processing is required, that is, to ensure that the sum of the sampling probabilities assigned to each sample point in the grid subset corresponding to the largest total distance is 1, so as to facilitate the sampling operation according to the probability distribution.
[0074] In this embodiment, by setting a higher sampling probability for key points, the sampling process of the 3D laser point cloud can sample key points as much as possible. Key points contain richer feature information, which helps to more fully represent the feature information of the original point cloud data, thereby improving the sampling quality of the 3D laser point cloud.
[0075] Optionally, after obtaining the sum of S distances, it also includes:
[0076] Arrange the S distance sums in descending order, and determine the grid subset corresponding to the first distance sum as the target subset;
[0077] Determine whether the target subset meets the preset conditions. If the target subset meets the preset conditions, perform the step of sampling from the grid subset corresponding to the largest total distance and changing the sampled sample points to the sampling points.
[0078] If the target subset does not meet the preset conditions, determine the grid subset corresponding to the next distance sum as the target subset, and return to the step of determining whether the target subset meets the preset conditions.
[0079] Here, after arranging the S distance sums in descending order, a distance sum sequence is obtained. The first digit can refer to the first digit in the distance sum sequence. The S distance sums correspond to S grid subsets, and the target subset can refer to the grid subset to be sampled.
[0080] The preset conditions can refer to density constraints, sampling quantity conditions, etc., and the next position can refer to the position following the current position in the distance sum sequence.
[0081] Specifically, in this embodiment, the preset condition adopts the sampling quantity condition. Initially, the grid subset corresponding to the first position's distance sum is determined as the target subset. If the number of sample points that have been sampled in the target subset is greater than the preset sampling quantity, the target subset is considered not to meet the preset condition. At this time, the grid subset corresponding to the next position's distance sum is determined as the target subset, that is, the grid subset corresponding to the second position's distance sum is taken as the target subset, and the judgment on whether the target subset meets the preset condition is re-performed until the target subset meets the preset condition or the current position's distance sum is the last position in the distance sum sequence.
[0082] Typically, before the sampling process begins, the implementer needs to set the target sampling number. The target sampling number can refer to the number of sample points that need to be sampled during the entire sampling process. If the current position's total distance is already the last position in the total distance sequence and the number of sample points has not reached the target sampling number, an exception message needs to be generated. The exception message can be used to remind the implementer to adjust the parameter settings during the sampling process in order to complete the target sampling number.
[0083] In this embodiment, by setting preset conditions, the sampling of each grid is constrained to avoid multiple samplings in the same grid, which would result in uneven distribution of the sampled points and an inability to accurately and effectively represent the shape information of the original point cloud data. This ensures that sampling can be performed uniformly in each grid, thereby improving the sampling quality of the three-dimensional laser point cloud.
[0084] Optionally, determining whether a target subset satisfies preset conditions includes:
[0085] Count the number of sampling points in the first point cloud set, and count the number of grids in all grids;
[0086] Calculate the product of the number of sampling points and the number of grids, and compare it with a preset value and the product to obtain the first ratio;
[0087] Obtain the number of sampled points and the initial number of sampled points in the target subset, and use the ratio of the number of sampled points to the initial number of sampled points to obtain the second ratio;
[0088] If the second ratio is less than or equal to the first ratio, then the target subset is determined to meet the preset condition.
[0089] If the second ratio is greater than the first ratio, then the target subset is determined not to meet the preset conditions.
[0090] The number of sampling points can refer to the total number of sampling points in the initial first point cloud set, and the number of grids can refer to the number of grids obtained after grid division.
[0091] The preset value can be used to characterize the target sampling number, which can refer to the number of sample points that need to be sampled during the entire sampling process.
[0092] The number of sampled points can refer to the number of points in the target subset that have already been sampled, while the initial number of sampled points can refer to the number of sample points in the target subset before sampling.
[0093] The first ratio can be used to characterize the density information of the first point cloud set, and the second ratio can be used to characterize the sampling density information of the target subset.
[0094] Specifically, since the number of sample points contained in different grid sub-regions is different when the grid is divided, the preset conditions are judged in the form of density. When the second ratio is less than or equal to the first ratio, it means that the sampling density of the target subset has not reached the preset sampling density of each grid subset, and sampling can continue to be carried out in the target subset to determine that the target subset meets the preset conditions.
[0095] When the second ratio is greater than the first ratio, it means that the sampling density of the target subset has reached the preset sampling density of each grid subset, and sampling cannot continue in the target subset. Therefore, it is determined that the target subset does not meet the preset conditions.
[0096] This embodiment controls the number of samples in each grid subset by sampling density, so that each grid subset can sample a sufficient number of sampling points. The sampling result density distribution of the 3D laser point cloud is more uniform, and key points can be sampled as much as possible. This can effectively ensure the stability of the geometric characteristics of the 3D laser point cloud before and after sampling, thereby improving the sampling quality of the 3D laser point cloud.
[0097] Optionally, the sample point corresponding to the largest total distance is changed to a sampling point, and the updates to the first and second point cloud sets include:
[0098] Change the sample point corresponding to the maximum total distance to a sampling point, and delete the sample point corresponding to the maximum total distance from the first point cloud set;
[0099] Add the sample point corresponding to the largest total distance in the second point cloud set after the sampling point has been changed.
[0100] In this context, deletion can refer to removing the sampled points from the first point cloud set, while addition can refer to adding the sampled points as sample points to the second point cloud set.
[0101] Specifically, after each sample point is sampled, the first point cloud set and the second point cloud set are updated so that when sampling is performed again, the updated first point cloud set and the updated second point cloud set can be used to determine the sampling points.
[0102] In this embodiment, after each sample point is sampled, the first point cloud set and the second point cloud set are updated. During each sampling, the sample point farthest from the updated second point cloud set is determined as the sampling point based on the sampled points. This ensures that the sampling points are distributed as widely as possible in various spatial locations of the three-dimensional laser point cloud, which helps to accurately characterize the spatial distribution of the three-dimensional laser point cloud and improves the sampling quality of the three-dimensional laser point cloud.
[0103] Step S204: Return to the step of calculating the sum of distances from each sample point in the first point cloud set to all sample points in the second point cloud set, determining the sample point corresponding to the largest sum of distances as the sample point, and updating the first and second point cloud sets until the number of samples is the same as the preset value, and stop the iteration.
[0104] Here, iteration can refer to iterating through the steps of calculating the sum of distances from each sample point in the first point cloud set to all sample points in the second point cloud set, determining the sample point corresponding to the largest sum of distances as the sample point, and updating the first and second point cloud sets. The condition for stopping iteration is that the number of samplings is the same as the preset value.
[0105] Specifically, the preset value can be used to characterize the target number of samples. The target number of samples can refer to the number of sample points that need to be sampled in the entire sampling process. When the number of samplings is the same as the preset value, it means that enough sample points have been collected and sampling can be stopped, that is, the iteration process can be stopped.
[0106] The above steps involve calculating the sum of distances from each sample point in the first point cloud set to all sample points in the second point cloud set, determining the sample point corresponding to the largest sum of distances as the sample point, and updating the first and second point cloud sets. This process continues until the number of samples reaches the preset value, at which point the iteration stops. After each sample point is sampled, both the first and second point cloud sets are updated. This ensures that each time a sample point is sampled, the previously updated first and second point cloud sets can be used to determine the sample point. This effectively guarantees that the overall geometric properties of the 3D laser point cloud remain unchanged after sampling, thus improving the sampling quality of the 3D laser point cloud.
[0107] Step S205: Determine all sampling points in the second point cloud set after stopping iteration as the point cloud sampling results.
[0108] The point cloud sampling result can refer to the result of downsampling the first point cloud set.
[0109] The steps described above, which determine all sampling points in the second point cloud set after stopping iteration as point cloud sampling results, yield downsampling results corresponding to the first point cloud set. This effectively overcomes the need for extremely high computing power to support the processing of large-scale 3D laser point cloud data, enabling large-scale 3D laser point cloud data to be represented by small-scale sampling results and applied to computing devices with conventional computing power. This effectively improves the practical application capability of large-scale 3D laser point cloud data.
[0110] In this embodiment, the sampling points for subsequent sampling are determined based on the real-time distance information between the sample points and the sampling points, so that all sampling points are uniformly distributed in the spatial domain and can effectively characterize the morphological features of the original point cloud data, thereby improving the sampling quality of the three-dimensional laser point cloud and providing more accurate three-dimensional point cloud information for intelligent robots in medical scenarios, assisting intelligent robots to better perform functions such as addressing and patient guidance.
[0111] Corresponding to the sampling method of the three-dimensional laser point cloud in the above embodiment, Figure 3 A structural block diagram of a three-dimensional laser point cloud sampling device provided in Embodiment 2 of the present invention is shown. This sampling device is applied to a client-side computer, which is connected to a server-side computer to obtain a first point cloud set to be sampled from the server. This first point cloud set can be a three-dimensional point cloud set directly acquired by a three-dimensional lidar. For ease of explanation, only the parts relevant to the embodiments of the present invention are shown.
[0112] See Figure 3 The sampling device for the three-dimensional laser point cloud includes:
[0113] The set acquisition module 31 is used to acquire a first point cloud set to be sampled, the first point cloud set containing at least one sample point;
[0114] The initialization module 32 is used to initialize the preset second point cloud set and randomly select a sample point from the first point cloud set as a sampling point to add to the second point cloud set;
[0115] The set update module 33 is used to initialize the number of samplings, calculate the total distance from each sample point in the first point cloud set to all sample points in the second point cloud set, change the sample point corresponding to the largest total distance to the sample point, and update the first point cloud set and the second point cloud set.
[0116] The iterative sampling module 34 is used to return the steps of performing the calculation of the total distance from each sample point in the first point cloud set to all sample points in the second point cloud set, determining the sample point corresponding to the largest total distance as the sample point, updating the first point cloud set and the second point cloud set, until the number of samplings is the same as the preset value, and then stopping the iteration;
[0117] The result determination module 35 is used to determine all sampling points in the second point cloud set after the iteration stops as point cloud sampling results.
[0118] Optionally, the above sampling device also includes:
[0119] The grid partitioning module is used to divide the first point cloud set into S grid subsets using a preset grid, where S is an integer greater than zero;
[0120] Accordingly, the above-mentioned set update module 33 includes:
[0121] The distance calculation submodule is used to calculate the sum of distances from each sample point in the first point cloud set to all sample points in the grid subset for any given grid subset. It iterates through all grid subsets to obtain S sums of distances.
[0122] The grid sampling submodule is used to sample from the grid subset corresponding to the largest sum of distances and change the sampled points into sampling points.
[0123] Optionally, the above-mentioned grid sampling submodule includes:
[0124] The probability determination unit is used to assign a preset sampling probability to each sample point in the grid subset corresponding to the maximum total distance, thereby obtaining the sampling probability distribution of all sample points in the grid subset corresponding to the maximum total distance.
[0125] The probability sampling unit is used to sample from the grid subset corresponding to the largest sum of distances according to the sampling probability distribution, and to change the sampled sample points into sampling points.
[0126] Optionally, the above probability determination unit includes:
[0127] The point cloud filtering subunit is used to input each sample point in the first point cloud set into a preset filter for filtering, and to determine the filtered and retained sample points as key points.
[0128] The probability assignment subunit is used to take a first preset value as the first sampling probability of the key point and a second preset value as the second sampling probability of the unretained sample points.
[0129] The probability allocation subunit is used to assign a corresponding sampling probability to each sample point in the grid subset corresponding to the largest total distance, based on the first sampling probability and the second sampling probability.
[0130] Optionally, the aforementioned set update module 33 also includes:
[0131] The distance sorting submodule is used to sort the S distance sums in descending order and determine the grid subset corresponding to the first distance sum as the target subset;
[0132] The condition judgment submodule is used to determine whether the target subset meets the preset conditions. If the target subset meets the preset conditions, the step of sampling from the grid subset corresponding to the largest total distance is executed, and the sampled sample points are changed to the sampling points.
[0133] The step execution submodule is used to determine the grid subset corresponding to the next distance sum as the target subset if the target subset does not meet the preset conditions, and then return to execute the step of judging whether the target subset meets the preset conditions.
[0134] Optionally, the above condition judgment submodule includes:
[0135] The quantity statistics unit is used to count the number of sampling points of all sampling points in the first point cloud set and to count the number of grids of all grids;
[0136] The first ratio calculation unit is used to calculate the product of the number of sampling points and the number of grids, and to obtain the first ratio by comparing the preset value with the product.
[0137] The second ratio calculation unit is used to obtain the number of sampled points and the initial number of sampled points of the target subset, and to obtain the second ratio by comparing the number of sampled points and the initial number of sampled points.
[0138] The first comparison unit is used to determine that the target subset satisfies the preset condition when the second ratio is less than or equal to the first ratio.
[0139] The second comparison unit is used to determine that the target subset does not meet the preset conditions when the second ratio is greater than the first ratio.
[0140] Optionally, the above-mentioned set update module 33 includes:
[0141] The sample point deletion subunit is used to change the sample point corresponding to the maximum total distance to a sampling point, and delete the sample point corresponding to the maximum total distance from the first point cloud set.
[0142] The sample point modification subunit is used to add the sample point after modification corresponding to the maximum total distance in the second point cloud set.
[0143] It should be noted that the information interaction and execution process between the above modules, sub-modules, units, and sub-units are based on the same concept as the method embodiments of the present invention. For details on their specific functions and the resulting technical effects, please refer to the method embodiments section, which will not be repeated here.
[0144] Figure 4 This is a schematic diagram of the structure of a computer device provided in Embodiment 3 of the present invention. Figure 4 As shown, the computer device of this embodiment includes: at least one processor ( Figure 4 Only one is shown in the diagram), a memory, and a computer program stored in the memory and executable on at least one processor, which, when executed by the processor, implements the steps in any of the above-described embodiments of the sampling methods for three-dimensional laser point clouds.
[0145] This computer device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that... Figure 4 The examples of computer devices are merely examples and do not constitute a limitation on computer devices. Computer devices may include more or fewer components than shown in the illustration, or combinations of certain components, or different components, such as network interfaces, displays, and input devices.
[0146] The processor referred to can be a CPU, but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0147] Memory includes readable storage media, internal memory, etc., wherein internal memory can be the RAM of a computer device, providing an environment for the operation of the operating system and computer-readable instructions stored in the readable storage media. The readable storage media can be the hard drive of a computer device, or in other embodiments, it can be an external storage device of the computer device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, memory can include both internal storage units and external storage devices of a computer device. Memory is used to store the operating system, applications, bootloader, data, and other programs, such as program code for computer programs. Memory can also be used to temporarily store data that has been output or will be output.
[0148] Those skilled in the art will understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the functions described above can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments 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 as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this invention. The specific working process of the units and modules in the above device can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here. If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention can implement all or part of the processes in the methods of the above embodiments by instructing related hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the above method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium can include at least: any entity or device capable of carrying computer program code, a recording medium, a computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0149] The present invention can implement all or part of the processes in the methods of the above embodiments, or it can be accomplished by a computer program product. When the computer program product is run on a computer device, the computer device executes the steps in the above method embodiments.
[0150] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0151] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0152] In the embodiments provided by this invention, it should be understood that the disclosed apparatus / computer devices and methods can be implemented in other ways. For example, the apparatus / computer device embodiments described above are merely illustrative. For instance, the division of modules or 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 mutual 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.
[0153] 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.
[0154] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A sampling method for three-dimensional laser point clouds, characterized in that, The sampling method includes: Obtain a first point cloud set to be sampled, the first point cloud set containing at least one sample point; The preset second point cloud set is initialized, and a sample point is randomly selected from the first point cloud set as a sampling point and added to the second point cloud set; Initialize the number of samplings, calculate the total distance from each sample point in the first point cloud set to all sample points in the second point cloud set, change the sample point corresponding to the largest total distance to the sample point, and update the first point cloud set and the second point cloud set; Return to the steps of calculating the sum of distances from each sample point in the first point cloud set to all sample points in the second point cloud set, determining the sample point corresponding to the largest sum of distances as the sample point, and updating the first point cloud set and the second point cloud set, until the number of samplings is the same as the preset value, and stop iterating; All sampling points within the second point cloud set after stopping iteration are identified as the point cloud sampling results; The sampling method further includes: The first point cloud set is divided into S grid subsets by a preset grid, where S is an integer greater than zero; Accordingly, the step of calculating the sum of distances from each sample point in the first point cloud set to all sample points in the second point cloud set, and changing the sample point corresponding to the largest sum of distances to a sample point, includes: For any grid subset, calculate the sum of distances from each sample point in the first point cloud set to all sample points in the grid subset, and traverse all grid subsets to obtain S sums of distances; Sample from the subset of grids corresponding to the largest sum of distances, and change the sampled points to sample points; The step of sampling from the grid subset corresponding to the largest sum of distances and changing the sampled points to sample points includes: Assign a preset sampling probability to each sample point in the grid subset corresponding to the maximum sum of distances, and obtain the sampling probability distribution corresponding to all sample points in the grid subset corresponding to the maximum sum of distances; Based on the sampling probability distribution, sampling is performed from the grid subset corresponding to the largest sum of distances, and the sampled sample points are changed to sampling points; Assigning a preset sampling probability to each sample point in the grid subset corresponding to the maximum total distance includes: The feature descriptor of each sample point in the first point cloud set is input into a preset filter. The feature descriptor of each sample point is convolved with the feature descriptor of the corresponding specific sample point in the preset filter to obtain the response value of each sample point. Based on the response value, the sample points to be retained from all sample points in the first point cloud set are selected as key points. A first preset value is used as the first sampling probability of the key points, and a second preset value is used as the second sampling probability of the unretained sample points. Based on the first sampling probability and the second sampling probability, a corresponding sampling probability is assigned to each sample point in the grid subset corresponding to the maximum total distance.
2. The sampling method according to claim 1, characterized in that, After obtaining the sum of the S distances, the process also includes: Arrange the S distance sums in descending order, and determine the grid subset corresponding to the first distance sum as the target subset; Determine whether the target subset meets the preset conditions. If the target subset meets the preset conditions, execute the step of sampling from the grid subset corresponding to the largest total distance and changing the sampled sample points to sampling points. If the target subset does not meet the preset condition, determine the grid subset corresponding to the next distance sum as the target subset, and return to the step of determining whether the target subset meets the preset condition.
3. The sampling method according to claim 2, characterized in that, The step of determining whether the target subset satisfies the preset conditions includes: Count the number of sampling points of all sampling points in the first point cloud set, and count the number of grids of all grids; Calculate the product of the number of sampling points and the number of grids, and compare the product with the preset value to obtain a first ratio; Obtain the number of sampled points and the initial number of sampled points in the target subset, and obtain a second ratio by comparing the number of sampled points and the initial number of sampled points. Here, the number of sampled points refers to the number of points in the target subset that have been sampled, and the initial number of sampled points refers to the number of sample points in the target subset before sampling. If the second ratio is less than or equal to the first ratio, then the target subset is determined to satisfy the preset condition. If the second ratio is greater than the first ratio, then it is determined that the target subset does not meet the preset condition.
4. The sampling method according to any one of claims 1 to 3, characterized in that, The step of changing the sample point corresponding to the largest total distance to a sampling point and updating the first point cloud set and the second point cloud set includes: Change the sample point corresponding to the maximum sum of distances to a sampling point, and delete the sample point corresponding to the maximum sum of distances from the first point cloud set; Add the sample points corresponding to the largest sum of distances to the second point cloud set after the sampling point has been changed.
5. A sampling device for three-dimensional laser point clouds, characterized in that, The sampling device includes: The set acquisition module is used to acquire a first point cloud set to be sampled, wherein the first point cloud set contains at least one sample point; An initialization module is used to initialize a preset second point cloud set by randomly selecting a sample point from the first point cloud set as a sampling point and adding it to the second point cloud set. The set update module is used to initialize the number of samplings, calculate the total distance from each sample point in the first point cloud set to all sample points in the second point cloud set, change the sample point corresponding to the largest total distance to the sample point, and update the first point cloud set and the second point cloud set; The iterative sampling module is used to return the steps of performing the calculation of the sum of distances from each sample point in the first point cloud set to all sample points in the second point cloud set, determining the sample point corresponding to the largest sum of distances as the sample point, and updating the first point cloud set and the second point cloud set, until the number of samplings is the same as the preset value, and then stopping the iteration; The result determination module is used to determine all sampling points in the second point cloud set after the iteration stops as point cloud sampling results. The sampling device further includes: The grid partitioning module is used to divide the first point cloud set into S grid subsets using a preset grid, where S is an integer greater than zero; The set update module includes: The distance calculation submodule is used to calculate the sum of distances from each sample point in the first point cloud set to all sample points in the grid subset for any grid subset, and to traverse all grid subsets to obtain S distance sums; The grid sampling submodule is used to sample from the grid subset corresponding to the largest sum of distances and change the sampled points into sampling points; The grid sampling submodule includes: The probability determination unit is used to assign a preset sampling probability to each sample point in the grid subset corresponding to the maximum total distance, thereby obtaining the sampling probability distribution corresponding to all sample points in the grid subset corresponding to the maximum total distance. A probability sampling unit is used to sample from the grid subset corresponding to the maximum sum of distances according to the sampling probability distribution, and change the sampled sample points into sampling points; The probability determination unit includes: The point cloud filtering subunit is used to input the feature descriptor of each sample point in the first point cloud set into a preset filter, and to perform a convolution operation between the feature descriptor of each sample point and the feature descriptor of the corresponding specific sample point of the preset filter to obtain the response value of each sample point. Based on the response value, the sample points to be retained from all sample points in the first point cloud set are selected as key points. The probability assignment subunit is used to use a first preset value as the first sampling probability of the key point and a second preset value as the second sampling probability of the unreserved sample points. The probability allocation subunit is used to assign a corresponding sampling probability to each sample point in the grid subset corresponding to the maximum total distance, based on the first sampling probability and the second sampling probability.
6. A computer device, characterized in that, The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the sampling method as described in any one of claims 1 to 4.
7. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the sampling method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Point cloud data sampling method and device and electronic device
CN112396067A
Road edge detection method and device, electronic equipment and vehicle
CN114387293A
