4 #include "load_clouds.h"
5 #include "solution/filters.h"
6 #include "solution/segmentation.h"
7 #include "solution/feature_estimation.h"
8 #include "solution/registration.h"
10 #include <pcl/io/pcd_io.h>
11 #include <pcl/kdtree/kdtree_flann.h>
64 std::size_t n = filenames.size ();
67 for (std::size_t i = 0; i < n; ++i)
69 const std::string & filename = filenames[i];
70 if (filename.compare (filename.size ()-4, 4,
".pcd") == 0)
81 models_[i].points = loadPointCloud<PointT> (filename,
"_points.pcd");
82 models_[i].keypoints = loadPointCloud<PointT> (filename,
"_keypoints.pcd");
83 models_[i].local_descriptors = loadPointCloud<LocalDescriptorT> (filename,
"_localdesc.pcd");
84 models_[i].global_descriptor = loadPointCloud<GlobalDescriptorT> (filename,
"_globaldesc.pcd");
99 std::vector<int> nn_index (1);
100 std::vector<float> nn_sqr_distance (1);
101 kdtree_->nearestKSearch (query_descriptor, 1, nn_index, nn_sqr_distance);
102 const int & best_match = nn_index[0];
114 std::vector<int> nn_index (1);
115 std::vector<float> nn_sqr_distance (1);
116 kdtree_->nearestKSearch (query_descriptor, 1, nn_index, nn_sqr_distance);
117 const int & best_match = nn_index[0];
129 SurfaceNormalsPtr normals;
145 std::vector<pcl::PointIndices> cluster_indices;
149 PointCloudPtr largest_cluster (
new PointCloud);
152 return (largest_cluster);
158 SurfaceNormalsPtr & normals_out, PointCloudPtr & keypoints_out,
159 LocalDescriptorsPtr & local_descriptors_out, GlobalDescriptorsPtr & global_descriptor_out)
const
166 local_descriptors_out = computeLocalDescriptors (points, normals_out, keypoints_out,
169 global_descriptor_out = computeGlobalDescriptor (points, normals_out);
177 Eigen::Matrix4f tform;
184 tform = refineAlignment (source.
points, target.
points, tform,
195 std::vector<ObjectModel>
models_;
pcl::KdTreeFLANN< GlobalDescriptorT >::Ptr kdtree_
PointCloudPtr applyFiltersAndSegment(const PointCloudPtr &input, const ObjectRecognitionParameters ¶ms) const
std::vector< ObjectModel > models_
const ObjectModel & recognizeObject(const PointCloudPtr &query_cloud)
GlobalDescriptorsPtr descriptors_
PointCloudPtr recognizeAndAlignPoints(const PointCloudPtr &query_cloud)
void populateDatabase(const std::vector< std::string > &filenames)
ObjectRecognition(const ObjectRecognitionParameters ¶ms)
ObjectRecognitionParameters params_
PointCloudPtr alignModelPoints(const ObjectModel &source, const ObjectModel &target, const ObjectRecognitionParameters ¶ms) const
void constructObjectModel(const PointCloudPtr &points, ObjectModel &output) const
void estimateFeatures(const PointCloudPtr &points, const ObjectRecognitionParameters ¶ms, SurfaceNormalsPtr &normals_out, PointCloudPtr &keypoints_out, LocalDescriptorsPtr &local_descriptors_out, GlobalDescriptorsPtr &global_descriptor_out) const
KdTreeFLANN is a generic type of 3D spatial locator using kD-tree structures.
shared_ptr< KdTreeFLANN< PointT, Dist > > Ptr
void transformPointCloud(const pcl::PointCloud< PointT > &cloud_in, pcl::PointCloud< PointT > &cloud_out, const Eigen::Matrix< Scalar, 4, 4 > &transform, bool copy_all_fields)
Apply a rigid transform defined by a 4x4 matrix.
void copyPointCloud(const pcl::PointCloud< PointInT > &cloud_in, pcl::PointCloud< PointOutT > &cloud_out)
Copy all the fields from a given point cloud into a new point cloud.
int loadPCDFile(const std::string &file_name, pcl::PCLPointCloud2 &cloud)
Load a PCD v.6 file into a templated PointCloud type.
GlobalDescriptorsPtr global_descriptor
LocalDescriptorsPtr local_descriptors
float outlier_rejection_radius
int max_ransac_iterations
float downsample_leaf_size
float initial_alignment_min_sample_distance
int outlier_rejection_min_neighbors
float icp_max_correspondence_distance
float icp_transformation_epsilon
float initial_alignment_max_correspondence_distance
float plane_inlier_distance_threshold
float keypoints_nr_scales_per_octave
float local_descriptor_radius
float icp_outlier_rejection_threshold
float keypoints_min_contrast
int initial_alignment_nr_iterations
float surface_normal_radius
float keypoints_nr_octaves
float keypoints_min_scale
A point structure representing the Viewpoint Feature Histogram (VFH).