点云技术相关产学研社区

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

扫一扫,访问微社区

查看: 3973|回复: 3

voxelgrid滤波,程序执行到voxelgrid实例化对象的时候好像就.....

[复制链接]
发表于 2013-11-25 15:19:55 | 显示全部楼层 |阅读模式
教材上的例子,编译没问题,就是运行不出来结果,好像就能执行到红色部分,以后不能执行好像,
运行结果只能打印出滤波前点的数量,滤波之后打印点的数量,以及保存pcd文件都不行,求解决!
#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/filters/voxel_grid.h>
int
main (int argc, char** argv)
{
  pcl::PCLPointCloud2::Ptr cloud (new pcl::PCLPointCloud2 ());
  pcl::PCLPointCloud2::Ptr cloud_filtered (new pcl::PCLPointCloud2 ());

  // Fill in the cloud data
  pcl::PCDReader reader;
  // Replace the path below with the path where you saved your file
  reader.read ("table_scene_lms400.pcd", *cloud); // Remember to download the file first!

  std::cerr << "PointCloud before filtering: " << cloud->width * cloud->height
       << " data points (" << pcl::getFieldsList (*cloud) << ").";


  // Create the filtering object
  pcl::VoxelGrid<pcl::PCLPointCloud2> sor;
  sor.setInputCloud (cloud);
  sor.setLeafSize (0.01f, 0.01f, 0.01f);
  sor.filter (*cloud_filtered);

  std::cerr << "PointCloud after filtering: " << cloud_filtered->width * cloud_filtered->height
       << " data points (" << pcl::getFieldsList (*cloud_filtered) << ").";

  pcl::PCDWriter writer;
  writer.write ("table_scene_lms400_downsampled.pcd", *cloud_filtered,
         Eigen::Vector4f::Zero (), Eigen::Quaternionf::Identity (), false);

  return (0);
}



回复

使用道具 举报

发表于 2013-11-28 00:53:43 | 显示全部楼层
你调试了吗,既然滤波前的数据打印了,说明你标的红色部分应该也没问题。pcl::PCLPointCloud2我没用过,看起来怪怪的,如果你知道你点云的filed,就具体用对应的点云类型试一试。
你运行出错的提示是什么?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2013-12-11 11:05:48 | 显示全部楼层
mypcl 发表于 2013-11-28 00:53
你调试了吗,既然滤波前的数据打印了,说明你标的红色部分应该也没问题。pcl:CLPointCloud2我没用过,看 ...

程序不出错,就是出不了预想的结果,我自己测试,发现程序只能运行到红色部分
回复 支持 反对

使用道具 举报

发表于 2013-12-18 23:52:39 | 显示全部楼层
junding 发表于 2013-12-11 11:05
程序不出错,就是出不了预想的结果,我自己测试,发现程序只能运行到红色部分 ...

你把运行结果截个图吧,更详细点。
回复 支持 反对

使用道具 举报

本版积分规则

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

GMT+8, 2024-4-29 05:55 , Processed in 2.119138 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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