点云显示函数
来源:互联网 发布:武易传奇物品数据库 编辑:程序博客网 时间:2024/04/28 18:09
简单的显示方法:
//*******************************************************
//点云数据的简单显示代码
pcl::visualization::CloudViewer viewer(“Simple Cloud Viewer”);
viewer.showCloud(cl_model); //cl_model是需要显示的点云,定义为pcl::PointCloud::Ptr cl_model(new pcl::PointCloud);
while (!viewer.wasStopped())
{
}
//*******************************************************
//另一种点云显示方式
boost::shared_ptr viewer(new pcl::visualization::PCLVisualizer(“PointsCloud Recognition”));
viewer->addPointCloud(cl_model, “model_cloud”);
viewer->addCoordinateSystem(1.0);
viewer->initCameraParameters();
while (!viewer->wasStopped())
{
viewer->spinOnce(100);
boost::this_thread::sleep(boost::posix_time::microseconds(100000));
}
//同一窗口显示多个不同的点云对象
boost::shared_ptr viewportsVis(
pcl::PointCloud::ConstPtr cloud1, pcl::PointCloud::ConstPtr cloud2)
{
// ——————————————————–
// —–Open 3D viewer and add point cloud and normals—–
// ——————————————————–
boost::shared_ptr viewer(new pcl::visualization::PCLVisualizer(“3D Viewer”));
viewer->initCameraParameters();
int v1(0);viewer->createViewPort(0.0, 0.0, 0.5, 1.0, v1);//创建左边的窗口viewer->setBackgroundColor(0, 0, 0, v1);//设置左边窗口的背景viewer->addText("Radius: 0.1", 10, 10, "v1 text", v1);pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> single_color1(cloud1, 255, 0, 0);viewer->addPointCloud<pcl::PointXYZ>(cloud1, single_color1, "sample cloud1", v1);int v2(0);viewer->createViewPort(0.5, 0.0, 1.0, 1.0, v2);//创建右边的窗口viewer->setBackgroundColor(0.0, 0.0, 0.0, v2);viewer->addText("Radius: 0.1", 10, 10, "v2 text", v2);pcl::visualization::PointCloudColorHandlerCustom<pcl::PointXYZ> single_color(cloud2, 0, 255, 0);viewer->addPointCloud<pcl::PointXYZ>(cloud2, single_color, "sample cloud2", v2);viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, "sample cloud1");viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, "sample cloud2");viewer->addCoordinateSystem(1.0);//viewer->addPointCloudNormals<pcl::PointXYZRGB, pcl::Normal>(cloud, normals1, 10, 0.05, "normals1", v1);//viewer->addPointCloudNormals<pcl::PointXYZRGB, pcl::Normal>(cloud, normals2, 10, 0.05, "normals2", v2);return (viewer);
}
// ————–
// —–Help—–
// ————–
void
printUsage(const char* progName)
{
std::cout << “\n\nUsage: ” << progName << ” [options]\n\n”
<< “Options:\n”
<< “——————————————-\n”
<< “-h this help\n”
<< “-s Simple visualisation example\n”
<< “-r RGB colour visualisation example\n”
<< “-c Custom colour visualisation example\n”
<< “-n Normals visualisation example\n”
<< “-a Shapes visualisation example\n”
<< “-v Viewports example\n”
<< “-i Interaction Customization example\n”
<< “\n\n”;
}
boost::shared_ptr simpleVis(pcl::PointCloud::ConstPtr cloud)
{
// ——————————————–
// —–Open 3D viewer and add point cloud—–
// ——————————————–
//创建可视化对象viewer
boost::shared_ptr viewer(new pcl::visualization::PCLVisualizer(“3D Viewer”));
//设置背景为黑色
viewer->setBackgroundColor(0, 0, 0);
//将要显示的点云添加到可视化对象中。
viewer->addPointCloud(cloud, “sample cloud”);
//渲染点云
viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 1, “sample cloud”);
//添加坐标轴
viewer->addCoordinateSystem(1.0);
//初始化相机
viewer->initCameraParameters();
return (viewer);
}
boost::shared_ptr rgbVis(pcl::PointCloud::ConstPtr cloud)
{
// ——————————————–
// —–Open 3D viewer and add point cloud—–
// ——————————————–
boost::shared_ptr viewer(new pcl::visualization::PCLVisualizer(“3D Viewer”));
viewer->setBackgroundColor(0, 0, 0);
pcl::visualization::PointCloudColorHandlerRGBField rgb(cloud);
viewer->addPointCloud(cloud, rgb, “sample cloud”);
viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, “sample cloud”);
viewer->addCoordinateSystem(1.0);
viewer->initCameraParameters();
return (viewer);
}
//
boost::shared_ptr customColourVis(pcl::PointCloud::ConstPtr cloud)
{
// ——————————————–
// —–Open 3D viewer and add point cloud—–
// ——————————————–
boost::shared_ptr viewer(new pcl::visualization::PCLVisualizer(“3D Viewer”));
viewer->setBackgroundColor(0, 0, 0);
pcl::visualization::PointCloudColorHandlerCustom single_color(cloud, 0, 255, 0);
viewer->addPointCloud(cloud, single_color, “sample cloud”);
viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, “sample cloud”);
viewer->addCoordinateSystem(1.0);
viewer->initCameraParameters();
return (viewer);
}
//法线显示
boost::shared_ptr normalsVis(
pcl::PointCloud::ConstPtr cloud, pcl::PointCloud::ConstPtr normals)
{
// ——————————————————–
// —–Open 3D viewer and add point cloud and normals—–
// ——————————————————–
boost::shared_ptr viewer(new pcl::visualization::PCLVisualizer(“3D Viewer”));
viewer->setBackgroundColor(0, 0, 0);
pcl::visualization::PointCloudColorHandlerRGBField rgb(cloud);
viewer->addPointCloud(cloud, rgb, “sample cloud”);
viewer->setPointCloudRenderingProperties(pcl::visualization::PCL_VISUALIZER_POINT_SIZE, 3, “sample cloud”);
viewer->addPointCloudNormals
- 点云显示函数
- osg显示点云
- osg显示点云
- PCL可视化显示点云
- VTK点云的显示
- PCL显示点云[微记]
- PCL点云的显示
- PCL可视化显示点云
- [Point Cloud Library] 显示点云
- [Point Cloud Library] 显示点云
- 点云数据读取及显示
- PCL+VS2010+Qt显示点云
- pcl点云mfc单文档显示
- Coin3D单文档点云显示程序
- ROS velodyne 连接点云并且显示
- PCL+QT+VS显示点云
- KinectV2 qt pcl 实现点云显示
- LiDAR-MEMS激光雷达点云实时显示
- linux的软件包管理工具---rpm与yum
- 第一次认识Java
- table的使用
- Discuz论坛如何使用SendCloud?
- spring 入门
- 点云显示函数
- PowerShell 创建迷你模块
- oracle用户,游标,储存过程,触发器,函数总结
- eclipse maven 插件的安装和配置
- 使用Checkstyle统一编码
- 如何将ProtoBuffer生成Erlang文件
- 前端自定义字体的使用
- 欢迎使用CSDN-markdown编辑器
- 栈完成简易的计算器