1 #ifndef OBJECT_RECOGNITION_H_
2 #define OBJECT_RECOGNITION_H_
5 #include "load_clouds.h"
7 #include "segmentation.h"
8 #include "feature_estimation.h"
9 #include "registration.h"
11 #include <pcl/io/pcd_io.h>
12 #include <pcl/kdtree/kdtree_flann.h>
66 size_t n = filenames.size ();
69 for (
size_t i = 0; i < n; ++i)
71 const std::string & filename = filenames[i];
72 if (filename.compare (filename.size ()-4, 4,
".pcd") == 0)
83 models_[i].points = loadPointCloud<PointT> (filename,
"_points.pcd");
84 models_[i].keypoints = loadPointCloud<PointT> (filename,
"_keypoints.pcd");
85 models_[i].local_descriptors = loadPointCloud<LocalDescriptorT> (filename,
"_localdesc.pcd");
86 models_[i].global_descriptor = loadPointCloud<GlobalDescriptorT> (filename,
"_globaldesc.pcd");
101 std::vector<int> nn_index (1);
102 std::vector<float> nn_sqr_distance (1);
103 kdtree_->nearestKSearch (query_descriptor, 1, nn_index, nn_sqr_distance);
104 const int & best_match = nn_index[0];
116 std::vector<int> nn_index (1);
117 std::vector<float> nn_sqr_distance (1);
118 kdtree_->nearestKSearch (query_descriptor, 1, nn_index, nn_sqr_distance);
119 const int & best_match = nn_index[0];
131 SurfaceNormalsPtr normals;
147 std::vector<pcl::PointIndices> cluster_indices;
151 PointCloudPtr largest_cluster (
new PointCloud);
154 return (largest_cluster);
160 SurfaceNormalsPtr & normals_out, PointCloudPtr & keypoints_out,
161 LocalDescriptorsPtr & local_descriptors_out, GlobalDescriptorsPtr & global_descriptor_out)
const
168 local_descriptors_out = computeLocalDescriptors (points, normals_out, keypoints_out,
171 global_descriptor_out = computeGlobalDescriptor (points, normals_out);
179 Eigen::Matrix4f tform;
186 tform = refineAlignment (source.
points, target.
points, tform,