pcl1.8.0+QT5.7.0+vs2013 win7 x64环境配置

//读取文本型和二进制型点云数据
void onOpen()
{//打开文件QString fileName = QFileDialog::getOpenFileName(this,tr("Open PointCloud"), ".",tr("Open PCD files(*.pcd);;Open WRL files(*.wrl)"));//filename类型转换std::string file_name = fileName.toStdString();//获取文件名称以及扩展名vector<string> tokens;boost::char_separator<char> sep(".");boost::tokenizer<boost::char_separator<char> > tok(file_name, sep);tokens.clear();std::copy(tok.begin(), tok.end(), std::back_inserter(tokens));if (!fileName.isEmpty()){//若是其他类型if (tokens[1] != "pcd"){//查找特定位置(所需点坐标)l为所在行数;l-35为点云个数string fout_name = tokens[0] + ".pcd";int linenum = 0;int l;ifstream in(file_name);string line;string s;int i = 0;string key = "texCoord DEF texcoord0 TextureCoordinate";while (getline(in, line)){if (line.find(key) != string::npos){//  cout << linenum << " ";l = linenum;}linenum++;}//写入ofstream outfile(fout_name, ios::out | ios::trunc);outfile << "# .PCD v.5 - Point Cloud Data file format" << endl;outfile << "VERSION .5" << endl;outfile << "FIELDS x y z" << endl;outfile << "SIZE 4 4 4" << endl;outfile << "TYPE F F F" << endl;outfile << "COUNT 1 1 1" << endl;outfile << "WIDTH " << l - 35 << endl;outfile << "HEIGHT 1" << endl;outfile << "POINTS " << l - 35 << endl;outfile << "DATA ascii" << endl;//添加点ifstream inFile;inFile.open(file_name);while (getline(inFile, s, '\n')){if (i > 32 && i < l - 2)outfile << s << endl;i++;}inFile.close();outfile.close();//显示pcl::PCLPointCloud2 cloud2;//pcl::PointCloud<Eigen::MatrixXf> cloud2;Eigen::Vector4f origin;Eigen::Quaternionf orientation;int pcd_version;int data_type;unsigned int data_idx;int offset = 0;pcl::PCDReader rd;rd.readHeader(fout_name, cloud2, origin, orientation, pcd_version, data_type, data_idx);if (data_type == 0){pcl::io::loadPCDFile(fout_name, *cloud);}else if (data_type == 2){pcl::PCDReader reader;reader.read<pcl::PointXYZ>(fout_name, *cloud);}viewer->updatePointCloud(cloud, "cloud");viewer->resetCamera();ui.qvtkWidget->update();}else{//sensor_msgs::PointCloud2 cloud2;pcl::PCLPointCloud2 cloud2;//pcl::PointCloud<Eigen::MatrixXf> cloud2;Eigen::Vector4f origin;Eigen::Quaternionf orientation;int pcd_version;int data_type;unsigned int data_idx;int offset = 0;pcl::PCDReader rd;rd.readHeader(file_name, cloud2, origin, orientation, pcd_version, data_type, data_idx);if (data_type == 0){pcl::io::loadPCDFile(fileName.toStdString(), *cloud);}else if (data_type == 2){pcl::PCDReader reader;reader.read<pcl::PointXYZ>(fileName.toStdString(), *cloud);}viewer->updatePointCloud(cloud, "cloud");viewer->resetCamera();ui.qvtkWidget->update();}}
}

运行结果

Qt工程中c++实现wrl到pcd格式转换相关推荐

  1. 【qt】qt工程中包含c++标准库头文件,提示找不到。

    问题: 在qt工程中包含c++标准库头文件,提示找不到. 如下: #include <vector> using namespace std; 解决办法: 在*.pro文件中增加vecto ...

  2. logstash中Ruby代码把@timestamp时间戳格式转换

    logstash中ruby代码把@timestamp时间戳格式转换 filter{ ruby {code => "event.set('xxx_time',(event.get('@t ...

  3. python批量提取word文档中的图片(含图片格式转换和GUI)

    作者:小小明 文章目录 doc格式批量转为docx 批量提取docx文档的图片 批量图片格式转换 完整代码 GUI图形化工具开发 打包exe 给GUI加入进度条 日常工作中,领导要求你将一份 Word ...

  4. Qt工程中如何添加.pri文件

    pri文件中的i 是包含(include)的首字母.类似于C.C++中的头文件就是我们可以把 .pro 文件内需要include的一部分或者多个工程相同的部分单独放到一个 .pri 文件内,然后包含到 ...

  5. java 当前时间格式_JAVA中获取当前系统时间及格式转换

    一. 获取当前系统时间和日期并格式化输出: import java.util.Date; import java.text.SimpleDateFormat; public class NowStri ...

  6. Java 系统时间转为date_JAVA中获取当前系统时间及格式转换

    一. 获取当前系统时间和日期并格式化输出: import java.util.Date; import java.text.SimpleDateFormat; public class NowStri ...

  7. oracle截取日期类型的字符串,oracle截取字段中的部分字符串:日期格式转换

    ##从数据库中导出excel数据后,造数据,然后重新导入oracel数据库中,查询后显示导入成功 但是页面还是显示是老的数据,后来发现日期自动变化了2016-05-06变化为2016/05/06 导致 ...

  8. MacOS中afconvert的使用(音频格式转换)

    MacOS的强大一方面也在于其继承了众多实用工具,比如今天介绍的这个afconvert. 位置:/usr/bin/afconvert 用法:需要使用命令行操作,在终端cd到bin下即可使用 参数说明: ...

  9. Google 源码中电池百分比获取方法和格式转换

    Google 源码的电池百分比获取和转换 package com.android.settingslib;public class Utils {/** Formats a double from 0 ...

最新文章

  1. python读写excel
  2. 分数混合运算简便方法_分数四则混合运算
  3. flume高可用-balance-配置文件编写
  4. Linux 性能分析大概步骤
  5. flask基础之jinja2模板-语法定义
  6. python爬虫好学不_python爬虫好学吗
  7. Java基础学习总结(131)——项目开发中真的有必要使用Lombok插件么?
  8. html css 圆形按钮 仿uc,10款基于jquery的web前端动画特效
  9. iOS xcode4 编译环境
  10. 宏定义处理特殊字符 -_c语言编译与预处理命令
  11. 如何识别媒体偏见_面部识别软件:宝贵资产,还是社会偏见的体现?
  12. php公众号失物招领系统,【服务】微信公众平台『失物招领』功能上线
  13. shiro721复现
  14. Qt实现网格显示(图标文本)功能
  15. 捕鱼源码 免费提供和分享,仅供unity和Java初学者学习参考,希望能带来帮助
  16. 自己做的一个c#超大浮点数bigFloat
  17. delphi 两行代码实现合并多张图片生成mp4视频
  18. 运动控制卡讲解及实例应用
  19. 建一个网站需要花多少钱?
  20. 乐观锁与悲观锁、自旋锁

热门文章

  1. 5G学习-5G的基础概念
  2. 解决测试过程中遇到的致命问题
  3. SPSS(十一)SPSS信息浓缩技术--主成分分析、因子分析(图文+数据集)
  4. zemax-07人眼模型
  5. PHP初级程序员能力测试参考答案
  6. HTML——HTML 简介
  7. 以太网工业RFID读写器|读卡器CK-FR12-E01接线说明与PLC组网方案
  8. 数学实验:Matlab代码 用动画展示一拱摆线的构造过程
  9. 什么是用户体验地图?该如何绘制?
  10. COCOMOII模型--软件成本估算