I'm planning on doing a registration between two clouds using RANSAC in PCL and I already have features computed from another program. Can I somehow load these features into PCL to use for the registration?
1 Answers
2
votes
Lets take PCL's prerejective alignment tutorial as an example that uses FPFH features and adapt it.
The code below (extracted from the tutorial) defines the feature type, computes it and passes to the alignment object.
typedef pcl::FPFHSignature33 FeatureT;
typedef pcl::PointCloud<FeatureT> FeatureCloudT;
FeatureCloudT::Ptr scene_features (new FeatureCloudT);
...
fest.compute (*scene_features);
...
pcl::SampleConsensusPrerejective<PointNT,PointNT,FeatureT> align;
align.setTargetFeatures (scene_features);
The third template argument for pcl::SampleConsensusPrerejective
is the feature type (in the example pcl::FPFHSignature33
). So all we need to do is to replace it with some custom feature type.
This is quite easy thanks to the Histogram point type. To define an N-dimensional feature point type:
typedef pcl::Histogram<N> FeatureT;
FeatureT feature_vector;
feature_vector.histogram
is a float[N] array.