可视化(visualization)是利用计算机图形学和图像处理技术,将数据转换图像在屏幕上显示出来,并进行交互处理的的理论,方法和技术,

pcl_visualization库建立了能够快速建立原型的目的和可视化算法对三维点云数据操作的结果。类似于opencv的highgui例程显示二维图像,在屏幕上绘制基本的二维图形,库提供了以下几点:

(1)渲染和设置视觉特性的方法(如颜色、大小、透明度等)在PCL任意n维的点云数据集pcl::PointCloud<T> format

(2)在屏幕上绘制基本的3D形状的方法(例如,圆柱体,球体,线,多边形等),无论是从点集或参数方程;

(3)一个直方图可视化模块(pclhistogramvisualizer)的二维图;

(4)大量的几何和颜色处理pcl::PointCloud<T> datasets

(5)a pcl::RangeImage 可视化模块

.

1.   class  pcl::visualization::CloudViewer   类CloudViewer实现创建点云可视化的窗口,以及相关的可视化功能

Public Member Functions

  CloudViewer (const std::string &window_name)   构建可视化点云窗口,窗口名为window_name
  ~CloudViewer ()     注销窗口相关资源
void  showCloud (const ColorCloud::ConstPtr &cloud, const std::string &cloudname="cloud")
  可视化窗口显示cloud对应的点云,考虑到多个点云用键值cloudname来限定是哪一个点云
bool  wasStopped (int millis_to_wait=1)
  判断用户是否已经关闭窗口,如果是则需要注销窗口
void  runOnVisualizationThread (VizCallable x, const std::string &key="callable")
  在窗口运行期间处理x的回调函数,key为键值标识此回调函数,知道窗口关闭
void  runOnVisualizationThreadOnce (VizCallable x)
  值调用回调函数一次
void  removeVisualizationCallable (const std::string &key="callable")
  删除key对应的回调函数
boost::signals2::connection  registerKeyboardCallback (void(*callback)(const pcl::visualization::KeyboardEvent &, void *), void *cookie=NULL)
  注册键盘事件回调函数,cookie为回调时的参数,callback为回调函数的指针
template<typename T >
boost::signals2::connection  registerKeyboardCallback (void(T::*callback)(const pcl::visualization::KeyboardEvent &, void *), T &instance, void *cookie=NULL)
  同上,其中的instance 指向是实现该回到函数的对象

(2)太多了这里就贴出所有的关于可视化的类    对于类的成员就不再一一介绍

class   pcl::visualization::CloudViewer
  Simple point cloud visualization class. More...
class   pcl::visualization::FloatImageUtils
  Provide some gerneral functionalities regarding 2d float arrays, e.g., for visualization purposes More...
class   pcl::visualization::PCLHistogramVisualizer
  PCL histogram visualizer main class. More...
class   pcl::visualization::ImageViewerInteractorStyle
  An image viewer interactor style, tailored for ImageViewer. More...
struct   pcl::visualization::ImageViewer::ExitMainLoopTimerCallback
struct   pcl::visualization::ImageViewer::ExitCallback
class   pcl::visualization::ImageViewer
  ImageViewer is a class for 2D image visualization. More...
class   pcl::visualization::PCLVisualizerInteractorStyle
  PCLVisualizerInteractorStyle defines an unique, custom VTK based interactory style for PCL Visualizer applications. More...
struct   pcl::visualization::Figure2D
  Abstract class for storing figure information. More...
class   pcl::visualization::PCLPainter2D
  PCL Painter2D main class. More...
class   pcl::visualization::PCLPlotter
  PCL Plotter main class. More...
class   pcl::visualization::PCLVisualizer
  PCL Visualizer main class. More...
class   pcl::visualization::PointCloudColorHandler< PointT >
  Base Handler class for PointCloud colors. More...
class   pcl::visualization::PointCloudColorHandlerRandom< PointT >
  Handler for random PointCloud colors (i.e., R, G, B will be randomly chosen) More...
class   pcl::visualization::PointCloudColorHandlerCustom< PointT >
  Handler for predefined user colors. More...
class   pcl::visualization::PointCloudColorHandlerRGBField< PointT >
  RGB handler class for colors. More...
class   pcl::visualization::PointCloudColorHandlerHSVField< PointT >
  HSV handler class for colors. More...

等等*****************************************8

应用实例

cloud_viewer.cpp:

#include <pcl/visualization/cloud_viewer.h>   //类cloud_viewer头文件申明
#include <iostream> //标准输入输出头文件申明
#include <pcl/io/io.h> //I/O相关头文件申明
#include <pcl/io/pcd_io.h> //PCD文件读取 /**********************************************************************************
函数是作为回调函数,在主函数中只注册一次 ,函数实现对可视化对象背景颜色的设置,添加一个圆球几何体
*********************************************************************************/
int user_data; void
viewerOneOff (pcl::visualization::PCLVisualizer& viewer)
{
viewer.setBackgroundColor (1.0, 0.5, 1.0); //设置背景颜色
pcl::PointXYZ o; //存储球的圆心位置
o.x = 1.0;
o.y = ;
o.z = ;
viewer.addSphere (o, 0.25, "sphere", ); //添加圆球几何对象
std::cout << "i only run once" << std::endl; }
/***********************************************************************************
作为回调函数,在主函数中注册后每帧显示都执行一次,函数具体实现在可视化对象中添加一个刷新显示字符串
*************************************************************************************/
void
viewerPsycho (pcl::visualization::PCLVisualizer& viewer)
{
static unsigned count = ;
std::stringstream ss;
ss << "Once per viewer loop: " << count++;
viewer.removeShape ("text", );
viewer.addText (ss.str(), , , "text", ); //FIXME: possible race condition here:
user_data++;
}
/**************************************************************
首先加载点云文件到点云对象,并初始化可视化对象viewer,注册上面的回
调函数,执行循环直到收到关闭viewer的消息退出程序
*************************************************************/
int
main ()
{
pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGBA>); //声明cloud
pcl::io::loadPCDFile ("my_point_cloud.pcd", *cloud); //加载点云文件 pcl::visualization::CloudViewer viewer("Cloud Viewer"); //创建viewer对象 //showCloud函数是同步的,在此处等待直到渲染显示为止
viewer.showCloud(cloud); //该注册函数在可视化的时候只执行一次
viewer.runOnVisualizationThreadOnce (viewerOneOff); //该注册函数在渲染输出时每次都调用
viewer.runOnVisualizationThread (viewerPsycho);
while (!viewer.wasStopped ())
{
//此处可以添加其他处理
//FIXME: Note that this is running in a separate thread from viewerPsycho
//and you should guard against race conditions yourself...
user_data++;
}
return ;
}

编译结果如下

未完待续*************************8888888

PCL 可视化的更多相关文章

  1. PCL可视化显示 直接加载显示pcb文件

    简单可视化类,是指直接在程序中使用,而且不支持多线程. #include<iostream> #include<pcl\point_cloud.h> #include<p ...

  2. PCL:PCL可视化显示点云

    (1):引用:仅仅是简单的显示点云,可以使用CloudViewer类.这个类非常简单易用.但要注意,它不是线程安全的.如果要用于多线程,还要参考PCLVisualizer. 需要注意的是,PointC ...

  3. PCL点云配准(1)

    在逆向工程,计算机视觉,文物数字化等领域中,由于点云的不完整,旋转错位,平移错位等,使得要得到的完整的点云就需要对局部点云进行配准,为了得到被测物体的完整数据模型,需要确定一个合适的坐标系,将从各个视 ...

  4. PCL深度图像(2)

    (1)点云到深度图与可视化的实现 区分点云与深度图本质的区别 1.深度图像也叫距离影像,是指将从图像采集器到场景中各点的距离(深度)值作为像素值的图像.获取方法有:激光雷达深度成像法.计算机立体视觉成 ...

  5. PCL点云库中的坐标系(CoordinateSystem)

    博客转载自:https://blog.csdn.net/qq_33624918/article/details/80488590 引言 世上本没有坐标系,用的人多了,便定义了坐标系统用来定位.地理坐标 ...

  6. [转]第四章 使用OpenCV探测来至运动的结构——Chapter 4:Exploring Structure from Motion Using OpenCV

    仅供参考,还未运行程序,理解部分有误,请参考英文原版. 绿色部分非文章内容,是个人理解. 转载请注明:http://blog.csdn.net/raby_gyl/article/details/174 ...

  7. Windows7系统下OpenCV2.4.4+PCL1.6.0+SSBA3.0+VS2010 IDE32环境下编译和安装以实现Sfm和PCL点云数据可视化

    最近在学习<深入理解OpenCV:实用计算机视觉项目解析>一书的第三章和第四章时,遇到很多编译问题,书中又没有详细的讲解环境配置和搭建过程.经过多天的捉摸.调试.排错终于将两章的程序都调试 ...

  8. PCL+Qt+VS可视化点云

    前言 Point Cloud Library (PCL)是一个功能强大的开源C++库,假设可以使用好PCL将会对我们在LiDAR数据处理领域的研究产生巨大帮助.LiDAR技术经过几十年的发展.眼下国内 ...

  9. PCL点云处理可视化——法向显示错误“no override found for vtk actor”解决方法

    转:https://blog.csdn.net/bflong/article/details/79137692 参照:https://blog.csdn.net/imsaws/article/deta ...

随机推荐

  1. java 泛型中class<T> 和T的区别是什么?

    public <T> boolean edit(T entity) 和public <T> T get(Class<T> c, Serializable id)中这 ...

  2. 找不到dubbo:annotaion错误

    dubbo 2.8.4 出现找不到dubbo:annotation的错误,其实这个不会影响程序正确的运行,但是看到有红叉心里肯定非常不爽: 解决办法是,将dubbo-2.8.4.jar包,后缀改成.z ...

  3. 本地搭建 Gradle 服务器,提高 Android Studio Gradle 下载速度

    AndroidStudio 更新以后,在公司网会卡在下载 Gradle 的地方,下载 Gradle 速度很慢. 看到别人的博客提供的解决办法本地搭建一个 Gradle 的服务器,然后把 Android ...

  4. centos 7 安装python3和pip

    目前,我认为还是使用系统自带的稳定版最好,因为:该版本肯定是centos7开发组深思熟虑的,稳定性好,另外,由于系统自带,兼容性好,第三,和之配套的软件齐全,如果不用系统的,建议还是不要在源码编译安装 ...

  5. Atitti html5 h5 新特性attilax总结

    Atitti html5 h5 新特性attilax总结 Attilax觉得不错的新特性 3.语义Header和Footer (The Semantic Header and Footer) 8.占位 ...

  6. 【Unity】6.8 Quaternion类(四元数)

    分类:Unity.C#.VS2015 创建日期:2016-04-20 一.四元数的概念 四元数包含一个标量分量和-个三维向量分量,四元数Q可以记作: Q=[w,(x,y,z)] 在3D数学中使用单位四 ...

  7. HTML5学习笔记(十五):方法

    在一个对象中绑定函数,称为这个对象的方法. 在JavaScript中,对象的定义是这样的: var xiaoming = { name: '小明', birth: 1990 }; 但是,如果我们给xi ...

  8. Java 虚拟机类加载器

    虚拟机设计团队把类加载阶段张的”通过一个类的全限定名来获取此类的二进制字节流”这个动作放到Java虚拟机外部去实现,以便让应用程序自己决定如何去获取所需要的类.实现这个动作的代码模块称为”类加载器”. ...

  9. 微信JSAPI 公众号支付 H5支付以及APP支付 WEBAPI接口开发测试

    统一下单入口 调用该方法入口: public void WxPayAPI() { //string PayPrice ="99.9"; ////订单号 //string Payor ...

  10. Oracle根据表生成系统流水号

    1.建表tablewater create table TABLEWATER ( tb_id INTEGER not null, vc_table_name ), num_water_no ) )vc ...