可视化(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. 微信小程序,开发中几个重要的知识点(加密解密,转发,进入场景,session_key)

    小程序的授权信息:https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html 小程序的 ...

  2. talend 连接mysql数据库没有权限

    使用talend连接一个mysql数据库,提示没有权限,最后发现mysql服务器的配置中只监听了127.0.0.1的端口,拒绝非本地的请求.通过将/etc/mysql/my.cnf中的bind_add ...

  3. php分享三十二:php调试工具

    一:phpdbg http://phpdbg.com/

  4. shouldAutoRotate Method Not Called in iOS6

    转自:http://stackoverflow.com/questions/13588325/shouldautorotate-method-not-called-in-ios6 参考1:http:/ ...

  5. 正确安全清空在线慢查询日志slow log的流程

    查看慢查询日志的状态: mysql> show variables like '%slow%'; +---------------------+------------------------- ...

  6. sql server FCI and always on

    https://docs.microsoft.com/en-us/sql/sql-server/failover-clusters/high-availability-solutions-sql-se ...

  7. 6 Multi-Cloud Architecture Designs for an Effective Cloud

    https://www.simform.com/multi-cloud-architecture/ Enterprises increasingly want to take advantage of ...

  8. [Windows Azure] How to use the Windows Azure Blob Storage Service in .NET

    How to use the Windows Azure Blob Storage Service in .NET version 1.7 version 2.0 This guide will de ...

  9. 每日英语:The Benefits of a Better Men's T-Shirt

    "I WEAR A T-shirt and jeans every single day," said Erik Schnakenberg, 30, co-founder of t ...

  10. 基于tcpdump的Android智能移动终端数据包捕获完整解决方案

    如何在Android智能手机上捕获数据包? 本文由CSDN-蚍蜉撼青松[主页:http://blog.csdn.net/howeverpf]原创,转载请注明出处! 当前Android系统越来越流行,无 ...