2016-08-30 4 views
0

私は以下のように新しいポイントタイプを宣言しました。しかし、私は利用可能なすべてのPCL機能を使用する必要があります。セグメンテーション、ボクセルグリッドなどのようなものです。すべての実装ヘッダーにPCL_INSTANTIATEコールを含めるのは苦痛です。すべての主要な機能についてこれを行うためにとにかくありますか?たとえば、セグメンテーションライブラリ内のすべての関数のポイントタイプをコンパイルしますか?PCLすべての関数の新しいポイントタイプのインスタンス化

#define PCL_NO_PRECOMPILE 

#include <pcl/point_cloud.h> 
#include <pcl/point_types.h> 
#include <pcl/impl/instantiate.hpp> 

#include <pcl/kdtree/kdtree.h> 
#include <pcl/kdtree/kdtree_flann.h> 
#include <pcl/kdtree/impl/kdtree_flann.hpp> 
#include <pcl/search/impl/kdtree.hpp> 

#include <pcl/octree/octree_search.h> 
#include <pcl/octree/impl/octree_search.hpp> 

#include <pcl/segmentation/sac_segmentation.h> 
#include <pcl/segmentation/impl/sac_segmentation.hpp> 

struct FeaturePoint 
{ 
    PCL_ADD_POINT4D; 
    PCL_ADD_RGB; 
    PCL_ADD_NORMAL4D; 

    static const int DESCRIPTOR_SIZE = 128; 
    float descriptor[DESCRIPTOR_SIZE]; 

    FeaturePoint() {} 
    FeaturePoint(const FeaturePoint& input) 
    { 
     this->x = input.x; 
     this->y = input.y; 
     this->z = input.z; 
     this->rgb = input.rgb; 
     this->normal_x = input.normal_x; 
     this->normal_y = input.normal_y; 
     this->normal_z = input.normal_z; 
     for(int i = 0; i < DESCRIPTOR_SIZE; ++i) { this->descriptor[i] = input.descriptor[i]; } // Ugly, as I was lazy 
    } 

    EIGEN_MAKE_ALIGNED_OPERATOR_NEW; 
} EIGEN_ALIGN16; 

POINT_CLOUD_REGISTER_POINT_STRUCT (FeaturePoint, 
            (float, x, x) 
            (float, y, y) 
            (float, z, z) 
            (float, rgb, rgb) 
            (float, normal_x, normal_x) 
            (float, normal_y, normal_y) 
            (float, normal_z, normal_z) 
            (float, descriptor, descriptor) 
); 

PCL_INSTANTIATE(KdTree, FeaturePoint); 
PCL_INSTANTIATE(KdTreeFLANN, FeaturePoint); 
PCL_INSTANTIATE(OctreePointCloudSearch, FeatureP 

答えて

0

これは機能しません!


代わりの

PCL_INSTANTIATE(function,template);

を使用して、私はそれが役に立てば幸い

PCL_INSTANTIATE_PointCloud(template);

を試してみてください。私は2日目にこのソリューションを探していました。

+0

これは正確には何ですか?私はまだimplヘッダ/ファイルを含める必要がありますか? – power2

+0

私はちょうどそれを試してまだ未定義の参照を得る – raaj

+0

すべての機能を試した後、まだ動作しません。 使用しているPCLのバージョンは何ですか? – jmlg91

0

UPDATE:時間のソリューションを試した後、これはすべての機能のために正しく動作:PCLapp.hのコードの

代表一部:PCLapp.cppのコードの

include pcl-1.8/pcl/point_cloud.h 
include pcl-1.8/pcl/point_types.h 
include pcl-1.8/pcl/filters/voxel_grid.h 
include boost/shared_ptr.hpp 

namespace pcl{ 

struct PointXYZIR 
    { 
    PCL_ADD_POINT4D      // Macro quad-word XYZ 
    float intensity;     // Laser intensity 
    uint16_t ring;      // Laser ring number 
    EIGEN_MAKE_ALIGNED_OPERATOR_NEW  // Ensure proper alignment 
    } EIGEN_ALIGN16; 
} 

POINT_CLOUD_REGISTER_POINT_STRUCT(PointXYZIR, 
            (float, x, x) 
            (float, y, y) 
            (float, z, z) 
            (float, intensity, intensity) 
            (uint16_t, ring, ring) 
) 


typedef pcl::PointCloud<pcl::PointXYZIR> PointCloudXYZIR; 

### I didn't include any .hpp file (like tutorial said) 

代表一部(VoxelGrid例)

boost::shared_ptr<PointCloudXYZIR> input_cloud(new PointCloudXYZIR); 
PointCloudXYZIR::ConstPtr input_cloudPtr(input_cloud); 

pcl::VoxelGrid<pcl::PointXYZIR> vox; 
vox.setInputCloud(input_cloudPtr); 
vox.setLeafSize(0.05,0.05,0.05); 
vox.filter(*input_cloud); 

これは何もせずにすべてのフィルタで完全に機能します。

関連する問題