#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/io/ply_io.h> int main(int argc, char** argv)
{
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>); if (pcl::io::loadPLYFile<pcl::PointXYZ>("model.ply", *cloud) == -1) //* load the file
{
PCL_ERROR("Couldn't read file test_pcd.pcd \n");
system("PAUSE");
return (-1);
}
std::cout << "Loaded "
<< cloud->width * cloud->height
<< " data points from test_pcd.pcd with the following fields: "
<< std::endl;
for (size_t i = 0; i < cloud->points.size(); ++i)
std::cout << " " << cloud->points[i].x
<< " " << cloud->points[i].y
<< " " << cloud->points[i].z
<< std::endl;
//std::string filename("test.pcd");
//pcl::PCDWriter writer;
//writer.write(filename, *cloud); system("PAUSE");
return (0);
}

  上面这段代码从ply文件中读入点云

#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/io/ply_io.h>
#include <pcl/visualization/cloud_viewer.h> int main(int argc, char** argv)
{
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>); if (pcl::io::loadPLYFile<pcl::PointXYZ>("model.ply", *cloud) == -1) //* load the file
{
PCL_ERROR("Couldn't read file test_pcd.pcd \n");
system("PAUSE");
return (-1);
}
//pcl::StatisticalOutlierRemoval::applyFileter()
pcl::visualization::CloudViewer viewer("Viewer");
viewer.showCloud(cloud); system("PAUSE");
return (0);
}

  将读入的ply文件可视化出来

PCL学习(一)从PLY文件读入点云数据的更多相关文章

  1. 向PCD文件写入点云数据

    博客转载自:http://www.pclcn.org/study/shownews.php?lang=cn&id=83 本小节我们学习如何向PCD文件写入点云数据. 代码 章例2文件夹中,打开 ...

  2. PCL学习(二)三维模型转点云 obj转pcd----PCL实现

    #include <pcl/io/io.h> #include <pcl/io/pcd_io.h> #include <pcl/io/obj_io.h> #incl ...

  3. pcl学习笔记(二):点云类型

    不同的点云类型 前面所说的,pcl::PointCloud包含一个域,它作为点的容器,这个域是PointT类型的,这个域是PointT类型的是pcl::PointCloud类的模板参数,定义了点云的存 ...

  4. 从PCD文件写入和读取点云数据

    (1)学习向PCD文件写入点云数据 建立工程文件ch2,然后新建write_pcd.cpp  CMakeLists.txt两个文件 write_pcd.cpp : #include <iostr ...

  5. 点云库PCL学习

    1. 点云的提取 点云的获取:RGBD获取 点云的获取:图像匹配获取(通过摄影测量提取点云数据) 点云的获取:三维激光扫描仪 2. PCL简介 PCL是Point Cloud Library的简称,是 ...

  6. PLY文件(转)

    转载:http://bbs.itiankong.com/thread-89555-1-1.html PLY 是一种电脑档案格式,全名为 多边形档案(Polygon File Format) 或 史丹佛 ...

  7. PCL的PNG文件和计算点云重心

    PCL提供节约一点云的值为一个PNG图像文件的可能方案.显然,这只能用有序的点云来完成,因为生成的图像的行和列将与点云的对应完全一致.例如,如果你从一个传感器Kinect或Xtion的点云,你可以用这 ...

  8. 系统学习 Java IO (四)----文件的读写和随机访问 FileInputStream/FileOutputStream & RandomAccessFile

    目录:系统学习 Java IO---- 目录,概览 文件输入流 FileInputStream 这是一个简单的FileInputStream示例: InputStream input = new Fi ...

  9. 一份关于Swift语言学习资源的整理文件

    一份关于Swift语言学习资源的整理文件     周银辉 在这里下载 https://github.com/ipader/SwiftGuide

随机推荐

  1. [剖析] 多路径ALUA技术如何优化I/O处理

    什么是ALUA多路径机制 ALUA是异步逻辑单元访问(Asymmetric Logical Unit Access)的缩写,ALUA是SPC3 (SCSI Primary commands-3)协议中 ...

  2. zabbix(7)邮件报警配置

    邮件报警可以使用Linux自带邮件服务器(postfix等),也可以使用其他邮件服务器(像腾讯邮箱,126邮箱) 一.使用mail. 1.确定zabbix server是否安装发送邮件的命令mail, ...

  3. Hadoop namenode连接journalnode限制导致集群启动失败

    错误1:刚搭建的新集群,启动journalnode以后,格式化namenode节点,出现如下错误 注意其中划红线的地方. 出现这个错误的原因是journalnode节点还没有准备好,而namenode ...

  4. vue.js 中this.$router.push()的使用

    在vue项目中,跳转可以用router-link直接跳到某个页面 因为有时候会需要做一些判断等情况,所以要用到 this.$router.push() 因为外链跳转根本就不在router的设计考虑范围 ...

  5. SpringCloud介绍及入门一

    springcloud是什么 基于spring boot实现的服务治理工具包,管理和协微服务 把别人的东西拿来组合在一起,形成各种组件 微服务协调者[service registtry注册中心 Eur ...

  6. ArcGIS10.3_解决属性表中文乱码问题

    借鉴前辈们解决ArcMap低版本属性表乱码的问题解决方法,勇敢的尝试了一下Pro中的解决方法,其实道理都一样.先来看看第一种方法:打开CMD,如果是ArcMap,输入如下命令: reg add HKE ...

  7. 分享CSS3里box-shadow属性的使用方法,包括内阴影box-shadow:inset

    一.box-shadow语法 box-shadow: none | inset(可选值,不设置,为外投影,设置,为内投影) x-offset(阴影水平偏移量,正方向为right) y-offset(阴 ...

  8. maven中的Exclusions详解

    依赖关系:Project-A>Project-B>Project-C,但是Project-A不依赖Project-C,在Project-A中的POM.xml应该进行如下配置: <de ...

  9. Hive中导入Oracle数据错误:Listener refused the connection with the following error: ORA-12505

    问题: 今天往Hive中导入Oracle数据的时候碰到了如下错误:Listener refused the connection with the following error: ORA-12505 ...

  10. PropertyValuesHolder学习

    package com.loaderman.customviewdemo; import android.animation.ObjectAnimator; import android.animat ...