PCL学习笔记(1)---可视化-cloud_viewer
2017-03-30 15:54
417 查看
cloud_viewer.cpp
`#include
“`
int user_data;
void
viewerOneOff (pcl::visualization::PCLVisualizer& viewer)
{
viewer.setBackgroundColor (1.0, 0.5, 1.0);//设置背景颜色
pcl::PointXYZ o;
o.x = 0;
o.y = 0;
o.z = 0;
viewer.addSphere (o, 1, “sphere”, 0);//添加一个球体
std::cout << “i only run once” << std::endl;
}
void
viewerPsycho (pcl::visualization::PCLVisualizer& viewer)//在可视化对象中添加一个刷新显示字符串
{
static unsigned count = 0;
std::stringstream ss;
ss << “Once per viewer loop: ” << count++;
viewer.removeShape (“text”, 0);
viewer.addText (ss.str(), 200, 300, “text”, 0);
//FIXME: possible race condition here:
user_data++;
}
int
main ()
{
pcl::PointCloud::Ptr cloud (new pcl::PointCloud);
pcl::io::loadPCDFile (“maize.pcd”, *cloud);
pcl::visualization::CloudViewer viewer(“Cloud Viewer”);
//showCloud函数是同步的,在此处等待直到渲染显示为止
viewer.showCloud(cloud);
//该注册函数在可视化时只调用一次
viewer.runOnVisualizationThreadOnce (viewerOneOff);
//该注册函数在渲染输出时每次都调用
viewer.runOnVisualizationThread (viewerPsycho);//用了可视化多线程
while (!viewer.wasStopped ())
{
//在此处可以添加其他处理
user_data++;
}
return 0;
} `
“`
![](https://img-blog.csdn.net/20170330154516216?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQveWJ5MTI3MQ==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
使用vtk可以用快捷键
w:切换到网格渲染 可以把球变成网格形状
s:曲面渲染
j:截图
等具体参看p139页
http://blog.csdn.net/fandq1223/article/details/53186244
http://blog.csdn.net/chentravelling/article/details/43484245
`#include
#include <iostream> #include <pcl/io/io.h> #include <pcl/io/pcd_io.h>
“`
int user_data;
void
viewerOneOff (pcl::visualization::PCLVisualizer& viewer)
{
viewer.setBackgroundColor (1.0, 0.5, 1.0);//设置背景颜色
pcl::PointXYZ o;
o.x = 0;
o.y = 0;
o.z = 0;
viewer.addSphere (o, 1, “sphere”, 0);//添加一个球体
std::cout << “i only run once” << std::endl;
}
void
viewerPsycho (pcl::visualization::PCLVisualizer& viewer)//在可视化对象中添加一个刷新显示字符串
{
static unsigned count = 0;
std::stringstream ss;
ss << “Once per viewer loop: ” << count++;
viewer.removeShape (“text”, 0);
viewer.addText (ss.str(), 200, 300, “text”, 0);
//FIXME: possible race condition here:
user_data++;
}
int
main ()
{
pcl::PointCloud::Ptr cloud (new pcl::PointCloud);
pcl::io::loadPCDFile (“maize.pcd”, *cloud);
pcl::visualization::CloudViewer viewer(“Cloud Viewer”);
//showCloud函数是同步的,在此处等待直到渲染显示为止
viewer.showCloud(cloud);
//该注册函数在可视化时只调用一次
viewer.runOnVisualizationThreadOnce (viewerOneOff);
//该注册函数在渲染输出时每次都调用
viewer.runOnVisualizationThread (viewerPsycho);//用了可视化多线程
while (!viewer.wasStopped ())
{
//在此处可以添加其他处理
user_data++;
}
return 0;
} `
“`
使用vtk可以用快捷键
w:切换到网格渲染 可以把球变成网格形状
s:曲面渲染
j:截图
等具体参看p139页
http://blog.csdn.net/fandq1223/article/details/53186244
http://blog.csdn.net/chentravelling/article/details/43484245
相关文章推荐
- PCL学习笔记(1)---可视化(3)-range_image_visualization
- PCL学习笔记一:io
- android 多媒体部分学习笔记十 可视化频率(频谱)
- VIM学习笔记 可视化模式 (Visual Mode)
- PCL学习笔记二:Registration (ICP算法)
- UI学习笔记---第十三天可视化设计 XIB, StoryBoard
- PCL 1.6--- point cloud viewer
- IDL学习笔记(1)--可视化组件编程
- PCL学习笔记(一)
- PCL 学习笔记_1
- 可视化格式模型--Css学习笔记(二)
- PCL学习笔记三:filter
- PCL学习笔记二:Registration (ICP算法)
- Azure学习笔记:Cloud Service(4)
- solrCloud 索引更新逻辑学习笔记
- PCL学习笔记(一)PCL+VS2010环境配置
- PCL学习笔记四:3D feature in PCL
- cloudstack+kvm 架构 学习笔记
- VTK学习笔记:可视化模型
- Java学习笔记01---可视化输入输出,数据类型转化,流程控制