基于faro SDK 读取fls原始文件
#define _SCL_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS #include <iostream>
//#include <atlsafe.h>
//#include <windows.h>
//#include <cassert>
#include <pcl/point_cloud.h>
#include <pcl/io/pcd_io.h>
#include <pcl/visualization/pcl_visualizer.h> using namespace std;
typedef pcl::PointXYZRGBA PointT;
typedef pcl::PointCloud<PointT> PointCloudT; #ifdef _WIN64
// Yes - type is 'win32' even on WIN64!
#pragma comment(linker, "\"/manifestdependency:type='win32' name='FARO.LS' version='1.1.701.2' processorArchitecture='amd64' publicKeyToken='1d23f5635ba800ab'\"")
#else
#pragma comment(linker, "\"/manifestdependency:type='win32' name='FARO.LS' version='1.1.701.2' processorArchitecture='amd64' publicKeyToken='1d23f5635ba800ab'\"")
#endif // These imports just defines the types - they don't determine which DLLs are actually loaded!
// You can choose whatever version you have installed on your system - as long as the interface is compatible
#import "C:\Windows\WinSxS\amd64_faro.ls_1d23f5635ba800ab_1.1.701.2_none_3592adf9356a0308\iQopen.dll" no_namespace //... int main()
{
CoInitialize(NULL); //应用程序调用com库函数(除CoGetMalloc和内存分配函数)之前必须初始化com库
// FARO LS Licensing
// Please note: The cryptic key is only a part of the complete license
// string you need to unlock the interface. Please
// follow the instructions in the 2nd line below BSTR licenseCode = L"FARO Open Runtime License\n"
//#include "../FAROOpenLicense" // Delete this line, uncomment the following line, and enter your own license key here:
L"Key:39CELNPKTCTXXJ7TN3ZYSPVPL\n"
L"\n"
L"The software is the registered property of FARO Scanner Production GmbH, Stuttgart, Germany.\n"
L"All rights reserved.\n"
L"This software may only be used with written permission of FARO Scanner Production GmbH, Stuttgart, Germany."; IiQLicensedInterfaceIfPtr liPtr(__uuidof(iQLibIf));
liPtr->License = licenseCode;
IiQLibIfPtr libRef = static_cast<IiQLibIfPtr>(liPtr);
if (libRef->load("C:\\Users\\18148\\Desktop\\Scan_az001.fls\\Scan_az001.fls") != ) //读取文件的全路径 切记
{
std::cout << "load ScanData errer !!!" << std::endl;
libRef = NULL;
liPtr = NULL;
return -;
} libRef->scanReflectionMode = ; //黑白灰度展示图像
cout << libRef->scanReflectionMode << endl;
//libRef->scanReflectionMode = 1; //默认为1 可以为0 1 2三个模式。 int ret = libRef->setAttribute("#app/ScanLoadColor", ""); //设置为彩色 Load grey information instead of color
cout << "setAttribute" << ret << endl; //if (int ret = libRef->saveAs("C:\\Users\\18148\\Desktop\\img\\ddb123.fws") != 0) //可以存储为 fls,fws
//{
// std::cout << "saveAs ScanData errer !!!" << std::endl;
// return -1;
//}
//ret = libRef->extractStream("C:\\Users\\18148\\Desktop\\Scan_az001.fls\\Scan_az001.fls", "ScanDataStream0", "C:\\Users\\18148\\Desktop\\img.fls"); double x, y, z;
double rx, ry, rz, angle;
libRef->getScanPosition(, &x, &y, &z);
libRef->getScanOrientation(, &rx, &ry, &rz, &angle);
int numRows = libRef->getScanNumRows();
int numCOls = libRef->getScanNumCols(); std::cout << "numRows::" << numRows << std::endl;
std::cout << "numCOls::" << numCOls << std::endl;
std::cout << x << "," << y << "," << z << std::endl;
std::cout << rx << "," << ry << "," << rz << "," << angle << std::endl; PointCloudT::Ptr cloud_pointsPtr(new PointCloudT());
// Access all points points by point
for (int col = ; col < numCOls; col++)
{
for (int row = ; row<numRows; row++)
{
double x, y, z;
int refl;
int result = libRef->getScanPoint(, row, col, &x, &y, &z, &refl); //Use getXYZScanPoints or getXYZScanPoints2 instead to read multiple scan points in a single call. For example, you can read the scan points column by column with these two methods.
PointT points;
points.x = x;
points.y = y;
points.z = z;
//int rgb = ((int)r) << 16 | ((int)g) << 8 | ((int)b);
points.a = ;
points.r = (refl >> ) & 0x0000ff; //uint8_t r = (rgb >> 16) & 0x0000ff;
points.g = (refl >> ) & 0x0000ff;
points.b = (refl)& 0x0000ff;
points.rgba = points.a << | points.r << | points.g << | points.b;
cloud_pointsPtr->points.push_back(points); /* double **array2D = new double *[numRows]; //二维数组分配内存
for (int i = 0; i<numRows; ++i)
{
array2D[i] = new double[3];
}
double *pos = *array2D;
*/
//double *pos = new double[3 * numRows]; //利用一维数组
//int *refl = new int[numRows];
//int result = libRef->getXYZScanPoints(0, row, col, numRows, pos, refl); ////std::cout << x<<","<<y<<","<<z<< std::endl; //delete[] pos;
//delete[] refl;
//pos = NULL; refl = NULL;
}
} // --------------------------------------------
// -----Open 3D viewer and add point cloud-----
// --------------------------------------------
boost::shared_ptr<pcl::visualization::PCLVisualizer> viewer(new pcl::visualization::PCLVisualizer("3D Viewer"));
viewer->setBackgroundColor(, , );
pcl::visualization::PointCloudColorHandlerRGBField<PointT> rgb(cloud_pointsPtr);
//pcl::visualization::PointCloudColorHandlerCustom<PointT> red(cloud_pointsPtr, 0, 0, 255);
viewer->addPointCloud<PointT>(cloud_pointsPtr, "sample cloud");
viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, , "sample cloud");
viewer->addCoordinateSystem(1.0);
viewer->initCameraParameters(); // Access all points column per column in polar coordinates
//double* positions = new double[numRows*3];
//int* reflections = new int[numRows];
//for (int col = 0; col<numCOls; col++)
//{
// int result = libRef->getPolarScanPoints(0, 0, col, numRows, positions, reflections);
// for (int row=0 ; row<numRows ; row++)
// {
// double r, phi, theta;
// int refl;
// r = positions[3*row+0];
// phi = positions[3*row + 1];
// theta = positions[3*row+2];
// refl = reflections[row]; // ...
// }
//}
//delete[] positions; delete[] reflections; libRef = NULL; liPtr = NULL;
CoUninitialize();
//--------------------
// -----Main loop-----
//-------------------- while (!viewer->wasStopped())
{
viewer->spinOnce();
boost::this_thread::sleep(boost::posix_time::microseconds());
}
system("pause");
return ;
}
基于faro SDK 读取fls原始文件的更多相关文章
- 用C/C++开发基于VLC SDK的视频播放器
在windows系统如果开发万能播放器,一般都是基本DirectShow来开发,开发也很简单,但缺点也很多,一个文件格式是否能够播放完全取决于你 是否安装了正确的解析器和解码器,即使现在有了万能解器安 ...
- 基于Win32 SDK实现的一个简易线程池
利用C++实现了一个简易的线程池模型(基于Win32 SDK),方便使用多线程处理任务.共包含Thread.h.Thread.cpp.ThreadPool.h.ThreadPool.cpp四个源文件. ...
- 使用OPEN XML SDK 读取EXCEL中的超链接Hyperlink
使用OPEN XML SDK 读取EXCEL中的超链接Hyperlink 原理 先创建一个包括全部EXCEL单元格中超链接Hyperlink数据的表,再定位单元格通过列头(如A1,B1)获取超链接信息 ...
- 如何基于App SDK快速地开发一个IoT App?
一.背景及大纲介绍 在如今物联网DCM(Device.Connect.Manage)的大框架下,有一个应用层来分析和处理数据,是必备技能.但是,对于一个公司来说,因为研发能力或者研发时间的原因,可能很 ...
- 如何基于 ZEGO SDK 实现 Windows 一对一音视频聊天应用
互联网发展至今,实时视频和语音通话越来越被大众所依赖. 今天,我们将会继续介绍如何基于ZEGO SDK实现音视频通话功能,前两篇文章分别介绍了Android,Flutter平台的实现方式,感兴趣的小伙 ...
- 如何基于ZEGO SDK 实现通话质量监测
如何基于ZEGO SDK 实现通话质量监测 1 功能简介 在进行视频通话过程中,用户有时候会出现网络不好的情况,比如在进行多人视频通话或者多人唱歌时,我们需要实时显示用户的网络质量. 示例源码 请参考 ...
- 基于FBX SDK的FBX模型解析与加载 -(一)
http://blog.csdn.net/bugrunner/article/details/7210511 1. 简介 FBX是Autodesk的一个用于跨平台的免费三维数据交换的格式(最早不是由A ...
- 基于FBX SDK的FBX模型解析与加载 -(四)
8. 骨骼蒙皮动画 骨骼蒙皮动画是当前游戏引擎中最常用的一种动画方式,关于其基本原理网络上的资料较多,关于到涉及的其它较复杂操作,如插值.融合等在这里也就先不再讨论了,而且其实现方式也与具体引擎的动作 ...
- 基于FBX SDK的FBX模型解析与加载 -(三)
http://blog.csdn.net/bugrunner/article/details/7229416 6. 加载Camera和Light 在FBX模型中除了几何数据外较为常用的信息可能就是Ca ...
随机推荐
- Hibernate逆向工程生成代码
编辑此文章,其目的是方便以后根据表生成相应的代码,然而并非所有的代码都是如此.这里的Hibernate 即响应题目的ssh框架中的“h”. 如图所示,点击右上角,在myeclipse之中.再点击Mye ...
- java课后作业-5
作业一:请写一个类,在任何时候都可以向它查询“你已经创建了多少个对象?“ 程序源代码; public class Lei { /** * @param args */ public static vo ...
- Python之数据结构:字符串中的方法
一.过滤字符串 1.strip() (1)去掉行收尾不可见字符 a = ' wejifrow ' print a print a.strip() 结果: wejifrow wejifrow (2)st ...
- inux监控平台搭建-监控项
linux监控平台搭建-监控项 本人运维某生态互联网监控平台服务.过程中遇见了很多问题.目前互联网有很多的开源监控工具:nagios.zabbix.falcon.cacti...各有优点.这里不讲解监 ...
- Java EE 学习(9):IDEA + maven + spring 搭建 web(5)- 博客文章管理
转载:Gaussic(一个致力于AI研究却不得不兼顾项目的研究生) . 注:在阅读本文前,请先阅读: Java EE 学习(5):IDEA + maven + spring 搭建 web(1) Jav ...
- tomcat 日志输出
1.找到tomcat安装目录:cd tomcat/logs 2.tail -f catalina.out 3.ctrl+c 退出
- [转].net创建XML文件的两种方法
原文发布时间为:2009-08-26 -- 来源于本人的百度文章 [由搬家工具导入] 方法一:按照XML的结构一步一步的构建XML文档. 通过.Net FrameWork SDK中的命名空间&q ...
- HTML 文档之 Head 最佳实践
语言 在 html 标签中通过 lang 属性进行明确的语言声明,将会有助于翻译,英文.简体中文和繁体中文网页所属性值如下: <html lang="en"> < ...
- 提高Android Studio运行、编译速度方案
1.安装完成后启动卡死 刚刚打开studio就卡在gradle building的界面再也不动了(去连接墙外的网下载),那么这个时候我们就需要把这个联网下载操作屏蔽掉,找到studio安装目录,找到i ...
- 16Aspx.com-书通网中小学生免费在线学习网站源码 带采集带手机版帝国cms内核
=============================================== 源码站长资源交易专业网-商业源码下载,VIP源码,程序交易,毕业设计交易,站长交易|- 16aspx.c ...