#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原始文件的更多相关文章

  1. 用C/C++开发基于VLC SDK的视频播放器

    在windows系统如果开发万能播放器,一般都是基本DirectShow来开发,开发也很简单,但缺点也很多,一个文件格式是否能够播放完全取决于你 是否安装了正确的解析器和解码器,即使现在有了万能解器安 ...

  2. 基于Win32 SDK实现的一个简易线程池

    利用C++实现了一个简易的线程池模型(基于Win32 SDK),方便使用多线程处理任务.共包含Thread.h.Thread.cpp.ThreadPool.h.ThreadPool.cpp四个源文件. ...

  3. 使用OPEN XML SDK 读取EXCEL中的超链接Hyperlink

    使用OPEN XML SDK 读取EXCEL中的超链接Hyperlink 原理 先创建一个包括全部EXCEL单元格中超链接Hyperlink数据的表,再定位单元格通过列头(如A1,B1)获取超链接信息 ...

  4. 如何基于App SDK快速地开发一个IoT App?

    一.背景及大纲介绍 在如今物联网DCM(Device.Connect.Manage)的大框架下,有一个应用层来分析和处理数据,是必备技能.但是,对于一个公司来说,因为研发能力或者研发时间的原因,可能很 ...

  5. 如何基于 ZEGO SDK 实现 Windows 一对一音视频聊天应用

    互联网发展至今,实时视频和语音通话越来越被大众所依赖. 今天,我们将会继续介绍如何基于ZEGO SDK实现音视频通话功能,前两篇文章分别介绍了Android,Flutter平台的实现方式,感兴趣的小伙 ...

  6. 如何基于ZEGO SDK 实现通话质量监测

    如何基于ZEGO SDK 实现通话质量监测 1 功能简介 在进行视频通话过程中,用户有时候会出现网络不好的情况,比如在进行多人视频通话或者多人唱歌时,我们需要实时显示用户的网络质量. 示例源码 请参考 ...

  7. 基于FBX SDK的FBX模型解析与加载 -(一)

    http://blog.csdn.net/bugrunner/article/details/7210511 1. 简介 FBX是Autodesk的一个用于跨平台的免费三维数据交换的格式(最早不是由A ...

  8. 基于FBX SDK的FBX模型解析与加载 -(四)

    8. 骨骼蒙皮动画 骨骼蒙皮动画是当前游戏引擎中最常用的一种动画方式,关于其基本原理网络上的资料较多,关于到涉及的其它较复杂操作,如插值.融合等在这里也就先不再讨论了,而且其实现方式也与具体引擎的动作 ...

  9. 基于FBX SDK的FBX模型解析与加载 -(三)

    http://blog.csdn.net/bugrunner/article/details/7229416 6. 加载Camera和Light 在FBX模型中除了几何数据外较为常用的信息可能就是Ca ...

随机推荐

  1. canvas小图123

    1 绘制扇形图 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <t ...

  2. [转]从头到尾彻底理解KMP

    https://blog.csdn.net/v_july_v/article/details/7041827

  3. js 字符串长度截取

    <script> function cutstr(str, len) { var temp, icount = 0, patrn = /[^\x00-\xff]/, strre = &qu ...

  4. ckeditor编辑的使用方法

    一.下载安装Ckeditor,并将其整合到项目中 1.什么是CKeditor?为什么要使用它? 我们在做门户网站或者公文系统时,客户经常要求在录入时能够更改字体样式.大小.颜色并具备插入图片的功能.而 ...

  5. 设置div自适应高度滚动

    <body> <div id="divc" style="overflow: auto;"> </div> <a id ...

  6. idea 快速生成代码的快捷键

     psvm 加ab键   mian方法快速生成 sout 加tab键   输出打印快捷键  alt+insert      快速生成get  set 方法 itar 生成array for代码块 fo ...

  7. SQL SERVER 查询一个表有多少列

    ) from syscolumns where id = object_id('tbname') 或者 select * from syscolumns where id = object_id('t ...

  8. 洛谷 P1031 均分纸牌【交叉模拟】

    题目描述 有 N 堆纸牌,编号分别为 1,2,…, N.每堆上有若干张,但纸牌总数必为 N 的倍数.可以在任一堆上取若干张纸牌,然后移动. 移牌规则为:在编号为 1 堆上取的纸牌,只能移到编号为 2 ...

  9. Network | HTTP protocol

    版本 HTTP/1.0这是第一个在通讯中指定版本号的HTTP协议版本,至今仍被广泛采用,特别是在代理服务器中. HTTP/1.1当前版本.持久连接被默认采用,并能很好地配合代理服务器工作.还支持以管道 ...

  10. Linux(三) 一些命令

    系统信息 arch 显示机器的处理器架构(1) uname -m 显示机器的处理器架构(2) uname -r 显示正在使用的内核版本 dmidecode -q 显示硬件系统部件 - (SMBIOS ...