基于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 ...
 
随机推荐
- [暑假集训--数论]poj1730 Perfect Pth Powers
			
We say that x is a perfect square if, for some integer b, x = b 2. Similarly, x is a perfect cube if ...
 - 【转】linux之shfit
			
位置参数可以用shift命令左移.比如shift 3表示原来的$4现在变成$1,原来的$5现在变成$2等等,原来的$1.$2.$3丢弃,$0不移动.不带参数的shift命令相当于shift 1. 非常 ...
 - ubuntu 忘记密码,忘记root密码的解决办法
			
ubuntu的root默认是禁止使用的,在安装的时候也没有要求设置root的密码.要使用,给root设置密码就行了,sudo passwd root .如果只是普通用户密码忘了,用root就可以修改. ...
 - POJ 3090
			
Visible Lattice Points Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8397 Accepted: ...
 - js7:表单的学习,Forms对象
			
原文发布时间为:2008-11-09 -- 来源于本人的百度文章 [由搬家工具导入] dreamveawer中,选择插入——表单——然后后面的几个选项进行学习: 大体上这么些类型: <html& ...
 - Linq To Entity学习实践
			
public class CustomDataContext<TEntity> : System.Data.Linq.DataContext where TEntity : class,n ...
 - hdu 5972 Regular Number 字符串Shift-And算法 + bitset
			
题目链接 题意 给定两个串\(S,T\),找出\(S\)中所有与\(T\)匹配的子串. 这里,\(T\)的每位上可以有若干(\(\leq 10\))种选择,匹配的含义是:对于\(S\)的子串的每一位, ...
 - link 和 runtime-link,搭配shared 和 static(转)
			
原文转自 http://blog.csdn.net/yasi_xi/article/details/8660549 参考: http://bbs.sjtu.edu.cn/bbscon,board,C, ...
 - UVALive 3664:Guess(贪心 Grade E)
			
vj题目链接 题意: 有n (n<16345)个人,每个人有三个数(小于1000且最多两位小数点),表示答对对应题的得分.规定总分越高的人rank越高.总分相同,id小的rank高.现在知道ra ...
 - C++多线程(POSIX)
			
#include<iostream> #include<pthread.h> #include<ctime> #include<windows.h> u ...