I am trying to run the "Creating input" part from this site (https://github.com/IntelVCL/FastGlobalRegistration)
// Assume a point cloud with normal is given as
// pcl::PointCloud<pcl::PointNormal>::Ptr object
pcl::FPFHEstimationOMP<pcl::PointNormal, pcl::PointNormal, pcl::FPFHSignature33> fest;
pcl::PointCloud<pcl::FPFHSignature33>::Ptr object_features(new pcl::PointCloud<pcl::FPFHSignature33>());
fest.setRadiusSearch(feature_radius_);
fest.setInputCloud(object);
fest.setInputNormals(object);
fest.compute(*object_features);
FILE* fid = fopen("features.bin", "wb");
int nV = object->size(), nDim = 33;
fwrite(&nV, sizeof(int), 1, fid);
fwrite(&nDim, sizeof(int), 1, fid);
for (int v = 0; v < nV; v++) {
const pcl::PointNormal &pt = object->points[v];
float xyz[3] = {pt.x, pt.y, pt.z};
fwrite(xyz, sizeof(float), 3, fid);
const pcl::FPFHSignature33 &feature = object_features->points[v];
fwrite(feature.histogram, sizeof(float), 33, fid);
}
fclose(fid);
After including pcl/features/fpfh.h, pcl/features/fpfh_omp.h and linking to pcl_features_debug.lib and other related lib files, the compiler still has problems to compile the code. It gave me this linking error:
Error LNK2001 unresolved external symbol "private: virtual void __thiscall pcl::FPFHEstimationOMP::computeFeature(class pcl::PointCloud &)" (?computeFeature@?$FPFHEstimationOMP@UPointNormal@pcl@@U12@UFPFHSignature33@2@@pcl@@EAEXAAV?$PointCloud@UFPFHSignature33@pcl@@@2@@Z) DepthToPointCloud D:\Luan_Van\PCL\DepthToPoint\build\main.obj 1
I have succeeded to compile some other codes using pcl_io and pcl_visualization but this one just won't work. Anyone can point out what is wrong with my code, please?
By the way, I am using Visual Studio 2015, PCL 1.8.0
Please check line 48 in pcl/features/src/fpfh.cpp:
PCL_INSTANTIATE_PRODUCT(FPFHEstimationOMP, ((pcl::PointXYZ)(pcl::PointXYZI)(pcl::PointXYZRGB)(pcl::PointXYZRGBA))((pcl::Normal))((pcl::FPFHSignature33)))
in the default code, there's no instantiation for
FPFHEstimationOMP<pcl::PointNormal, pcl::PointNormal, pcl::FPFHSignature33>
you can change this line to
PCL_INSTANTIATE_PRODUCT(FPFHEstimationOMP, ((pcl::PointXYZ)(pcl::PointXYZI)(pcl::PointXYZRGB)(pcl::PointXYZRGBA)(pcl::PointNormal))((pcl::Normal)(pcl::PointNormal))((pcl::FPFHSignature33)))
and rebuild PCL, which should work.