PCL 为所有函数实例化新的点类型 [英] PCL Instantiating new Point Types for all Functions

查看:114
本文介绍了PCL 为所有函数实例化新的点类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面声明了一个新的点类型.但是,我需要它与所有可用的 PCL 功能一起使用.例如分割、体素网格等.在 PCL_INSTANTIATE 调用中包含所有实现标头是一种痛苦.无论如何都要对所有主要功能执行此操作吗?例如,为分割库中的所有函数编译我的点类型?

I have declared a new point type as such below. However, I need it to work with all available PCL functions. Such as segmentation, voxel grid etc. It is a pain to include all the implementation headers do the PCL_INSTANTIATE call. Is there anyway to do this for all major functions? For example, compile my point type for all functions in the segmentation library?

    #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

推荐答案

这行不通!!

代替使用

PCL_INSTANTIATE(function,template);

试试

PCL_INSTANTIATE_PointCloud(template);

希望能帮到你.我花了 2 天时间寻找这个解决方案.

I hope it helps. I was 2 day looking for this solution.

这篇关于PCL 为所有函数实例化新的点类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆