Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Learn SLAM together from scratch | normal estimation of point cloud smoothing

2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Why do we need smoothing after point cloud filtering?

Xiaobai: brother, I learned the point cloud filtering you said last time. How to turn the point cloud into a grid next?

Brother: filtering is only the first step. We also need to smoothing the filtered point cloud before gridding.

Xiaobai: hasn't it been filtered? Why is it even smooth? Is filtering different from smoothing?

Brother: it's really different. When we use RGB-D, laser scanners and other equipment to scan objects, especially relatively small objects, there are often measurement errors. If the irregular data caused by these errors are directly used for surface reconstruction, it will make the reconstructed surface not smooth or have loopholes, and this kind of irregular data is difficult to be eliminated by filtering methods such as statistical analysis mentioned above. therefore, in order to establish a smooth and complete model, it is necessary to smooth the object surface and repair loopholes.

You see below, on the left is the original scan data, and on the right is the result of surface smoothing using the least square method.

Xiaobai: from the picture, the effect of smoothing is really obvious. The black on the left cup is noise, and the result on the right has disappeared after smoothing.

Brother: yes, in addition to the equipment measurement errors mentioned above, there is also a case where point clouds need to be smoothed. That is, in the process of post-processing, for example, we scan the same object many times from different directions, and then register the scan results, and finally get a complete model, but the result of your registration is not necessarily accurate. For example, the left side of the picture below is the unprocessed result after registration. The same wall becomes "two walls" due to registration errors, which cannot completely overlap. Do you think this data can be directly used for surface reconstruction?

Xiaobai: what a pit. I'm sure I can't. The result of this reconstruction is two walls, right?

Brother: yes, so we need to find a way to turn the "two walls" into "one wall". If at this time, we do not have the conditions to re-scan a more accurate result, or the registration accuracy cannot be improved, the point cloud can be smoothed by resampling to avoid such a problem.

Xiaobai: so this smoothing is so important! How to use resampling to smooth it? I feel I can't wait to learn!

Brother: (now that the appetite has been hung up) Let's get to the point quickly. How to achieve point cloud smoothing through resampling?

Brother: point cloud resampling is actually achieved through a method called "MLS, MovingLeastSquares". The corresponding class is called pcl::MovingLeastSquares. Do you know how to use it?

Xiaobai: I don't know, but I still remember the method our brother told me last time. If you query the class name on PCL API documentation http://docs.pointclouds.org/trunk/, you can see the definition and usage of the class.

Brother: learn and use it. Haha, let's check it out now.

Xiaobai: well, I found out that the definition of this MLS class is here:

Http://docs.pointclouds.org/trunk/classpcl_1_1_moving_least_squares.html#a379330b0b1dacaa668d165f94930749c

There are many member functions.

Brother: yes, it seems to be a lot, but many of them are not commonly used. For example, a sample code we often use for resampling is as follows. Each line of code has been annotated for you. Combined with the URL above, it is easy to understand.

/ / resample a pair of point clouds

Pcl::search::KdTree

Xiaobai: brother, what is the KD-Tree in this code?

Brother: Kd-Tree is a data structure and a special case of spatial binary tree, which can be easily used for range search. KD-Tree is used here to facilitate the management and search of point clouds, and this structure makes it easy to find the nearest neighbor.

Xiaobai: I see. Does the above mls.setSearchRadius mean to search all the points in the space with the radius of 5cm at the current point?

Brother: yes, and then fit these points with second-order polynomials.

Xiaobai: so the surface becomes smooth! How to estimate the surface normal of a point cloud?

Xiaobai: brother, can it be gridded now?

Brother: not yet. Don't worry, we also need to estimate the surface normal (normal) of the point cloud before gridding.

Xiaobai: Ah, there is another normal.

Brother: the normal seems to have been learned in middle school. You should still remember the definition of the normal of the plane. The normal of the plane is a vector perpendicular to the plane, as shown in the following figure.

If you look at the picture on the right above, for a surface, the normal of the surface at some point P is a vector perpendicular to the tangent plane (tangent plane) of that point.

Xiaobai: yes, but what is the use of this normal? Why did it pop up all of a sudden?

Brother: normals are very useful, especially in 3D modeling. For example, in the field of computer graphics (computer graphics), normals determine the intensity processing (Flat Shading) of surfaces and light sources (light source). For each point light source position, its brightness depends on the direction of the surface normals.

Xiaobai: I see. However, it seems that the normal of a plane or surface is easier to calculate, the plane represented by the equation ax + by + cz = d, the vector (a, b, c)

Is its normal. And here we are a point cloud! How to calculate it?

Brother: that's true. The normal calculation of a point cloud is a little more troublesome, and there are generally two methods:

1. Using the surface reconstruction method, the corresponding surface of the sampling point is obtained from the point cloud data, and then the surface normal is calculated by the surface model.

2. Using approximations to infer surface normals directly from point cloud data sets.

Here, the second method is mainly used to approximately estimate the surface normal of each point in the point cloud.

Specifically, the problem of estimating the surface normal of a point is simplified to the analysis of the eigenvectors and eigenvalues of the covariance matrix calculated from the nearest neighbor of the point. PCL has already encapsulated the function for us.

We have calculated that the normal of the point cloud looks like this.

Xiaobai: does that arrow represent the normal?

Brother: yes, as we mentioned earlier, the surface normal at the point needs to be estimated from the neighborhood of the point around the point (also known as the k-neighborhood), so the selection of this K-neighborhood is also very important.

Xiaobai: will this K-neighborhood selection have any impact?

Brother: yes, and it has a great influence. The value of K nearest neighbor can be determined by selecting k nearest points or determining a set of points in a circle with a radius of r. You can see that the following diagram is the result of normal estimation of the same point cloud with different scale factors (k and r). The left part indicates that the scale factor is selected appropriately, and the estimated surface normal is approximately perpendicular to the two planes, and the edges can be clearly seen even in the edges perpendicular to each other. On the other hand, the scale factor on the right is a bit large, so that the set of nearby points covers the points near the surface more widely, and the estimated normals at the edges of the two planes are not accurate, which can not express the real situation.

Xiaobai: that's true. It seems that we should pay special attention to programming.

Brother: the example of normal estimation is as follows. I'll comment it for you, too.

/ / normal estimation

Pcl::NormalEstimation

This article refers to: PCL official website

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report