大道三千，殊途同归，代码之道，贵在精深。
现代风蓝灰色主题PPT毕业设计答辩模板
这是一份为计算机毕业论文设计的PPT模板，适用于XX学院XXXXXX系的202X级1班学生。模板风格严谨实用，适合作为论文答辩的动态演示文稿。主要特点：封面设计：计算机毕业论文的专属PPT模板。包含答辩人和导师信息：答辩人名为“1猫某”，导师名为“11猫某”。目录页面：结构清晰，包含五部分内容：选题背景与意义、国内基本情况、研究目标与意义、研究内容与方法、项目团队介绍等。内容丰富：选题背景与意义：阐述研究动机和背景。国内基本情况：介绍当前国内相关领域的现状。研究目标：明确研究的主要目标和方向。研究内容与方法：详细介绍研究的具体内容和采用的方法。项目团队介绍：展示团队成员及其角色，社会关系网络。公司架构与大事记：描述公司的组织架构及行业相关的大事记。研究思路与方法：说明研究的具体步骤和思路。解决问题与可行性分析：列出待解决的问题并进行可行性分析。视觉效果：使用现代和专业的图表、图形和排版设计，确保内容易于理解和视觉上有吸引力。包括动态元素，使答辩过程更加生动。灵活性和可定制性：提供了大量的文本占位符和可编辑的设计元素，用户可以根据自己的研究内容和数据进行定制。使用建议：根据自己的研究内容和数据进行相应的替换和调整。确保每一页的内容简洁明了，重点突出。使用适当的动画和过渡效果，提升演示的视觉效果。这份模板旨在帮助答辩人高效、专业地展示研究成果，顺利通过论文答辩。预览图下载地址https://download.csdn.net/download/cy1_cy2006/90628646
计算机专业毕业设计答辩幻灯片PPT整套模板，蓝色清新风格
一、模板基本信息此PPT模板是为计算机专业毕业设计答辩量身定制的，旨在帮助汇报人清晰地展示课题背景、研究意义、论述内容以及未来应用。模板设计简洁明了，适合在投影仪或计算机上进行演示，同时也支持打印输出。二、模板结构与内容封面页• 标题：毕业设计答辩（计算机专业）• 汇报人及时间：某某某，XXXX年XX月XX日• 附加信息：开题报告|毕业论文|毕业答辩|毕业设计目录页• 列出PPT的主要内容结构，包括：• 课题背景概述• 课题研究意义• 课题论述内容• 课题未来应用课题背景概述（第3-8页）• 这一部分旨在介绍课题的背景信息，包括课题的来源、研究领域的现状以及研究的重要性等。• 页面布局灵活，包含文字描述、图表和图片等元素，帮助汇报人全面展示课题背景。• 示例图片和图表占位符（如“/ppt/media/image7.png”等）提示汇报人在此处插入具体的内容。课题研究意义（第9-13页）• 详细介绍课题研究的目的、意义和价值，以及研究成果可能对学术界或实际应用产生的影响。• 同样包含文字描述、图表和图片等元素，使汇报内容更加生动、具体。• 提醒汇报人在占位符处添加实际内容，并适当调整布局以符合汇报需求。课题论述内容（第14-17页）• 深入阐述课题的研究内容、方法、过程和结果等。• 页面布局注重逻辑性和条理性，便于汇报人清晰地传达研究思路和成果。• 汇报人可根据具体研究内容在占位符处添加文字、图表和图片等元素。课题未来应用（第18-22页）• 探讨课题研究成果在未来可能的应用领域、应用方式和潜在价值。• 展示相关图表和图片，帮助听众更好地理解课题的应用前景。• 提醒汇报人在此部分充分展示课题的实用性和创新性。结尾页（第23页）• 感谢听众的聆听和指教，并表达对未来合作的期待。• 包含汇报人的姓名和时间信息，以及附加的开题报告、毕业论文等链接信息。三、使用说明• 汇报人可根据自己的研究内容和需求，在占位符处添加具体的文字、图表和图片等元素。• 注意保持页面布局的整洁和逻辑性，避免过多冗余的信息干扰听众的理解。• 在演示过程中，可充分利用投影仪或计算机进行演示，同时也可打印出PPT文稿进行辅助说明。此PPT模板为计算机专业毕业设计答辩提供了全面的展示框架和灵活的内容布局，汇报人可根据自己的需求进行适当调整和优化。下载地址pptx模板下载地址：https://download.csdn.net/download/cy1_cy2006/90626564预览图
关于神经网络各种概念的小白解释
神经网络能干什么？神经网络能干的事情很多，目前最火的深度学习的核心。利用神经网络，可以实现人脸识别、手写字体识别、指纹识别、图片识别等等，目前最成功的就是GPT Chart了，它的核心也是神经网络。神经网络是什么？顾名思义，神经网络就是由多个神经元相互连接，组成的网络。神经元是一个生物学概念，指的是人和动物神经系统中的一种细胞，看起来是这样的：在计算机中肯定不存在神经细胞，所以伟大的程序猿们把它简化成了这个样子：程序猿们利用计算机的CPU或GPU，按照上图的流程来模拟神经元。Ix、Iy、Iz一直到In代表神经元的输入，每个输入都乘上对应的权重(图中W*)再全部加起来作为中间结果存储在图中的圆圈中。权重的作用是模拟神经元对不同信号的敏感程度，比如人的神经元，对轻轻抚摸的信号不敏感，但对用刀轻轻切割很敏感(^_^)。抚摸和切割可以视为两种输入信号，但因为权重不同，造成人对这种输入信号的敏感程度不同。姑且这样理解吧，对于一篇免费的小白文，你还能要求更多吗？中间结果会传递给阙值函数，阙值函数对其进行一定的运算后产生输出。为什么需要阙值函数？因为要模拟神经元的“抑制”现象。生物学家经过长时间研究，发现神经元并不是对所有输入都会产生输出。程序猿们为了模拟这种现象，引入了阙值函数，又叫激活函数，这类函数有很多，几乎所有非线性函数都可用作激活函数，比如sin、cos、tanh、sigmod等等。为什么不能用线性函数？嗯，专业的回答是：用线性函数就不能处理非线性问题。小白的回答是：线性函数一定会产生一个输出，因此不能模拟“抑制”现象。什么是线性函数？小白的回答：函数的图像看起来是一条直线的函数就是线性函数。专业的回答：小白不知道，请问百度大哥。神经网络的结构最简单的神经网络的结构看起来是这样的：图中每一个圆圈表示一个神经元，箭头表示数据的流动方向。数据首先进入输入层的各个神经元中，再流入隐层，最后再从输出层流出，从而产生整个神经网络的输出。数据从一个神经元流向另一个神经元时都要经过权重、求和、激活函数的运算，上图没有画出来，请参考上上图。神经网络中输入层和输出层是必须的，隐层是可选的，隐层的数量没有上限。隐层越多，神经网络的能力就越强，表现为能识别的类别越多、能存储的数据越大。理论上只要计算机算力够强，可以有无限多隐层，然而遗憾的是这个世界上从来就没有“足够快”的计算机，所以隐层的数量总是有限的。上图中的神经网络已经可以解决很多问题了，图片识别、人脸识别、物体分类等等都可以。然而这种所有神经元都彼此连接的网络有一个严重的缺陷，就是运算量大，造成运算过程非常缓慢，不适合用来处理大数据、高分辨率图像。其他类型的神经网络为了解决各种问题，睿智的程序猿们发明了各种各样的神经网络，比如循环神经网络、卷积神经网络、LSTM等等，大家可以自行百度相关资料。特别是这两年，新的神经网络结构如火山喷发一般出现，看得人眼花缭乱、晕头转向、心生敬畏进而顶礼膜拜。
做了一个C++程序和JS程序效率对比的小测试，性能差距在1.6倍到3倍之间。JS测试代码 C++测试代码// CppPerformanceTest.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 // #include <iostream> #include <windows.h> #include <time.h> int main() { time_t beginTime = clock(); unsigned long long numberCount = 1000000000; double numberCountF = (double)numberCount; double avgValue = 0.0; for (unsigned long long i = 0; i < numberCount; ++i) { avgValue += (double)rand() / numberCountF; } time_t endTime = clock(); time_t elapsedTime = endTime - beginTime; printf("计算%llu个随机数的平均值耗时%llu毫秒。\n", numberCount, elapsedTime); printf("计算结果：%f\n", avgValue); system("pause"); } 在台式机上JS执行时间在16000毫秒左右，C++执行时间在10000毫秒左右。笔记本上JS执行时间46000毫秒左右，C++执行时间16000毫秒左右。
使用CGAL自带的最小二乘法拟合直线的方法
现在网上能找到的CGAL教程很少了，很多教程由于时间久远，已经被搜索引擎沉底，不再优先展示了。本文的方法还是作者到处寻找，最后参考官方的例子做出来的，实在来之不易。bool fittingLine(const pcl::PointCloud<pcl::PointXYZ>::Ptr& pointCloud, const pcl::IndicesPtr& indices, pcl::PointXYZ& outPointOnLine, pcl::PointXYZ& outLineDirection) { // 定义CGAL的Kernal typedef CGAL::Simple_cartesian<float> K; typedef K::Line_3 Line; typedef K::Plane_3 Plane; typedef K::Point_3 Point; typedef K::Triangle_3 Triangle; typedef K::Direction_3 Direction; // 参数检查 if (pointCloud == nullptr || pointCloud->empty()) { return false; } if (indices != nullptr && indices->empty()) { return false; } // 把PCL的点格式转换成CGAL的点格式，兼容不提供索引的情况 std::vector<Point> cgalPoints; if (indices != nullptr) { cgalPoints.reserve(indices->size()); for (int pointIndex : *indices) { const pcl::PointXYZ& pclPoint = pointCloud->at(pointIndex); cgalPoints.push_back(Point(pclPoint.x, pclPoint.y, pclPoint.z)); } } else { cgalPoints.reserve(pointCloud->size()); for (const pcl::PointXYZ& pclPoint : *pointCloud) { cgalPoints.push_back(Point(pclPoint.x, pclPoint.y, pclPoint.z)); } } // 利用CGAL拟合三维直线，官方文档说使用的是最小二乘法 Line line; linear_least_squares_fitting_3(cgalPoints.begin(), cgalPoints.end(), line, CGAL::Dimension_tag<0>()); // 返回拟合结果 const Point& linePoint = line.point(); const Direction& lineDirection = line.direction(); outPointOnLine.x = linePoint.x(); outPointOnLine.y = linePoint.y(); outPointOnLine.z = linePoint.z(); outLineDirection.x = lineDirection.dx(); outLineDirection.y = lineDirection.dy(); outLineDirection.z = lineDirection.dz(); return true; } 这个函数接受的参数都是PCL的类型，这样可以和PCL相互配合，处理点云。
OpenCL是一个并行计算工业标准，相比OpenGL，OpenCL的特长是并行计算，而OpenGL的特长是图像渲染。最近研究OpenCL的时候发现相关的工具还是比较少，学习和使用都不是很方便，因此特编写了一个简单的OpenCL探针。这款名叫《OpenCLMonitor》的软件可以列出计算机上所有支持OpenCL的设备，每个设备的信息，包括设备名称、设备厂商、工作组维度、工作组大小等等。《OpenCLMonitor》使用了OpenCL的C++语言API，相比C语言API，C++语言API使用更容易，传递的参数更少、代码长度更短。OpenCLMonitor代码// OpenCLMonitor.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。 // //#define CL_HPP_ENABLE_EXCEPTIONS #define CL_HPP_TARGET_OPENCL_VERSION 210 #include <iostream> #include "cl/cl2.hpp" #define PRINT_PLATFORM_INFO(PLATFORM, INFO_NAME) \ {\ std::string platformInfo;\ int rs = PLATFORM.getInfo(INFO_NAME, &platformInfo);\ if (rs == CL_SUCCESS)\ {\ std::cout << #INFO_NAME << ":\t" << platformInfo << std::endl;\ }\ else\ {\ std::cout << #INFO_NAME << ":\t" << "error(" << rs << ")" << std::endl;\ }\ } #define PRINT_DEVICE_INFO(DEVICE, INFO_NAME) \ {\ int rs = CL_SUCCESS;\ auto deviceInfo = DEVICE.getInfo<INFO_NAME>(&rs);\ std::string infoNameStr(#INFO_NAME ":");\ while (infoNameStr.size() < 40)\ {\ infoNameStr.push_back(' ');\ }\ if (rs == CL_SUCCESS)\ {\ std::cout << "\t" << infoNameStr << "\t" << deviceInfo << std::endl;\ }\ else\ {\ std::cout << "\t" << infoNameStr << "\t" << "error(" << rs << ")" << std::endl;\ }\ } #define PRINT_DEVICE_INFO_SIZE_T_ARRAY(DEVICE, INFO_NAME) \ {\ int rs = CL_SUCCESS;\ auto deviceInfo = DEVICE.getInfo<INFO_NAME>(&rs);\ std::string infoNameStr(#INFO_NAME ":");\ while (infoNameStr.size() < 40)\ {\ infoNameStr.push_back(' ');\ }\ if (rs == CL_SUCCESS)\ {\ std::cout << "\t" << infoNameStr << "\t"; \ for (auto it = deviceInfo.begin(); it != deviceInfo.end(); it++)\ {\ std::cout << *it << ",";\ }\ std::cout << std::endl;\ }\ else\ {\ std::cout << "\t" << infoNameStr << "\t" << "error(" << rs << ")" << std::endl;\ }\ } int main() { std::cout << "OpenCL monitor, powered by http://www.xiaoyunyun.net." << std::endl << std::endl; std::vector<cl::Platform> platforms; cl::Platform::get(&platforms); if (platforms.empty()) { std::cout << "No OpenCL platform found." << std::endl; return 0; } for (int i = 0; i < platforms.size(); i++) { const cl::Platform& onePlatform = platforms[i]; std::cout << "Platform " << i << std::endl; std::cout << "===============================================================" << std::endl; PRINT_PLATFORM_INFO(onePlatform, CL_PLATFORM_PROFILE); PRINT_PLATFORM_INFO(onePlatform, CL_PLATFORM_VERSION); PRINT_PLATFORM_INFO(onePlatform, CL_PLATFORM_NAME); PRINT_PLATFORM_INFO(onePlatform, CL_PLATFORM_VENDOR); PRINT_PLATFORM_INFO(onePlatform, CL_PLATFORM_EXTENSIONS); std::vector<cl::Device> devices; onePlatform.getDevices(CL_DEVICE_TYPE_ALL, &devices); if (devices.empty()) { std::cout << "No OpenCL devices found." << std::endl; continue; } for (int j = 0; j < devices.size(); j++) { const cl::Device& device = devices[j]; std::cout << "---------------------------------------------------------------" << std::endl; std::cout << "\tDevice " << j << std::endl; std::cout << "---------------------------------------------------------------" << std::endl; PRINT_DEVICE_INFO(device, CL_DEVICE_NAME); PRINT_DEVICE_INFO(device, CL_DEVICE_VENDOR); PRINT_DEVICE_INFO(device, CL_DEVICE_VENDOR_ID); PRINT_DEVICE_INFO(device, CL_DEVICE_VERSION); PRINT_DEVICE_INFO(device, CL_DRIVER_VERSION); PRINT_DEVICE_INFO(device, CL_DEVICE_TYPE); PRINT_DEVICE_INFO(device, CL_DEVICE_PROFILE); //PRINT_DEVICE_INFO(device, CL_DEVICE_PLATFORM); PRINT_DEVICE_INFO(device, CL_DEVICE_PROFILING_TIMER_RESOLUTION); PRINT_DEVICE_INFO(device, CL_DEVICE_ADDRESS_BITS); PRINT_DEVICE_INFO(device, CL_DEVICE_AVAILABLE); PRINT_DEVICE_INFO(device, CL_DEVICE_COMPILER_AVAILABLE); PRINT_DEVICE_INFO(device, CL_DEVICE_DOUBLE_FP_CONFIG); PRINT_DEVICE_INFO(device, CL_DEVICE_ENDIAN_LITTLE); PRINT_DEVICE_INFO(device, CL_DEVICE_ERROR_CORRECTION_SUPPORT); PRINT_DEVICE_INFO(device, CL_DEVICE_EXECUTION_CAPABILITIES); PRINT_DEVICE_INFO(device, CL_DEVICE_GLOBAL_MEM_CACHE_SIZE); PRINT_DEVICE_INFO(device, CL_DEVICE_GLOBAL_MEM_CACHE_TYPE); PRINT_DEVICE_INFO(device, CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE); PRINT_DEVICE_INFO(device, CL_DEVICE_GLOBAL_MEM_SIZE); //PRINT_DEVICE_INFO(device, CL_DEVICE_HALF_FP_CONFIG); PRINT_DEVICE_INFO(device, CL_DEVICE_IMAGE_SUPPORT); PRINT_DEVICE_INFO(device, CL_DEVICE_IMAGE2D_MAX_HEIGHT); PRINT_DEVICE_INFO(device, CL_DEVICE_IMAGE2D_MAX_WIDTH); PRINT_DEVICE_INFO(device, CL_DEVICE_IMAGE3D_MAX_DEPTH); PRINT_DEVICE_INFO(device, CL_DEVICE_IMAGE3D_MAX_HEIGHT); PRINT_DEVICE_INFO(device, CL_DEVICE_IMAGE3D_MAX_WIDTH); PRINT_DEVICE_INFO(device, CL_DEVICE_LOCAL_MEM_SIZE); PRINT_DEVICE_INFO(device, CL_DEVICE_LOCAL_MEM_TYPE); PRINT_DEVICE_INFO(device, CL_DEVICE_MAX_CLOCK_FREQUENCY); PRINT_DEVICE_INFO(device, CL_DEVICE_MAX_COMPUTE_UNITS); PRINT_DEVICE_INFO(device, CL_DEVICE_MAX_CONSTANT_ARGS); PRINT_DEVICE_INFO(device, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE); PRINT_DEVICE_INFO(device, CL_DEVICE_MAX_MEM_ALLOC_SIZE); PRINT_DEVICE_INFO(device, CL_DEVICE_MAX_PARAMETER_SIZE); PRINT_DEVICE_INFO(device, CL_DEVICE_MAX_READ_IMAGE_ARGS); PRINT_DEVICE_INFO(device, CL_DEVICE_MAX_SAMPLERS); PRINT_DEVICE_INFO(device, CL_DEVICE_MAX_WORK_GROUP_SIZE); PRINT_DEVICE_INFO(device, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS); PRINT_DEVICE_INFO_SIZE_T_ARRAY(device, CL_DEVICE_MAX_WORK_ITEM_SIZES); PRINT_DEVICE_INFO(device, CL_DEVICE_MAX_WRITE_IMAGE_ARGS); PRINT_DEVICE_INFO(device, CL_DEVICE_MEM_BASE_ADDR_ALIGN); PRINT_DEVICE_INFO(device, CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE); PRINT_DEVICE_INFO(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR); PRINT_DEVICE_INFO(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT); PRINT_DEVICE_INFO(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT); PRINT_DEVICE_INFO(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG); PRINT_DEVICE_INFO(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT); PRINT_DEVICE_INFO(device, CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE); PRINT_DEVICE_INFO(device, CL_DEVICE_QUEUE_PROPERTIES); PRINT_DEVICE_INFO(device, CL_DEVICE_SINGLE_FP_CONFIG); PRINT_DEVICE_INFO(device, CL_DEVICE_EXTENSIONS); std::cout << "---------------------------------------------------------------" << std::endl; } std::cout << "===============================================================" << std::endl; std::cout << std::endl; } system("pause"); return 0; }以上代码在Visual Studio 2017、vcpkg+OpenCL1.21环境中编译通过。可执行文件如果你不想自己编译软件，可以在这里下载我编译好的可执行程序，下载地址：OpenCLMonitor.rar使用方法解压下载到的压缩包后双击OpenCLMonitor.exe运行，运行效果如下图所示：
最近在研究单片机，想在ESP8266上实现一个小型的Web服务器，但是怎么把HTML写入ESP8266成了个问题。虽然官方有提供烧写HTML到Flash，然后从Flash载入的方法，但是这个方法并不通用，换了其他单片机肯定又不能用了。怎么办呢？我想到了效仿Qt，把资源文件转换成C/C++代码，直接编译进固件里。这样不管什么单片机，只要用C/C++开发都可以使用这个方法。为了把文件转换成C/C++代码，我写了个小工具，现在放出来给大家用。所有人都可以从这里下载这个工具，并免费使用。特别的，如果用于商业用途，请邮箱联系我190258603@qq.com。使用方法如图所示，首先点击1号按钮添加文件，可一次添加多个文件，也可添加多次；然后点击2号按钮选择生成的文件名，可生成.c或.cpp文件；最后点击3号按钮，开始生成，视文件大小，所需时间不同。注意事项这个工具只是简单的做了个转换，使用时请考虑你单片机的存储空间大小、内存大小等等，不要超出单片机的Flash大小，否则烧写固件可能会失败。这个工具我使用Qt5.14.2和VS2017编译，如果缺库请安装对应版本的VC_Redist，可从微软官方下载安装程序。下载地址Release.rar http://www.xiaoyunyun.net/usr/uploads/2022/02/2360157034.rar
PCL中的VoxelGrid类提供了降采样功能，使用VoxelGrid可方便的实现点云数据抽稀，请看代码：#include <iostream> #include <pcl/io/pcd_io.h> #include <pcl/point_types.h> #include <pcl/filters/voxel_grid.h> #include "LasLoader.h" #include "PointCloudViewer.h" int main() { pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud = LasLoader::loadLas("420-432_realColor_small_Cloud.las"); pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_filtered(new pcl::PointCloud<pcl::PointXYZRGBA>()); std::cerr << "PointCloud before filtering: " << cloud->width * cloud->height << " data points (" << pcl::getFieldsList(*cloud) << ")." << std::endl; // Create the filtering object pcl::VoxelGrid<pcl::PointXYZRGBA> sor; sor.setInputCloud(cloud); sor.setLeafSize(2.01f, 2.01f, 2.01f); sor.filter(*cloud_filtered); std::cerr << "PointCloud after filtering: " << cloud_filtered->width * cloud_filtered->height << " data points (" << pcl::getFieldsList(*cloud_filtered) << ")." << std::endl; PointCloudViewer viewer; viewer.showCloud(cloud); PointCloudViewer viewer2; viewer2.showCloud(cloud_filtered); while (viewer.isDone() == false || viewer2.isDone() == false) { if (viewer.isDone() == false) { viewer.renderFrame(); } if (viewer2.isDone() == false) { viewer2.renderFrame(); } } return (0); } LasLoader和PointCloudViewer的源码参见文章：如何使用OSG引擎显示PCL的点云数据？完整Visual Studio 2017工程下载:Filtering-Downsample.rar
为了学习Pcl，经历九九八十一难，终于配置好了vcpkg。由于国内网络的原因，vcpkg自动下载包慢得像龟爬，本人只好买了个迅雷会员，花了两天时间硬是用迅雷下载好了所需的包，最终做成了这个vcpkg完全版，需要的袁们请来直接拿走，不谢！下载地址链接：https://pan.baidu.com/s/1xIFZKBlyJjVA-F_WZjhiRA 提取码：alfdvcpkg可以和VS集成，不用配置包含目录和库目录，也不用配置引用库名称，直接在代码里面#include "xxx"就行了，非常方便，不会使用的袁请自行百度。已安装的包boost-accumulators:x64-windows 1.75.0 Boost accumulators module boost-algorithm:x64-windows 1.75.0 Boost algorithm module boost-align:x64-windows 1.75.0 Boost align module boost-any:x64-windows 1.75.0 Boost any module boost-array:x64-windows 1.75.0 Boost array module boost-asio:x64-windows 1.75.0#1 Boost asio module boost-assert:x64-windows 1.75.0 Boost assert module boost-assign:x64-windows 1.75.0 Boost assign module boost-atomic:x64-windows 1.75.0#1 Boost atomic module boost-beast:x64-windows 1.75.0 Boost beast module boost-bimap:x64-windows 1.75.0 Boost bimap module boost-bind:x64-windows 1.75.0 Boost bind module boost-build:x64-windows 1.75.0 Boost.Build boost-callable-traits:x64-windows 1.75.0 Boost callable_traits module boost-chrono:x64-windows 1.75.0#1 Boost chrono module boost-circular-buffer:x64-windows 1.75.0 Boost circular_buffer module boost-compatibility:x64-windows 1.75.0 Boost compatibility module boost-compute:x64-windows 1.75.0 Boost compute module boost-concept-check:x64-windows 1.75.0#2 Boost concept_check module boost-config:x64-windows 1.75.0 Boost config module boost-container-hash:x64-windows 1.75.0 Boost container_hash module boost-container:x64-windows 1.75.0#1 Boost container module boost-context:x64-windows 1.75.0#4 Boost context module boost-contract:x64-windows 1.75.0#1 Boost contract module boost-conversion:x64-windows 1.75.0 Boost conversion module boost-convert:x64-windows 1.75.0 Boost convert module boost-core:x64-windows 1.75.0 Boost core module boost-coroutine2:x64-windows 1.75.0 Boost coroutine2 module boost-coroutine:x64-windows 1.75.0#1 Boost coroutine module boost-crc:x64-windows 1.75.0 Boost crc module boost-date-time:x64-windows 1.75.0#1 Boost date_time module boost-detail:x64-windows 1.75.0 Boost detail module boost-dll:x64-windows 1.75.0 Boost dll module boost-dynamic-bitset:x64-windows 1.75.0 Boost dynamic_bitset module boost-endian:x64-windows 1.75.0 Boost endian module boost-exception:x64-windows 1.75.0#1 Boost exception module boost-fiber:x64-windows 1.75.0#1 Boost fiber module boost-filesystem:x64-windows 1.75.0#1 Boost filesystem module boost-flyweight:x64-windows 1.75.0 Boost flyweight module boost-foreach:x64-windows 1.75.0 Boost foreach module boost-format:x64-windows 1.75.0 Boost format module boost-function-types:x64-windows 1.75.0 Boost function_types module boost-function:x64-windows 1.75.0 Boost function module boost-functional:x64-windows 1.75.0 Boost functional module boost-fusion:x64-windows 1.75.0 Boost fusion module boost-geometry:x64-windows 1.75.0 Boost geometry module boost-gil:x64-windows 1.75.0 Boost gil module boost-graph-parallel:x64-windows 1.75.0 Boost graph_parallel module boost-graph:x64-windows 1.75.0#1 Boost graph module boost-hana:x64-windows 1.75.0 Boost hana module boost-heap:x64-windows 1.75.0 Boost heap module boost-histogram:x64-windows 1.75.0 Boost histogram module boost-hof:x64-windows 1.75.0 Boost hof module boost-icl:x64-windows 1.75.0 Boost icl module boost-integer:x64-windows 1.75.0 Boost integer module boost-interprocess:x64-windows 1.75.0 Boost interprocess module boost-interval:x64-windows 1.75.0 Boost interval module boost-intrusive:x64-windows 1.75.0 Boost intrusive module boost-io:x64-windows 1.75.0 Boost io module boost-iostreams:x64-windows 1.75.0#1 Boost iostreams module boost-iterator:x64-windows 1.75.0 Boost iterator module boost-json:x64-windows 1.75.0 Boost json module boost-lambda:x64-windows 1.75.0 Boost lambda module boost-leaf:x64-windows 1.75.0 Boost leaf module boost-lexical-cast:x64-windows 1.75.0 Boost lexical_cast module boost-local-function:x64-windows 1.75.0 Boost local_function module boost-locale:x64-windows 1.75.0#1 Boost locale module boost-lockfree:x64-windows 1.75.0 Boost lockfree module boost-log:x64-windows 1.75.0#1 Boost log module boost-logic:x64-windows 1.75.0 Boost logic module boost-math:x64-windows 1.75.0#1 Boost math module boost-metaparse:x64-windows 1.75.0 Boost metaparse module boost-modular-build-helper:x64-windows 1.75.0#9 boost-move:x64-windows 1.75.0 Boost move module boost-mp11:x64-windows 1.75.0 Boost mp11 module boost-mpl:x64-windows 1.75.0 Boost mpl module boost-msm:x64-windows 1.75.0 Boost msm module boost-multi-array:x64-windows 1.75.0 Boost multi_array module boost-multi-index:x64-windows 1.75.0 Boost multi_index module boost-multiprecision:x64-windows 1.75.0 Boost multiprecision module boost-nowide:x64-windows 1.75.0#1 Boost nowide module boost-numeric-conversion:x64-windows 1.75.0 Boost numeric_conversion module boost-odeint:x64-windows 1.75.0 Boost odeint module boost-optional:x64-windows 1.75.0 Boost optional module boost-outcome:x64-windows 1.75.0 Boost outcome module boost-parameter-python:x64-windows 1.75.0 Boost parameter_python module boost-parameter:x64-windows 1.75.0 Boost parameter module boost-pfr:x64-windows 1.75.0 Boost pfr module boost-phoenix:x64-windows 1.75.0 Boost phoenix module boost-poly-collection:x64-windows 1.75.0 Boost poly_collection module boost-polygon:x64-windows 1.75.0 Boost polygon module boost-pool:x64-windows 1.75.0 Boost pool module boost-predef:x64-windows 1.75.0 Boost predef module boost-preprocessor:x64-windows 1.75.0 Boost preprocessor module boost-process:x64-windows 1.75.0 Boost process module boost-program-options:x64-windows 1.75.0#1 Boost program_options module boost-property-map:x64-windows 1.75.0 Boost property_map module boost-property-tree:x64-windows 1.75.0 Boost property_tree module boost-proto:x64-windows 1.75.0 Boost proto module boost-ptr-container:x64-windows 1.75.0 Boost ptr_container module boost-python:x64-windows 1.75.0#2 Boost python module boost-qvm:x64-windows 1.75.0 Boost qvm module boost-random:x64-windows 1.75.0#1 Boost random module boost-range:x64-windows 1.75.0 Boost range module boost-ratio:x64-windows 1.75.0 Boost ratio module boost-rational:x64-windows 1.75.0 Boost rational module boost-regex:x64-windows 1.75.0#2 Boost regex module boost-safe-numerics:x64-windows 1.75.0 Boost safe_numerics module boost-scope-exit:x64-windows 1.75.0 Boost scope_exit module boost-serialization:x64-windows 1.75.0#1 Boost serialization module boost-signals2:x64-windows 1.75.0 Boost signals2 module boost-smart-ptr:x64-windows 1.75.0 Boost smart_ptr module boost-sort:x64-windows 1.75.0 Boost sort module boost-spirit:x64-windows 1.75.0 Boost spirit module boost-stacktrace:x64-windows 1.75.0#1 Boost stacktrace module boost-statechart:x64-windows 1.75.0 Boost statechart module boost-static-assert:x64-windows 1.75.0 Boost static_assert module boost-static-string:x64-windows 1.75.0 Boost static_string module boost-stl-interfaces:x64-windows 1.75.0 Boost stl_interfaces module boost-system:x64-windows 1.75.0#1 Boost system module boost-test:x64-windows 1.75.0#1 Boost test module boost-thread:x64-windows 1.75.0#1 Boost thread module boost-throw-exception:x64-windows 1.75.0 Boost throw_exception module boost-timer:x64-windows 1.75.0#1 Boost timer module boost-tokenizer:x64-windows 1.75.0 Boost tokenizer module boost-tti:x64-windows 1.75.0 Boost tti module boost-tuple:x64-windows 1.75.0 Boost tuple module boost-type-erasure:x64-windows 1.75.0#1 Boost type_erasure module boost-type-index:x64-windows 1.75.0 Boost type_index module boost-type-traits:x64-windows 1.75.0 Boost type_traits module boost-typeof:x64-windows 1.75.0 Boost typeof module boost-ublas:x64-windows 1.75.0 Boost ublas module boost-uninstall:x64-windows 1.75.0 boost uninstall port boost-units:x64-windows 1.75.0 Boost units module boost-unordered:x64-windows 1.75.0 Boost unordered module boost-utility:x64-windows 1.75.0 Boost utility module boost-uuid:x64-windows 1.75.0 Boost uuid module boost-variant2:x64-windows 1.75.0 Boost variant2 module boost-variant:x64-windows 1.75.0 Boost variant module boost-vcpkg-helpers:x64-windows 7#2 a set of vcpkg-internal scripts used to modulari... boost-vmd:x64-windows 1.75.0 Boost vmd module boost-wave:x64-windows 1.75.0#1 Boost wave module boost-winapi:x64-windows 1.75.0 Boost winapi module boost-xpressive:x64-windows 1.75.0 Boost xpressive module boost-yap:x64-windows 1.75.0 Boost yap module boost:x64-windows 1.75.0 Peer-reviewed portable C++ source libraries brotli:x64-windows 1.0.9#1 a generic-purpose lossless compression algorithm... bzip2:x64-windows 1.0.8#1 bzip2 is a freely available, patent free, high-q... cfitsio:x64-windows 3.49 Library of C and Fortran subroutines for reading... coin:x64-windows 4.0.0#2 A high-level 3D visualization library with Open ... coin[simage]:x64-windows Use simage for loading images (textures), audio,... coin[zlib]:x64-windows Use zlib for reading/writing compressed files curl:x64-windows 7.74.0#4 A library for transferring data with URLs curl[non-http]:x64-windows Enables protocols beyond HTTP/HTTPS/HTTP2 curl[schannel]:x64-windows SSL support (Secure Channel) curl[ssl]:x64-windows Default SSL backend curl[sspi]:x64-windows SSPI support curl[winssl]:x64-windows Legacy name for schannel double-conversion:x64-windows 3.1.5 Efficient binary-decimal and decimal-binary conv... egl-registry:x64-windows 2020-02-20 the EGL API and Extension Registry eigen3:x64-windows 3.3.9 C++ template library for linear algebra: matrice... expat:x64-windows 2020-08-18 XML parser library written in C flann:x64-windows 2019-04-07#1 Fast Library for Approximate Nearest Neighbors freeglut:x64-windows 3.2.1#5 Open source implementation of GLUT with source a... freetype:x64-windows 2.10.4 A library to render fonts. freetype[brotli]:x64-windows Support decompression of WOFF2 streams freetype[bzip2]:x64-windows Support bzip2 compressed fonts. freetype[png]:x64-windows Support PNG compressed OpenType embedded bitmaps. freetype[zlib]:x64-windows Use zlib instead of internal library for DEFLATE gdal:x64-windows 3.2.2 The Geographic Data Abstraction Library for read... geos:x64-windows 3.9.1 Geometry Engine Open Source giflib:x64-windows 5.1.4-6 A library for reading and writing gif images. glew:x64-windows 2.1.0#10 The OpenGL Extension Wrangler Library (GLEW) is ... hdf5:x64-windows 1.12.0#2 HDF5 is a data model, library, and file format f... hdf5[szip]:x64-windows Build with szip hdf5[zlib]:x64-windows Build with zlib ilmbase:x64-windows 2.3.0 empty package, linking to newer one jasper:x64-windows 2.0.20 Open source implementation of the JPEG-2000 Part... jsoncpp:x64-windows 1.9.4 jsoncpp is an implementation of a JSON reader an... libffi:x64-windows 3.3#9 Portable, high level programming interface to va... libflac:x64-windows 1.3.3#5 Library for manipulating FLAC files libgeotiff:x64-windows 1.6.0#2 Libgeotiff is an open source library normally ho... libgta:x64-windows 1.0.8-1 Libgta is a portable library that implements the... libharu:x64-windows 2017-08-15-9 libharu - free PDF library libharu[notiffsymbols]:x64-windows disable symbols also defined by the tiff port libiconv:x64-windows 1.16#8 GNU Unicode text conversion libjpeg-turbo:x64-windows 2.0.6 libjpeg-turbo is a JPEG image codec that uses SI... liblas:x64-windows 1.8.1#6 A C/C++ library for reading and writing the very... liblzma:x64-windows 5.2.5#2 Compression library with an API similar to that ... libogg:x64-windows 1.3.4#3 Ogg is a multimedia container format, and the na... libpng:x64-windows 1.6.37#14 libpng is a library implementing an interface fo... libpq:x64-windows 12.2#16 The official database access API of postgresql libpq[openssl]:x64-windows support for encrypted client connections and ran... libpq[zlib]:x64-windows Use zlib (else --without-zlib) libsndfile:x64-windows 1.0.31 Library to read, write and manipulate many sound... libsndfile[external-libs]:x64-windows Default feature. Enables Ogg Vorbis, FLAC and Og... libsquish:x64-windows 1.15-7 Open source DXT compression library. libtheora:x64-windows 1.2.0alpha1-2... Theora is a free and open video compression form... libvorbis:x64-windows 1.3.7#1 Ogg Vorbis is a fully open, non-proprietary, pat... libwebp:x64-windows 1.1.0#3 WebP codec: library to encode and decode images ... libwebp[nearlossless]:x64-windows Enable near-lossless encoding libwebp[simd]:x64-windows Enable any SIMD optimization. libwebp[unicode]:x64-windows Build Unicode executables. (Adds definition UNIC... libxml2:x64-windows 2.9.10#6 Libxml2 is the XML C parser and toolkit develope... lz4:x64-windows 1.9.3 Lossless compression algorithm, providing compre... netcdf-c:x64-windows 4.7.4#2 a set of self-describing, machine-independent da... nvtt:x64-windows 2.1.2#1 Texture processing tools with support for Direct... openexr:x64-windows 2.5.0#2 OpenEXR is a high dynamic-range (HDR) image file... opengl-registry:x64-windows 2020-03-25 the API and Extension registries for the OpenGL ... opengl:x64-windows 0.0#8 Open Graphics Library (OpenGL)[3][4][5] is a cro... openjpeg:x64-windows 2.3.1#4 OpenJPEG is an open-source JPEG 2000 codec writt... openssl:x64-windows 1.1.1k#1 OpenSSL is an open source project that provides ... opus:x64-windows 1.3.1#5 Totally open, royalty-free, highly versatile aud... osg:x64-windows 3.6.5#7 The OpenSceneGraph is an open source high perfor... osg[plugins]:x64-windows Build OSG Plugins - Disable for compile testing ... pcl:x64-windows 1.11.1#3 Point Cloud Library (PCL) is open source library... pcl[opengl]:x64-windows OpenGL support for PCL pcl[vtk]:x64-windows VTK-Visualizations support for PCL pegtl-2:x64-windows 2.8.3 The Parsing Expression Grammar Template Library ... proj4:x64-windows 7.2.1#2 PROJ.4 library for cartographic projections proj4[database]:x64-windows generate database proj4[tiff]:x64-windows Enable TIFF support to read some grids pugixml:x64-windows 1.11.4 Light-weight, simple and fast XML parser for C++... python3:x64-windows 3.9.2#2 The Python programming language python3[deprecated-win7-support]:x64-windows Deprecated support for the Windows 7 platform --... qhull:x64-windows 8.0.2 computes the convex hull, Delaunay triangulation... sdl1:x64-windows 1.2.15#13 Simple DirectMedia Layer is a cross-platform dev... simage:x64-windows 1.8.0#1 Image file format library abstraction layer speex:x64-windows 1.2.0#8 Speex is an Open Source/Free Software patent-fre... sqlite3:x64-windows 3.35.4 SQLite is a software library that implements a s... sqlite3[tool]:x64-windows sqlite3 executable szip:x64-windows 2.1.1-6 Szip compression software, providing lossless co... tiff:x64-windows 4.1.0#2 A library that supports the manipulation of TIFF... utfcpp:x64-windows 3.1.2#1 UTF-8 with C++ in a Portable Way vtk:x64-windows 9.0.1#6 Software system for 3D computer graphics, image ... xxhash:x64-windows 0.8.0#1 Extremely fast hash algorithm zlib:x64-windows 1.2.11#10 A compression library zstd:x64-windows 1.4.9 Zstandard - Fast real-time compression algorithm
最近开始学习PCL库，出师不利，一开始就踩了个坑。PCL库的visualization不能同时开两个CloudViewer，一开就报错，但是不开两个我怎么比较处理前和处理后的数据呢？不得不放弃使用CloudViewer，自己用OSG写了一个类似的东西，废话多不说，请看代码：PointCloudViewer.h#pragma once namespace osg { class Group; class Geometry; class Program; } namespace osgViewer { class Viewer; } class PointCloudViewer { public: enum ColorMode { // 按数据的Z值大小显示不同的颜色 HeightColor = 0, // 显示数据自带的颜色 DataColor = 1, // 把数据自带的颜色处理成黑白进行显示 GrayColor = 2, // 按强度着色 IntensityColor = 3, }; typedef pcl::PointCloud<pcl::PointXYZRGBA>::Ptr DataType; public: struct NodeData { osg::ref_ptr<osg::Geometry> geometry; osg::ref_ptr<osg::Geode> geode; osg::ref_ptr<osg::Program> shader; std::map<std::string, osg::ref_ptr<osg::Uniform>> shaderParameters; }; public: PointCloudViewer(); virtual ~PointCloudViewer(); public: void showCloud(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr data); void setColorMode(ColorMode colorMode); void setColorMode(const DataType& data, ColorMode colorMode); void setDepthCheck(const DataType& data, bool enabled); NodeData* getNodeData(const DataType& data); bool isDone() const; void renderFrame(); private: void initOsg(); private: std::map<DataType, NodeData> mDatas; osg::ref_ptr<osg::Group> mRoot; osg::ref_ptr<osgViewer::Viewer> mViewer; };PointCloudViewer.cpp#include "pch.h" #include "PointCloudViewer.h" #include "Shaders.h" PointCloudViewer::PointCloudViewer() { initOsg(); } PointCloudViewer::~PointCloudViewer() { } void PointCloudViewer::initOsg() { //创建Viewer对象，场景浏览器 mViewer = new osgViewer::Viewer(); mViewer->setThreadingModel(osgViewer::Viewer::SingleThreaded); //设置图形环境特性 osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits(); traits->x = 0; traits->y = 0; traits->width = 640; traits->height = 480; traits->windowDecoration = true; traits->doubleBuffer = true; traits->sharedContext = 0; traits->vsync = false; //创建图形环境特性 osg::ref_ptr<osg::GraphicsContext> gc = osg::GraphicsContext::createGraphicsContext(traits.get()); if (gc.valid()) { osg::notify(osg::INFO) << " GraphicsWindow has been created successfully." << std::endl; //清除窗口颜色及清除颜色和深度缓冲 gc->setClearColor(osg::Vec4f(0.2f, 0.2f, 0.6f, 1.0f)); gc->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } else { osg::notify(osg::NOTICE) << " GraphicsWindow has not been created successfully." << std::endl; } //根据分辨率来确定合适的投影来保证显示的图形不变形 double newAspectRatio = double(traits->width) / double(traits->height); mViewer->getCamera()->setProjectionMatrixAsPerspective(60, newAspectRatio, 1.0, 5000000); //设置视口 mViewer->getCamera()->setViewport(new osg::Viewport(0, 0, traits->width, traits->height)); //设置图形环境 mViewer->getCamera()->setGraphicsContext(gc.get()); auto manipulator = new osgGA::TrackballManipulator(); manipulator->setAllowThrow(false); //manipulator->setWheelZoomFactor(-1); mViewer->setCameraManipulator(manipulator); mViewer->addEventHandler(new osgViewer::StatsHandler()); //创建场景组节点 mRoot = new osg::Group(); mViewer->setSceneData(mRoot.get()); } void PointCloudViewer::showCloud(pcl::PointCloud<pcl::PointXYZRGBA>::Ptr data) { using namespace osg; NodeData nodeData; // 创建几何体 ref_ptr<Geometry> geometry = new Geometry(); ref_ptr<Vec3Array> vertex = new Vec3Array(); ref_ptr<Vec4Array> color = new Vec4Array(); long long count = data->size(); vertex->resize(count); color->resize(count); const pcl::PointXYZRGBA* pData = data->data(); Vec3* pVertex = vertex->asVector().data(); Vec4* pColor = color->asVector().data(); #pragma omp parallel for for (long long i = 0; i < count; i++) { pVertex[i].set(pData[i].x, pData[i].y, pData[i].z); pColor[i].set(pData[i].r / 255.0f, pData[i].g / 255.0f, pData[i].b / 255.0f, pData[i].a / 255.0f); } geometry->setVertexArray(vertex); geometry->setColorArray(color, Array::BIND_PER_VERTEX); geometry->addPrimitiveSet(new DrawArrays(PrimitiveSet::POINTS, 0, count)); // 创建叶子节点 ref_ptr<Geode> geode = new Geode(); geode->addDrawable(geometry); osg::StateSet * ss = geode->getOrCreateStateSet(); ss->setMode(GL_LIGHTING, osg::StateAttribute::OFF); // 启用Shader osg::ref_ptr<osg::Program> program = new osg::Program(); bool vsAdded = program->addShader(new osg::Shader(osg::Shader::VERTEX, vs_PointCloudRender)); bool psAdded = program->addShader(new osg::Shader(osg::Shader::FRAGMENT, ps_PointCloudRender)); if (vsAdded && psAdded) { auto boundBox = geode->getBoundingBox(); osg::ref_ptr<osg::Uniform> heightMin = new osg::Uniform("heightMin", boundBox.zMin()); osg::ref_ptr<osg::Uniform> heightMax = new osg::Uniform("heightMax", boundBox.zMax()); osg::ref_ptr<osg::Uniform> renderType = new osg::Uniform("renderType", DataColor); osg::ref_ptr<osg::Uniform> colorMin = new osg::Uniform("colorMin", osg::Vec4(1, 0, 0, 1)); osg::ref_ptr<osg::Uniform> colorMax = new osg::Uniform("colorMax", osg::Vec4(0, 1, 0, 1)); ss->addUniform(heightMin); ss->addUniform(heightMax); ss->addUniform(renderType); ss->addUniform(colorMin); ss->addUniform(colorMax); ss->setAttributeAndModes(program, osg::StateAttribute::ON); nodeData.shaderParameters["heightMin"] = heightMin; nodeData.shaderParameters["heightMax"] = heightMax; nodeData.shaderParameters["renderType"] = renderType; nodeData.shaderParameters["colorMin"] = colorMin; nodeData.shaderParameters["colorMax"] = colorMax; } // 加入场景 mRoot->addChild(geode); // 设置相机初始位置 auto bound = mRoot->computeBound(); auto manipulator = mViewer->getCameraManipulator(); if (manipulator) { osgGA::TrackballManipulator* trackballManipulator = dynamic_cast<osgGA::TrackballManipulator*>(manipulator); if (trackballManipulator) { osg::Vec3 eye(bound.radius() + 1, bound.radius() / 2, 0); trackballManipulator->setTransformation(eye, bound.center(), osg::Vec3(0, 1, 0)); } } nodeData.geometry = geometry; nodeData.geode = geode; nodeData.shader = program; mDatas.insert(std::make_pair(data, nodeData)); } void PointCloudViewer::setColorMode(ColorMode colorMode) { for (auto it = mDatas.begin(); it != mDatas.end(); it++) { const NodeData& nd = it->second; auto itFound = nd.shaderParameters.find("renderType"); if (itFound != nd.shaderParameters.end()) { itFound->second->set((int)colorMode); } } } void PointCloudViewer::setColorMode(const DataType& data, ColorMode colorMode) { auto itData = mDatas.find(data); if (itData != mDatas.end()) { auto itUniform = itData->second.shaderParameters.find("renderType"); if (itUniform != itData->second.shaderParameters.end()) { itUniform->second->set((int)colorMode); } } } bool PointCloudViewer::isDone() const { if (mViewer) { return mViewer->done(); } return false; } void PointCloudViewer::renderFrame() { if (mViewer) { mViewer->frame(); } } void PointCloudViewer::setDepthCheck(const DataType& data, bool enabled) { auto itData = mDatas.find(data); if (itData != mDatas.end()) { NodeData& data = itData->second; data.geode->getOrCreateStateSet()->setMode(GL_DEPTH_TEST, osg::StateAttribute::OFF); } } PointCloudViewer::NodeData* PointCloudViewer::getNodeData(const DataType& data) { auto itData = mDatas.find(data); if (itData != mDatas.end()) { return &itData->second; } return nullptr; } 使用方法#include <iostream> #include <thread> #include <chrono> #include <pcl/point_types.h> #include <pcl/filters/passthrough.h> #define WINGDIAPI #include <osgDB/ReadFile> #include <osgViewer/Viewer> #include "LasLoader.h" #include "pclColor.h" #include "PointCloudViewer.h" int main() { pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud = LasLoader::loadLas("420-432_realColor_small_Cloud.las"); pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud_filtered(new pcl::PointCloud<pcl::PointXYZRGBA>()); // Create the filtering object pcl::PassThrough<pcl::PointXYZRGBA> pass; pass.setInputCloud(cloud); pass.setFilterFieldName("z"); pass.setFilterLimits(0.0, 50.0); //pass.setFilterLimitsNegative (true); pass.filter(*cloud_filtered); long long count = cloud_filtered->size(); pcl::PointXYZRGBA* data = cloud_filtered->data(); #pragma omp parallel for for (long long i = 0; i < count; i++) { data[i].rgba = fromRgba(255, 255, 0, 255); } PointCloudViewer viewer; viewer.showCloud(cloud); PointCloudViewer viewer2; viewer2.showCloud(cloud_filtered); while (viewer.isDone() == false || viewer2.isDone() == false) { if (viewer.isDone() == false) { viewer.renderFrame(); } if (viewer2.isDone() == false) { viewer2.renderFrame(); } } return (0); }LasLoader是我自己写的加载LAS数据的类，代码如下：#include <iostream> #include <pcl/point_types.h> #include <pcl/point_cloud.h> #include <pcl/common/io.h> #include "LasLoader.h" #include "liblas/liblas.hpp" pcl::PointCloud<pcl::PointXYZRGBA>::Ptr LasLoader::loadLas(const char* lasFilePath) { //打开las文件 std::ifstream ifs; ifs.open(lasFilePath, std::ios::in | std::ios::binary); if (!ifs.is_open()) { std::cout << "无法打开.las" << std::endl; return nullptr; } liblas::ReaderFactory readerFactory; liblas::Reader reader = readerFactory.CreateWithStream(ifs); const liblas::Header& lasHeader = reader.GetHeader(); double minX = lasHeader.GetMinX(); double minY = lasHeader.GetMinY(); double minZ = lasHeader.GetMinZ(); //写点云 pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloudOutput(new pcl::PointCloud<pcl::PointXYZRGBA>()); cloudOutput->reserve(lasHeader.GetPointRecordsCount()); pcl::PointXYZRGBA thePt; while (reader.ReadNextPoint()) { const liblas::Point& lasPoint = reader.GetPoint(); const liblas::Color& lasColor = lasPoint.GetColor(); double x = lasPoint.GetX() - minX; double y = lasPoint.GetY() - minY; double z = lasPoint.GetZ() - minZ; uint16_t red = lasColor.GetRed(); uint16_t green = lasColor.GetGreen(); uint16_t blue = lasColor.GetBlue(); /*****颜色说明 * uint16_t 范围为0-256*256 ； * pcl 中 R G B利用的unsigned char 0-256； * 因此这里将uint16_t 除以256 得到 三位数的0-256的值 * 从而进行rgba 值32位 的位运算。 * ******/ thePt.x = x; thePt.y = y; thePt.z = z; if (red == 0 && green == 0 && blue == 0) { thePt.rgba = 0xFFFFFFFF; } else { thePt.rgba = (uint32_t)255 << 24 | (uint32_t)(red / 256) << 16 | (uint32_t)(green / 256) << 8 | (uint32_t)(blue / 256); } cloudOutput->push_back(thePt); } return cloudOutput; }OsgVisualizer完整代码下载OsgVisualizer.rar代码在vcpkg+VS2017+Win7下编译通过，vcpkg需安装OSG、PCL包。