基于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 ...
随机推荐
- 【WC笔记】字符串前沿算法
Q1 对于给定的字符串,求本质不同的子串数. A1 在加入 $s_l$ 时,考虑 $s[l:r]$ 的上一次出现是 $s[k:k+r-l]$,那么应该在线段树上 $[r,k+r-l]$ 这个区间 $+ ...
- linux把时间类型值转换为数值型
字符及字符串处理函数:字符及字符串处理函数的处理对象均为字符型数据,但其返回值类型各异.1.取子串函数:格式:substr(c,n1,n2)功能:取字符串C第n1个字符起的n2个字符.返回值类型是字符 ...
- BZOJ 4491: 我也不知道题目名字是什么
4491: 我也不知道题目名字是什么 Time Limit: 10 Sec Memory Limit: 512 MBSubmit: 278 Solved: 154[Submit][Status][ ...
- Extension Methods "点"函数方法 扩展方法
原文发布时间为:2011-03-25 -- 来源于本人的百度文章 [由搬家工具导入] http://msdn.microsoft.com/en-us/library/bb383977.aspx 条件: ...
- DataGrid关键字变色
原文发布时间为:2009-05-01 -- 来源于本人的百度文章 [由搬家工具导入] private void DataGrid1_ItemDataBound(object sender, ...
- C++调用Matlab引擎 图像读写与处理 (知识+代码篇)
准备知识 之 Matlab Engine 执行命令 /* Execute matlab statement */ int engEvalString(Engine* ep, const char* s ...
- 使用中科大源下载android源码
我的系统时manjaro linux 最新版的,安装过了git和curl软件 一.如果没有安装的同学,请使用命令: pacman -S git curl 我这里安装了python3和python2,但 ...
- Chrome扩展修改页面代码执行环境的方法
Chrome的扩展程序可以通过content scripts向页面中注入js代码,所注入的js代码能够对页面中所有的DOM对象进行操作.由于Chrome在js执行环境上对页面代码和content sc ...
- Python 数据类型-2
序列 包括:字符串 列表 元组 索引操作和切片操作 索引操作:可以从序列中抓取一个特定的项目 切片操作: 获取序列的一个切片,即一部分序列 序列的通用方法: len() 求序列的长度 + 连接2个序列 ...
- hdu 4530(数学)
小Q系列故事——大笨钟 Time Limit: 600/200 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total S ...