Histogram of point features inside the PCL (PFH)

Source: Internet
Author: User

The surface normals and curvature can represent the geometrical characteristics of a point well. However, they are very fast and the algorithms are simple, but they cannot capture details, they are just approximate estimates of the geometric characteristics of the nearest neighbor. As a direct result, most scenarios tend to include many points with similar characteristics, which reduces the amount of information they bring.

This time we will introduce a 3D feature descriptor called PFH (Point feature Histgrams), which will also show some of its theoretical advantages and discuss some of its implementation details.

The goal of PFH is to encode a point's K nearest neighbor geometry properties by using the average curvature of a multidimensional histogram around a point. This high-dimensional space provides some useful features to represent, while the 6-bit pose is constant, and can respond well to different sampling densities and near-neighbor noise levels.

A point feature histogram is related to the nearest neighbor and normal of a point and, simply, it attempts to capture the best sampling plane by considering the effects of each predicted normal direction. The final high-dimensional space is therefore related to the direction of the surface normals of each point.

The following figure shows an area graph of the effects of a pfh at the point of calculating PQ, which is marked in red and placed in the center of a circle with a radius of R, and then all its neighbors (distance less than radius r) are indirectly adjacent by a grid. The following PFH descriptor calculates the relationship between all matching points as a histogram, with an O (k-square) complexity.

Calculating the absolute difference between pi and PJ, and the normals associated with them NS and NJ, we define a fixed coordinate system at a certain point.

I found that the above expression in the official website does not correspond to the following diagram, as the standard, the direction and size of the V vector inside the equation is not in the picture. Using the above UVW coordinate system, the difference between the NS normal and the NI normal can be resolved to the difference of the following 3 angles (because their modules are the same):

D is the square of the two point distance, which is 4 elements per pair of points, thus reducing the original 12 values (2x per point {(x, y, z), (NX,NY,NZ)}) to 4 values.

Using PFH to get four elements of a point can be used in the following way:

Computepairfeatures (const eigen::vector4f &P1, const eigen::vector4f &N1,
                     const eigen::vector4f &P2, Const eigen::vector4f &N2,
                     float &f1, float &f2, float &f3, float &f4);

To generate the final PFH representation of each query point, the four-factor collection is placed inside the histogram. The process of distribution is to divide all the features (3 angles above, the square of a distance) evenly into small B, and then count the number of each sub-interval. Since there are 3 characteristics that are the angles between normals, they can be well normalized and put into the circle of trigonometric functions (high school knowledge). One distribution case is to distribute each feature interval evenly, and then we have a histogram with a four-time distribution of B. In this figure there is an interval value of not 0, which has a certain value. The picture below shows a PFH map of the different points in a point cloud.

In some cases, D is not a good feature. For 2.5D datasets, such as robots, distance varies with the viewpoint. So, sometimes it's better to omit D.

The PFH feature is inside the PCL inside the Pcl_features library.

The default PFH is distributed in 5 intervals and does not include distances, so there are 125-bit arrays that generate 5 of 3 parties and place them in the PCL::P FHSignature125 this point type.

The following is a code snippet.

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

  PCL::P ointcloud<pcl::normal>::P tr normals (new PCL::P ointcloud<pcl::normal> ()); ... read, pass in or create a point cloud with normals ... (Note:you can create a single pointcloud<pointnormal> if you want) ...//Create the PFH estimation class, and P
  The input dataset+normals to it PCL::P FHESTIMATION&LT;PCL::P ointxyz, Pcl::normal, PCL::P fhsignature125> PFH;
  Pfh.setinputcloud (Cloud);
  Pfh.setinputnormals (normals);

  Alternatively, if Cloud is the TPE pointnormal, do pfh.setinputnormals (cloud);
  Create An empty kdtree representation, and pass it to the PFH 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> ()); PCL::KDTREEFLANN&LT;PCL::P ointxyz>::P tr Tree (new PCL::KDTREEFLANN&LT;PCL::P ointxyz> ());

  --Older call for PCL 1.5-pfh.setsearchmethod (tree); Output Datasets PCL::P OINTCLOUD&LT;PCL::P fhsignature125>::P tr PFHS (new PCL::P OINTCLOUD&LT;PCL::

  Pfhsignature125> ()); Use all neighbors in a sphere for radius 5cm//important:the radius used here have to be larger than the radius used
  To estimate the surface normals!!!

  Pfh.setradiussearch (0.05);

  Compute the features Pfh.compute (*PFHS); Pfhs->points.size () should has the same size as the input cloud->points.size () *}

A few things are done inside the Pfhestimation class:

1. Get the nearest neighbor of P

2. For each adjacent pair, calculate 3 angles

3. Distribute all the results into the histogram.

Only a single PFH feature is calculated to represent:

Computepointpfhsignature (const PCL::P ointcloud<pointint> &cloud,
                          const PCL::P OINTCLOUD<POINTNT > &normals,
                          const std::vector<int> &indices,
                          int nr_split,
                          eigen::vectorxf &pfh_ histogram);

Nr_spilit is an interval that is distributed, which represents an angle feature, and Pfh_histgram is the histogram of the result.

Because sometimes the value of the normal may be Nan (not a number) or invalid value, so you can use the following code to optimize, the following code is placed on the compute () above the function

for (int i = 0; i < normals->points.size (); i++)
{
  if (!pcl::isfinite<pcl::normal> (normals-> Points[i])
  {
    Pcl_warn ("normals[%d" is not finite\n ", i);
  }
}

 

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.