点云技术相关产学研社区

 找回密码
 立即注册加入PCL中国点云技术相关产学研社区

扫一扫,访问微社区

查看: 3677|回复: 1

求助!点特征直方图无结果。我是新新手,请大家多帮忙!

[复制链接]
发表于 2014-5-21 18:25:24 | 显示全部楼层 |阅读模式
我在教程中cloud-viewer文件中添加了点特征直方图的代码,遇到如下问题,请大家帮忙,多多指教。

1.我添加了如下头文件,不知是否正确,是否有遗漏;

2.代码中pfh.setInputCloud(cloud); 总是提示 error:no suitable user-defined conversion from:boost share_ptr pcl::PointCloud<pcl::PointXYZRGBA>" to "const boost share_ptr const pcl::PointCloud<pcl::PointXYZ>>"

3.代码中pfh.setSearchMethod(tree); 也提示相似的错误: error:no suitable user-defined conversion from:boost share_ptr pcl::KdTreeFLANN<pcl::PointXYZ,flann::L2_Simple<float>>>'' to '' const boost share_ptr pcl::share::Search<pcl::PointXYZ>>" exists.

4.运行后.exe文件后出现结果:failed to find match for field 'rgba',如图所示:
5. void computePointPFHSignature(const pcl::PointCloud<PointInT>&cloud,        const pcl::PointCloud<PointNT>&normals,
        const std::vector<int>&indices,
        int nr_split,
        Eigen::VectorXF &pfh_histogram); 这个函数中<PointInT>和<PointNT>没有定义,请问这两个参数要怎么定义? 同时,提示namespace "Eigen" 中没有VectorXF这个成员。

附代码和运行结果截图如下,请高手多多指教。我是初学者的初学者,请大家多多帮忙!
#include <pcl/visualization/cloud_viewer.h>
#include <iostream>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
#include<pcl/point_types.h>
#include<pcl/features/pfh.h>
#include<pcl/features/normal_3d.h>
#include<pcl/point_cloud.h>
#include<pcl/kdtree/kdtree_flann.h>
int user_data;

void
viewerOneOff (pcl::visualization::PCLVisualizer& viewer)
{
    viewer.setBackgroundColor (1.0, 0.5, 1.0);
    pcl::PointXYZ o;
    o.x = 1.0;
    o.y = 0;
    o.z = 0;
    viewer.addSphere (o, 0.25, "sphere", 0);
    std::cout << "i only run once" << std::endl;

}

void
viewerPsycho (pcl::visualization::PCLVisualizer& viewer)
{
    static unsigned count = 0;
    std::stringstream ss;
    ss << "Once per viewer loop: " << count++;
    viewer.removeShape ("text", 0);
    viewer.addText (ss.str(), 200, 300, "text", 0);
    //FIXME: possible race condition here:
    user_data++;
}

int
main ()
{
    pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGBA>);
    pcl::io::loadPCDFile ("maize.pcd", *cloud);
    pcl::visualization::CloudViewer viewer("Cloud Viewer");   
    //showCloud函数是同步的,在此处等待直到渲染显示为止
    viewer.showCloud(cloud);
    //该注册函数在可视化时只调用一次
    viewer.runOnVisualizationThreadOnce (viewerOneOff);
    //该注册函数在渲染输出时每次都调用
    viewer.runOnVisualizationThread (viewerPsycho);
    while (!viewer.wasStopped ())
    {
    //在此处可以添加其他处理
    user_data++;
    }
    return 0;
        pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
        pcl::PointCloud<pcl::Normal>::Ptr normals(new pcl::PointCloud<pcl::Normal>());
        pcl::PFHEstimation<pcl::PointXYZ,pcl::Normal,pcl::PFHSignature125>pfh;
        pfh.setInputCloud(cloud);
        pfh.setInputNormals(normals);
        pcl::KdTreeFLANN<pcl::PointXYZ>::Ptr tree(new pcl::KdTreeFLANN<pcl::PointXYZ>());
        pfh.setSearchMethod(tree);

        pcl::PointCloud<pcl::PFHSignature125>::Ptr pfhs(new pcl::PointCloud<pcl::PFHSignature125>());
        pfh.setRadiusSearch(0.05);
        pfh.compute(*pfhs);
       

//        void computePointPFHSignature(const pcl::PointCloud<PointInT>&cloud,
//        const pcl::PointCloud<PointNT>&normals,
//        const std::vector<int>&indices,
//        int nr_split,
//        Eigen::VectorXF &pfh_histogram);



本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册加入PCL中国点云技术相关产学研社区

x
回复

使用道具 举报

发表于 2014-9-3 10:45:30 | 显示全部楼层
我也遇到同样的问题,我看了官方的文档PFH那个kdtree书上写错了,用的是pcl::search::KdTree<...>,你改下试试!
回复 支持 反对

使用道具 举报

本版积分规则

QQ|小黑屋|点云技术相关产学研社区 ( 陕ICP备13001629号 )

GMT+8, 2024-4-29 03:02 , Processed in 2.109713 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表