当前位置:网站首页>On 3dsc theory and application of 3D shape context feature

On 3dsc theory and application of 3D shape context feature

2022-06-12 10:27:00 Program ape Lao Gan

Catalog

         One . brief introduction

         Two . Principle and implementation

         3、 ... and . Code

         summary

        Reference

In a previous blog post , We have already introduced the use of FPFH Create a local shape description on the point cloud , Realize the efficient expression of the geometric features of the local hidden surface of the point cloud ( Talking about FPFH Algorithm implementation principle and its application in point cloud registration ). today , We will introduce another local shape descriptor , That is, 3D shape context feature 3D Shape Context (3DSC)[1]. I need to prepare this part for the recent class , I was going to find a ready-made material to learn about it . But I read several blogs , It's almost the same , So I downloaded the original paper , Read it from the beginning , Some principles and implementation details will be expanded in this blog , I hope I can help students in need .


One . brief introduction

In case of noise pollution , In the 3D scene with irregular data distribution , Realize the recognition of target objects , It's usually difficult . In order to express the geometric characteristics of the target object , And obtain robustness to noise and irregular data distribution ,3DSC Proposed . As a classical local shape descriptor ,3DSC It makes good use of the statistical characteristics of three-dimensional data distribution , A relatively balanced solution is established in the two tasks of geometric information expression and anti noise .

As a whole , A good local shape descriptor should have three advantages : First of all , It can be robust to noise and data defects caused by occlusion ; second , It can accurately describe the geometric information of 3D objects ; Third , Capable of processing low resolution data , At least a relatively stable feature expression can be established . These characteristics are very important for the design of registration and location algorithms . in consideration of shape context The successful application of this method in image field [2], Based on a similar principle ,3DSC It is proposed to establish the geometric feature description of 3D point cloud , At the same time, it meets the above requirements for local shape descriptors . Let's introduce it in detail 3DSC The principle and implementation method of .


Two . Principle and implementation

Similar to other statistical shape features ,3DSC The goal of is to establish a representation of local point distribution . This representation needs to clearly delineate the adjacent area of each point , The density of points and the geometric properties of the corresponding distribution . An intuitive idea is to create a local space for a point . Based on this space , Divide different areas , And calculate the number of points in these areas . after , Take the number of points in each region as one of the histogram bin Data item , Build all the areas into different bin, Finally get the histogram . Because the partition of the local space is the same for all points , that bin The data distribution directly describes the different geometric characteristics of each point . In this way, the basic requirements for local shape descriptors are met .

There is a point cloud data P,p For one of them ,n by p The normal direction of . Consider such a spherical space ( chart 1), With p For the center of the ball , With n Is due north of the ball , This creates a local spherical space . According to the radius and two angles ( Azimuth and elevation ) The directions are respectively J+1,K+1 and L+1 Segments . such , We get a with J * K * L individual bin The histogram data of . The radius segment here uses a logarithmic operation , The equation is as follows :

among r_max and r_min Is the boundary of the radius of spherical space . The reason for setting a r_min Instead of taking 0, Because it's near the center bin The area of is too small , The obtained data often loses its statistical significance . therefore , Set up a r_min And the use of logarithmic functions for transformation , To prevent the distribution of points in small radius areas from losing statistical significance . 

chart 1. Visual diagram of ball space .

On this basis , We need for each one bin Set a corresponding weight , To facilitate the establishment of weighted data analysis results later . The weight formula is as follows :

V(j,k,l) The corresponding is bin Volume ,ρi Corresponding to the local point density ,pi For in p Points in defined spherical space .ρi Based on points and pi To estimate the corresponding radius . There is no right to ρi Give a very specific explanation , I think it's just V(j,k,l) Divide by this bin Number of points , That is density . By the above calculation , We count every bin The number of weighted points in , Get histogram data , That is to say 3DSC. You can see ,3DSC And FPFH It's like , Just replace the angle information with the position information .


3、 ... and . Code

#include <iostream>

#include <pcl/io/pcd_io.h>
#include <pcl/features/3dsc.h>
#include <pcl/features/normal_3d.h>

int
main (int, char** argv)
{
  std::string filename = argv[1];
  std::cout << "Reading " << filename << std::endl;
  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);

  if (pcl::io::loadPCDFile <pcl::PointXYZ> (filename, *cloud) == -1)
  // load the file
  {
    PCL_ERROR ("Couldn't read file\n");
    return (-1);
  }
  std::cout << "Loaded " << cloud->size () << " points." << std::endl;

  // Compute the normals
  pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> normal_estimation;
  normal_estimation.setInputCloud (cloud);

  pcl::search::KdTree<pcl::PointXYZ>::Ptr kdtree (new pcl::search::KdTree<pcl::PointXYZ>);
  normal_estimation.setSearchMethod (kdtree);

  pcl::PointCloud<pcl::Normal>::Ptr normals (new pcl::PointCloud< pcl::Normal>);
  normal_estimation.setRadiusSearch (0.03);
  normal_estimation.compute (*normals);

  // Setup the shape context computation
  pcl::ShapeContext3DEstimation<pcl::PointXYZ, pcl::Normal, pcl::ShapeContext1980> shape_context;

  // Provide the point cloud
  shape_context.setInputCloud (cloud);
  // Provide normals
  shape_context.setInputNormals (normals);
  // Use the same KdTree from the normal estimation
  shape_context.setSearchMethod (kdtree);
  pcl::PointCloud<pcl::ShapeContext1980>::Ptr shape_context_features (new pcl::PointCloud<pcl::ShapeContext1980>);

  // The minimal radius is generally set to approx. 1/10 of the search radius, while the pt. density radius is generally set to 1/5
  shape_context.setRadiusSearch (0.2);
  shape_context.setPointDensityRadius (0.04);
  shape_context.setMinimalRadius (0.02);

  // Actually compute the shape contexts
  shape_context.compute (*shape_context_features);
  std::cout << "3DSC output size (): " << shape_context_features->size () << std::endl;

  // Display and retrieve the shape context descriptor vector for the 0th point.
  std::cout << (*shape_context_features)[0] << std::endl;
  //float* first_descriptor = (*shape_context_features)[0].descriptor; // 1980 elements

  return 0;
}

summary

3DSC Is to do a statistical analysis on the part of the point . For improving the robustness of noise and random distribution ,3DSC Of course, the benefits are obvious . Feature expression in local spherical space ,3DSC Insensitive to random disturbances at some points , Therefore, it has certain advantages over the general curvature characteristics . But careful readers will find , For a little 3DSC feature extraction , It is bound to be limited to a certain extent by the accuracy of the normal . Because the orientation of the sphere space is determined by the normal . If there is a non negligible error in the normal estimation , that 3DSC The accuracy of features is bound to be affected . In our next blog post, we'll talk about 3DSC A solution to the normal perturbation of features , That is, harmonic shape contextual features (Harmonic shape contexts).


Reference

[1] A. Frome, et al. Recognizing objects in range data using regional point descriptors [C]. ECCV, 2004: 224-237.

[2] S. Belongie, et al. Shape matching and object recognition using shape contexts [J]. TPAMI, 24(4):509-522.

原网站

版权声明
本文为[Program ape Lao Gan]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/163/202206121021044614.html