3D视觉学习之路——基于pcl从CAD模型中获取单视角点云
2017-02-22 17:25
2815 查看
学习PCL也有将近两个月了,现在想开下博客记录一些自己的学习心得。
由于项目需要,现在需要从CAD模型中提取单视角点云。pcl提取单视角点云的函数名是renderViewTesselatedSphere,属于pcl::visualization::PCLVisualizer中的成员函数。
下面是关键代码:
该代码实现的是从一个cad模型中获取80个视角的点云。
由于项目需要,现在需要从CAD模型中提取单视角点云。pcl提取单视角点云的函数名是renderViewTesselatedSphere,属于pcl::visualization::PCLVisualizer中的成员函数。
下面是关键代码:
/*+++++++++++++++++++++++++单视角点云获取+++++++++++++++++++++++++++++++*/ vtkSmartPointer<vtkPolyData> polydata = vtkSmartPointer<vtkPolyData>::New(); vtkSmartPointer<vtkSTLReader> readerQuery = vtkSmartPointer<vtkSTLReader>::New(); //读取CAD模型 readerQuery->SetFileName("aa.STL"); readerQuery->Update(); polydata = readerQuery->GetOutput(); polydata->GetNumberOfPoints()); //单视角点云获取 float resx = 512; float resy = resx; std::vector<pcl::PointCloud<pcl::PointXYZ>, Eigen::aligned_allocator<pcl::PointCloud<pcl::PointXYZ> > > views_xyz; std::vector<Eigen::Matrix4f, Eigen::aligned_allocator<Eigen::Matrix4f> > poses; std::vector<float> entropies; pcl::visualization::PCLVisualizer vis; vis.addModelFromPolyData(polydata, "mesh", 0); vis.setRepresentationToSurfaceForAllActors(); vis.renderViewTesselatedSphere(resx, resy, views_xyz, poses, entropies, 1, 90, 1, FALSE); for (int i = 0; i < views_xyz.size(); i++) { pcl::PointCloud<pcl::PointXYZ> views_cloud; pcl::transformPointCloud<pcl::PointXYZ>(views_xyz[i], views_cloud, poses[i]); std::stringstream ss; ss << "cloud_view_" << i << ".ply"; pcl::io::savePLYFile(ss.str(), views_cloud); } while (!vis.wasStopped()) { }
该代码实现的是从一个cad模型中获取80个视角的点云。
相关文章推荐
- 基于Kinect v2+PCL的模型奶牛重建(上)——数据获取
- 卡内基梅隆大学提出基于学习的动作捕捉模型,用自监督学习实现人类3D动作追踪
- OpenCV学习笔记(13)基于OpenCV2.1的MFC双目视觉平台构建
- 一起学习基于模型测试:UML测试概要
- 基于事件/监听器的模型的学习
- 基于dyse同学的网络爬虫模型的学习和实现(一)
- 基于JAVA的水泥三维图像特征提取系统设计与实现 之一 JAVA 3D学习笔记
- XNA学习(二) 载入3D模型
- 【转】学习总结之3D模型
- java学习之路——基于TCP的Socket网络通信实例
- 详解Linux2.6内核中基于platform机制的驱动模型<强烈推荐,这是一篇学习驱动模型千年一遇的好文章>
- Sharepoint学习笔记—ECMAScript对象模型系列-- 7、获取和修改List的Lookup字段
- 一起学习基于模型测试:UML测试概要的结构
- VC时间函数学习记录(获取基于1970-1-1的标准时间)
- 获取3d max模型的包围盒
- java学习之路——基于UDP的Socket网络通信实例
- 一起学习基于模型测试:什么是基于模型测试
- WPF在3D Cad模型中利用TextureCoordinates实现颜色渐变显示偏差值的变化
- PHP学习之路(三)让我们开始环境搭建(搭建LMAP--基于Ubuntu11.04)
- PHP学习之路(三)让我们开始环境搭建(搭建LMAP--基于Ubuntu11.04)