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