4 #include "load_clouds.h"
6 #include "segmentation.h"
7 #include "feature_estimation.h"
8 #include "registration.h"
10 #include <pcl/io/pcd_io.h>
11 #include <pcl/kdtree/kdtree_flann.h>
65 std::size_t n = filenames.size ();
68 for (std::size_t i = 0; i < n; ++i)
70 const std::string & filename = filenames[i];
71 if (filename.compare (filename.size ()-4, 4,
".pcd") == 0)
82 models_[i].points = loadPointCloud<PointT> (filename,
"_points.pcd");
83 models_[i].keypoints = loadPointCloud<PointT> (filename,
"_keypoints.pcd");
84 models_[i].local_descriptors = loadPointCloud<LocalDescriptorT> (filename,
"_localdesc.pcd");
85 models_[i].global_descriptor = loadPointCloud<GlobalDescriptorT> (filename,
"_globaldesc.pcd");
100 std::vector<int> nn_index (1);
101 std::vector<float> nn_sqr_distance (1);
102 kdtree_->nearestKSearch (query_descriptor, 1, nn_index, nn_sqr_distance);
103 const int & best_match = nn_index[0];
115 std::vector<int> nn_index (1);
116 std::vector<float> nn_sqr_distance (1);
117 kdtree_->nearestKSearch (query_descriptor, 1, nn_index, nn_sqr_distance);
118 const int & best_match = nn_index[0];
130 SurfaceNormalsPtr normals;
146 std::vector<pcl::PointIndices> cluster_indices;
150 PointCloudPtr largest_cluster (
new PointCloud);
153 return (largest_cluster);
159 SurfaceNormalsPtr & normals_out, PointCloudPtr & keypoints_out,
160 LocalDescriptorsPtr & local_descriptors_out, GlobalDescriptorsPtr & global_descriptor_out)
const
167 local_descriptors_out = computeLocalDescriptors (points, normals_out, keypoints_out,
170 global_descriptor_out = computeGlobalDescriptor (points, normals_out);
178 Eigen::Matrix4f tform;
185 tform = refineAlignment (source.
points, target.
points, tform,
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).