#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. Codeforces Round #591

    目录 Contest Info Solutions A. Save the Nature B. Sequence Sorting C. Paint the Tree D. Stack Extermin ...

  2. 05_Nginx日志分析

    如果不进行过滤,ES中存储的Nginx的日志是整行日志,在Kibana页面中只能查看到整行的日志,并没有其他太多的价值,所以我们需要对日志进行分割过滤,更有利于进行日志的分析. 学习本章需要具备一定的 ...

  3. 第九届蓝桥杯(A组填空题)

    1.标题:分数 1/1 + 1/2 + 1/4 + 1/8 + 1/16 + …. 每项是前一项的一半,如果一共有20项, 求这个和是多少,结果用分数表示出来. 类似: 3/2 当然,这只是加了前2项 ...

  4. java 标准日期格式

    public static void main(String[] argv) { // 使用默认时区和语言环境获得一个日历 Calendar cale = Calendar.getInstance() ...

  5. notepad++修改背景色

  6. 10月清北学堂培训 Day 1

    今天是杨溢鑫老师的讲授~ T1 1 题意: n * m 的地图,有 4 种不同的地形(包括空地),6 种不同的指令,求从起点及初始的状态开始根据指令行动的结果. 2 思路:(虽然分了数据范围但是实际上 ...

  7. pmm的安装,这里推荐下载官方提供的脚本,直接执行这个脚本就可以完成安装

    脚本内容如下: #!/bin/sh set -o errexit set -o xtrace root_is_needed='no' check_command() { command -v &quo ...

  8. selenium鼠标下滑操作

    # coding = utf-8 import time from selenium import webdriver from selenium.webdriver.common.by import ...

  9. springboot连接redis进行CRUD

    springboot连接redis进行CRUD: 1.添加以下依赖: <dependency> <groupId>org.springframework.boot</gr ...

  10. anzhuang ruanjian

    makepkg -i https://github.com/arch4edu/arch4edu/wiki/Add-arch4edu-to-your-Archlinux Add arch4edu to ...