Point Cloud Library (PCL)  1.13.1-dev
feature_estimation.h
1 #pragma once
2 
3 #include "typedefs.h"
4 
5 #include <pcl/common/io.h>
6 #include <pcl/features/normal_3d.h>
7 #include <pcl/keypoints/sift_keypoint.h>
8 #include <pcl/features/fpfh.h>
9 #include <pcl/features/vfh.h>
10 
11 /* Use NormalEstimation to estimate a cloud's surface normals
12  * Inputs:
13  * input
14  * The input point cloud
15  * radius
16  * The size of the local neighborhood used to estimate the surface
17  * Return: A pointer to a SurfaceNormals point cloud
18  */
19 SurfaceNormalsPtr
20 estimateSurfaceNormals (const PointCloudPtr & input, float radius)
21 {
22  SurfaceNormalsPtr normals;
23  return (normals);
24 }
25 
26 /* Use SIFTKeypoint to detect a set of keypoints
27  * Inputs:
28  * points
29  * The input point cloud
30  * normals
31  * The input surface normals
32  * min_scale
33  * The smallest scale in the difference-of-Gaussians (DoG) scale-space
34  * nr_octaves
35  * The number of times the scale doubles in the DoG scale-space
36  * nr_scales_per_octave
37  * The number of scales computed for each doubling
38  * min_contrast
39  * The minimum local contrast that must be present for a keypoint to be detected
40  * Return: A pointer to a point cloud of keypoints
41  */
42 PointCloudPtr
43 detectKeypoints (const PointCloudPtr & points, const SurfaceNormalsPtr & normals,
44  float min_scale, int nr_octaves, int nr_scales_per_octave, float min_contrast)
45 {
46  PointCloudPtr keypoints;
47  return (keypoints);
48 }
49 
50 /* Use FPFHEstimation to compute local feature descriptors around each keypoint
51  * Inputs:
52  * points
53  * The input point cloud
54  * normals
55  * The input surface normals
56  * keypoints
57  * A cloud of keypoints specifying the positions at which the descriptors should be computed
58  * feature_radius
59  * The size of the neighborhood from which the local descriptors will be computed
60  * Return: A pointer to a LocalDescriptors (a cloud of LocalDescriptorT points)
61  */
62 LocalDescriptorsPtr
63 computeLocalDescriptors (const PointCloudPtr & points, const SurfaceNormalsPtr & normals,
64  const PointCloudPtr & keypoints, float feature_radius)
65 {
66  LocalDescriptorsPtr local_descriptors;
67  return (local_descriptors);
68 }
69 
70 /* Use VFHEstimation to compute a single global descriptor for the entire input cloud
71  * Inputs:
72  * points
73  * The input point cloud
74  * normals
75  * The input surface normals
76  * Return: A pointer to a GlobalDescriptors point cloud (a cloud containing a single GlobalDescriptorT point)
77  */
78 GlobalDescriptorsPtr
79 computeGlobalDescriptor (const PointCloudPtr & points, const SurfaceNormalsPtr & normals)
80 {
81  GlobalDescriptorsPtr global_descriptor;
82  return (global_descriptor);
83 }
84 
85 /* A simple structure for storing all of a cloud's features */
86 struct ObjectFeatures
87 {
88  PointCloudPtr points;
89  SurfaceNormalsPtr normals;
90  PointCloudPtr keypoints;
91  LocalDescriptorsPtr local_descriptors;
92  GlobalDescriptorsPtr global_descriptor;
93 };
94 
95 /* Estimate normals, detect keypoints, and compute local and global descriptors
96  * Return: An ObjectFeatures struct containing all the features
97  */
99 computeFeatures (const PointCloudPtr & input)
100 {
101  ObjectFeatures features;
102  features.points = input;
103  features.normals = estimateSurfaceNormals (input, 0.05);
104  features.keypoints = detectKeypoints (input, features.normals, 0.005, 10, 8, 1.5);
105  features.local_descriptors = computeLocalDescriptors (input, features.normals, features.keypoints, 0.1);
106  features.global_descriptor = computeGlobalDescriptor (input, features.normals);
107 
108  return (features);
109 }
PointCloudPtr points
LocalDescriptorsPtr local_descriptors
GlobalDescriptorsPtr global_descriptor
PointCloudPtr keypoints
SurfaceNormalsPtr normals