3D features inside the PCL

Source: Internet
Author: User
Tags require

I do not introduce the naming conventions of the classes within the PCL, and the types of points. Why not? The name specification of PCL inside class, more cumbersome, and mainly for the PCL this library to open source, and PCL inside the type too many, enough to meet your requirements. So we have to go a way with Chinese characteristics of the PCL doctrine.

Let's introduce the 3D features in the PCL today.

A point is a way to give a given area a description of the x, Y, Z of a Cartesian coordinate system. Assuming that the coordinate origin of the coordinate system is not changed, there may be two points, such as P1 and P2, that become T1 and T2, but their coordinates are unchanged.

Comparing these point clouds is not stable, because even though they have the same distance, they may be taken from different surfaces, so they may represent different information when they are combined with the adjacent points on the surface. This is because it is difficult to ensure that the T1 and T2 in the real world do not change. Some devices that acquire point clouds may acquire some additional data, such as brightness (intensity), such as surface smoothness (translation is not necessarily right, surface remission value), and color, and so on, but these often do not solve the problem.


Programs often require better features or moments to differentiate between geometric surfaces. So the concept of a 3D point as a single entity within the Cartesian coordinate system disappears, and we introduce a local coordinate system. Culture is colorful, Vientiane, we can take a lot of the same concept of naming combinations, such as shape description, geometric features, and in the PCL is used to describe the characteristics of the point.


By including the surrounding points, the geometrical characteristics of the sampled surface can be inferred or captured by us, which will solve the problem of our egg-ache comparison. Ideally, the characteristics of a point on the same or similar surface are very similar. So how to find a better, descriptive point of the characteristics of it. When this feature is under the influence of these 3 factors, it is a good feature to be able to get the same surface characteristics.

1. Rigid body conversion. This includes 3D rotation and 3D transformations, and good features should not be affected by this, and feature vector F (feature) will not change.

2. Different sample densities. In general, a local surface area, whether high density or low density sampling, should have the same eigenvector.

3. Noise. This does not require an excessive amount of explanation.



In general, the PCL uses similar methods to query the nearest neighbor of a specified point, such as using Kd-trees. Here are the types of 2 queries we are interested in;

1.k. That is, the number of nearest neighbor points at the time of the query.

2.R. That is, the search radius.


Professional terminology:

Term
explanation
Foo A class named Foo//English is a lot of random classes called Foo or bar similar to Zhang San, John Doe
Fooptr

A boost shared pointer to a class Foo,//boost share pointer

e.g., boost::shared_ptr<foo>

Fooconstptr

A const boost shared pointer to a Classfoo,//boost share constant pointer

e.g., const BOOST::SHARED_PTR<CONST foo>


How to enter it.

In PCL, basically all classes inherit from the PCL::P clbase This class, all pcl::feature have two ways to get input data.

1. Enter for the entire point cloud DataSet, Setinputcloud (pointcloudconstptr&) mandatory

This calculates the characteristics of each input point.

2. Enter as a subset of a point cloud dataset. Setinputcloud (pointcloudptr&) and SetIndices (indicesconstptr&) are optional.

This will calculate the characteristics of the input points for the target. The subscript is not given by default, which means that the characteristics of each point are calculated.

In addition, we can search for points on the surface through other calls, such as Setsearchsurface (Pointcloudconstptr &).


1.setIndices () =false,setsearchsurface () =false

This is the most used in the PCL, without any characteristics to exclude the point cloud, that is, the inclusion of all points.

Because we do not want to determine a different point cloud copy based on whether there is subscript or whether there is a surface, the PCL creates a series of vectors that point to the entire data set.

On the far left, it first finds the nearest neighbor of P1, and then finds the nearest neighbor of P2 until the point of P is exhausted.

2.setIndices () =true,setsearchsurface () =false

This will only calculate the characteristics of the corresponding point of the subscript in the given subscript vector, for example, the P1 belongs to the subscript vector, and P2 does not, it will only calculate the characteristics of the points near the P1.

3.setIndices () =false,setsearchsurface () =true

Only the characteristics of the nearest neighbor point of the potential surface are computed, not the entire point cloud. For example, p and q are two point clouds and then p as the surface to be searched (the potential surface), then each element of Q (Q1,Q2) will find the nearest few points in P.

4.setIndices () =true,setsearchsurface=true. This is probably the most rare case, as this both satisfies the subscript and also satisfies the surface search. In the last picture, the Q2 is first cleared by subscript, and then the nearest neighbor in P is searched for Q1.


We use the Setsearchsurface () most examples when we have a high-density input data set, but we don't want to calculate the characteristics of all the points inside, in this case we can solve this problem by Setsearchsurface (), Rather than through downsample (lower sampling, often via pcl::voxelgrid<t> filter) or keypoints (critical sampling). We use downsampled/keypoints as the input to the Setinputcloud (), which is the original data set of the Setsearchsurface ().


An example of normal estimation

Once you determine the local feature representation of a point that you want to query, you can capture the geometric characteristics of the potential surface of the query point. The first step in describing the geometric characteristics of a surface is to get its direction under a certain coordinate, so estimate its normals. The following code snippet predicts a series of surface normals for the input dataset.


#include <pcl/point_types.h> #include <pcl/features/normal_3d.h> {PCL::P OINTCLOUD&LT;PCL::P ointxyz>

  ::P TR Cloud (New PCL::P OINTCLOUD&LT;PCL::P ointxyz>);
  ... read, pass in or create a point cloud ...//Create the normal estimation class, and pass the input dataset to it
  PCL::NORMALESTIMATION&LT;PCL::P ointxyz, pcl::normal> ne;

  Ne.setinputcloud (Cloud);
  Create An empty kdtree representation, and pass it to the normal estimation object.
  Its content would be filled inside the object, based on the given input dataset (as no other search surface is given).
  PCL::SEARCH::KDTREE&LT;PCL::P ointxyz>::P tr Tree (new PCL::SEARCH::KDTREE&LT;PCL::P ointxyz> ());

  Ne.setsearchmethod (tree);

  Output Datasets PCL::P ointcloud<pcl::normal>::P tr cloud_normals (new PCL::P ointcloud<pcl::normal>);

  Use any neighbors in a sphere of radius 3cm ne.setradiussearch (0.03);

  Compute the features Ne.compute (*cloud_normals); CloUd_normals->points.size () should has the same size as the input cloud->points.size ()} 

The following code snippet predicts a series of surface normals through an input dataset and evaluates the nearest neighbor with another input dataset. As mentioned earlier, this is a data set that reduces the surface sample to get as input.

#include <pcl/point_types.h> #include <pcl/features/normal_3d.h> {PCL::P OINTCLOUD&LT;PCL::P ointxyz>
  ::P TR Cloud (New PCL::P OINTCLOUD&LT;PCL::P ointxyz>);

  PCL::P OINTCLOUD&LT;PCL::P ointxyz>::P tr cloud_downsampled (new PCL::P OINTCLOUD&LT;PCL::P ointxyz>); ... read, pass in or create a point cloud ... create a downsampled version of it ...//create the normal Estima
  tion class, and pass the input dataset to it PCL::NORMALESTIMATION&LT;PCL::P ointxyz, pcl::normal> ne;

  Ne.setinputcloud (cloud_downsampled);

  Pass the original data (before downsampling) as the search surface ne.setsearchsurface (cloud);
  Create An empty kdtree representation, and pass it to the normal estimation object.
  Its content is filled inside the object, based on the given surface dataset.
  PCL::SEARCH::KDTREE&LT;PCL::P ointxyz>::P tr Tree (new PCL::SEARCH::KDTREE&LT;PCL::P ointxyz> ());

  Ne.setsearchmethod (tree); Output Datasets PCL::P ointCloud<pcl::normal&gt::P tr cloud_normals (new PCL::P ointcloud<pcl::normal>);

  Use any neighbors in a sphere of radius 3cm ne.setradiussearch (0.03);

  Compute the features Ne.compute (*cloud_normals); Cloud_normals->points.size () should has the same size as the input cloud_downsampled->points.size ()}

There is also a subscript to reduce the sampling, the following example

#include <pcl/point_types.h> #include <pcl/features/normal_3d.h> {PCL::P OINTCLOUD&LT;PCL::P ointxyz>

  ::P TR Cloud (New PCL::P OINTCLOUD&LT;PCL::P ointxyz>); ... read, pass in or create a point cloud ...//create a set of indices to be used. For simplicity, we ' re going to being using the first 10% of the points in cloud std::vector<int> indices (Floor (Clou
  D->points.size ()/10));

  for (size_t i = 0; Indices.size (); ++i) indices[i] = i; Create the normal estimation class, and pass the input dataset to it PCL::NORMALESTIMATION&LT;PCL::P ointxyz, Pcl::nor
  Mal> NE;

  Ne.setinputcloud (Cloud); 
  Pass the Indices boost::shared_ptr<std::vector<int> > indicesptr (New std::vector<int> (indices));

  Ne.setindices (INDICESPTR);
  Create An empty kdtree representation, and pass it to the normal estimation object. Its content would be filled inside the object, based on the given input dataset (as no other search surface isgiven).
  PCL::SEARCH::KDTREE&LT;PCL::P ointxyz>::P tr Tree (new PCL::SEARCH::KDTREE&LT;PCL::P ointxyz> ());

  Ne.setsearchmethod (tree);

  Output Datasets PCL::P ointcloud<pcl::normal>::P tr cloud_normals (new PCL::P ointcloud<pcl::normal>);

  Use any neighbors in a sphere of radius 3cm ne.setradiussearch (0.03);

  Compute the features Ne.compute (*cloud_normals); Cloud_normals->points.size () should has the same size as the input indicesptr->size ()}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.