PCL -- visualize

关于pcl可视化的一部分记录
官方文档有一个demo的示例,但是感觉对于刚上手的小白本白太不友好了,故而自己整理记录一下。

1.CloudViewer(最先学的简单版本)

使用类pcl::visualization::CloudViewer

#include  //需要包含的头文件

  pcl::visualization::CloudViewer viewer ("Cloud viewer");//新建一个窗口对象,并命名为“Cloud viewer"
  viewer.showCloud (cloud); //将需要显示的点云,通过showCloud传给窗口
  while(!viewer.wasStopped())//窗口没关的话一直显示
  {
  }

贴一下两个个函数的说明
1.showCloud()

void pcl::visualization::CloudViewer::showCloud	(	const ColorCloud::ConstPtr & 	cloud,
const std::string & 	cloudname = "cloud" 
)	

Show a cloud, with an optional key for multiple clouds.
Parameters
[in] cloud RGB/XYZ/XYZI point cloud //重载函数,可以及加载多种类型
[in] cloudname a key for the point cloud, use the same name if you would like to overwrite the existing cloud.
Referenced by pcl::gpu::DataSource::runCloudViewer().

2.wasStopped()

bool pcl::visualization::CloudViewer::wasStopped	(	int 	millis_to_wait = 1	)	

Check if the gui was quit, you should quit also.

Parameters
millis_to_wait This will request to “spin” for the number of milliseconds, before exiting.
Returns
true if the user signaled the gui to stop
Referenced by pcl::gpu::DataSource::runCloudViewer().

2.PCLVisualizer

使用类pcl::visualization::PCLVisualizer
Author Radu B. Rusu
Note
This class can NOT be used across multiple threads. Only call functions of objects of this class from the same thread that they were created in! Some methods, e.g. addPointCloud, will crash if called from other threads.
Definition at line 86 of file pcl_visualizer.h

#include 

pcl::visualization::PCLVisualizer viewer ("cloud viewer");
viewer.addPointCloud(cloud,"original");
viewer.spin();

未完待续…

你可能感兴趣的:(PCL,基础知识)