#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. 【bzoj2946】[Poi2000]公共串 后缀自动机

    [Poi2000]公共串 Time Limit: 3 Sec  Memory Limit: 128 MBSubmit: 1386  Solved: 620[Submit][Status][Discus ...

  2. 创建外网 ext

    虽然外部网络是已经存在的网络,但我们还是需要在 Neutron 中定义外部网络的对象,这样 router 才知道如何将租户网络和外部网络连接起来. 上一节我们已经为创建外部网络配置了ML2,本节将通过 ...

  3. UVa 11234 The Largest Clique

    找最长的连接的点的数量.用tarjan缩点,思考可知每一个强连通分量里的点要么都选,要么都不选(走别的路),可以动规解决. #include<iostream> #include<c ...

  4. 【LA5059】Playing With Stones (SG函数)

    题意:有n堆石子,分别有a[i]个.两个游戏者轮流操作,每次可以选一堆,拿走至少一个石子,但不能拿走超过一半的石子. 谁不能拿石子就算输,问先手胜负情况 n<=100,1<=a[i]< ...

  5. godaddy虚拟空间的伪静态配置

    原文发布时间为:2011-02-24 -- 来源于本人的百度文章 [由搬家工具导入] 只要在web.config文件的<configuration>子节点下 加入以下节点,即可实现 伪静态 ...

  6. VS2008 没办法太强大了

    原文发布时间为:2009-06-13 -- 来源于本人的百度文章 [由搬家工具导入] VS2008 太强大了。。。继续学习。。。。现在微软的某些强大功能也是针对 VS2008了。。。所以。。必须得装上 ...

  7. Maven一些总结

     1.Maven的安装和配置   从Maven的官网上下载Maven的安装包,http://maven.apache.org/download.html.   将其解压在你想安放的目录下.   然后配 ...

  8. boost 库的下载和编译_Visual Studio 2013(转)

    原文转自 http://blog.csdn.net/lp310018931/article/details/47791143 原文转自 http://m.blog.csdn.net/article/d ...

  9. 修复Kaos的中文显示

    前段时间为了尝鲜KDE5,于是安装了Kaos 2015.2,默认的kde5桌面,速度也不错,软件更新很及时,计划淘汰掉chakra算了,一直中文在终端下显示为乱码,经网上搜索整理记录如下: (1)使用 ...

  10. Color.FromArgb()方法详解

    关于颜色值的表示 常用的颜色值表示方式有两种,一种是10进制的RGB值表示,如(0,113,255),三个值分别表示(红,绿,蓝):一种是16进制的颜色码表示,如#ff3212.这两种形式在编程中都可 ...