2015-7-28 调试pcl



   #include <pcl/io/pcd_io.h>
#include <pcl/features/normal_3d.h>
#include <pcl/features/pfh.h>
 
int
main(int argc, char** argv)
{
 // Object for storing the point cloud.
 pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>);
 // Object for storing the normals.
 pcl::PointCloud<pcl::Normal>::Ptr normals(new pcl::PointCloud<pcl::Normal>);
 // Object for storing the PFH descriptors for each point.
 pcl::PointCloud<pcl::PFHSignature125>::Ptr descriptors(new pcl::PointCloud<pcl::PFHSignature125>());
 
 // Read a PCD file from disk.
 if(argc==1)
  return -1;
 if (pcl::io::loadPCDFile<pcl::PointXYZ>(argv[1], *cloud) != 0)
 {
  return -1;
 }
 
 // Note: you would usually perform downsampling now. It has been omitted here
 // for simplicity, but be aware that computation can take a long time.
 
 // Estimate the normals.
 pcl::NormalEstimation<pcl::PointXYZ, pcl::Normal> normalEstimation;
 normalEstimation.setInputCloud(cloud);
 normalEstimation.setRadiusSearch(0.03);
 pcl::search::KdTree<pcl::PointXYZ>::Ptr kdtree(new pcl::search::KdTree<pcl::PointXYZ>);
 normalEstimation.setSearchMethod(kdtree);
 normalEstimation.compute(*normals);
 
 // PFH estimation object.
 pcl::PFHEstimation<pcl::PointXYZ, pcl::Normal, pcl::PFHSignature125> pfh;
 pfh.setInputCloud(cloud);
 pfh.setInputNormals(normals);
 pfh.setSearchMethod(kdtree);
 // Search radius, to look for neighbors. Note: the value given here has to be
 // larger than the radius used to estimate the normals.
 pfh.setRadiusSearch(0.05);
 
 pfh.compute(*descriptors);
}

1.vs2010中出现这种情况,首先设置断点,看一下问题出在哪条语句,此次调试,问题出现在

if (pcl::io::loadPCDFile<pcl::PointXYZ>(argv[1], *cloud) != 0)   在pcl中,此句是用来导入点云图,所以修改办法是在属性 ,调试,命令参数  中加入cpd文件


或者为了避免发生这种情况,也可以if(argc==1)    return -1; 加入此语句,是为了让argc等于1的时候,也有输出

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值