PCL可视化概述(PCL Visualization overview)

这篇是学习过程,对PCL官网,以及《点云库PCL学习教程》的学习与研究。

网址:http://pointclouds.org/documentation/overview/visualization.php

 

PCL可视化库,其创建目的是对通过算法来计算三维点云数据后得到的结果进行快速地复原与可视化。类似于OpenCV的highgui程序,用来在屏幕上展示二维图像或者二维形状。

 

PCL可视化库提供一下功能:

◆通过改变pcl::PointCloud<T> 的格式,对任何n维点云数据集,都能够描述和设置可视化属性(颜色、点大小、透明性等等);

 

◆无论是点的集合,还是有参数的方程,都可在屏幕上绘出基本三维形状(例如圆筒、球体、线、多边形物体等等);

 

 

◆运用PCLHistogramVisualizer将一个可视化柱状图模型构建为二维坐标系;

 

◆通过pcl::PointCloud<T>处理数据集,可实现多种几何与色彩表示方法;

 


◆一个pcl::RangeImage可视化模型;

文件包为描绘三维模型,利用VTK库来实现一系列图像以及二维操作。为加深你对可视化的理解,运用库来学习与实践以下的例子。

 


简单的云图可视化

如果你只想运用几行代码就能在你程序中对某物实现可视化,可以尝试如下几个简短的代码:

#include <pcl_visualization/cloud_viewer.h> //... void foo () {   pcl::PointCloud<pcl::PointXYZRGB> cloud;   //... populate cloud   pcl_visualization::CloudViewer viewer("Simple Cloud Viewer");   viewer.showCloud(cloud);   while (!viewer.wasStopped())   {   } }



PCD Viewer

使用pcd_viewer可以快速的可视化PCD文件。对于pcd_viewer 0.2.7,帮助文档如下文:

Syntax is: pcd_viewer <file_name 1..N>.pcd <options>where options are:   -bc r,g,b        = background color   -fc r,g,b        = foreground color   -ps X            = point size (1..64)   -opaque X        = rendered point cloud opacity (0..1)   -ax n          = enable on-screen display of XYZ axes and scale them to n   -ax_pos X,Y,Z       = if axes are enabled, set their X,Y,Z position in space (default 0,0,0)    -cam (*)                 = use given camera settings as initial view (*) [Clipping Range / Focal Point / Position / ViewUp / Distance / Window Size / Window Pos] or use a <filename.cam> that contains the same information.   -multiview 0/1     = enable/disable auto-multi viewport rendering (default disabled)    -normals 0/X      = disable/enable the display of every Xth point's surface normal as lines (default disabled)     -normals_scale X      = resize the normal unit vector size to X (default 0.02)     -pc 0/X       = disable/enable the display of every Xth point's principal curvatures as lines (default disabled)     -pc_scale X      = resize the principal curvatures vectors size to X (default 0.02)(Note: for multiple .pcd files, provide multiple -{fc,ps} parameters; they will be automatically assigned to the right file)



 

 

Usage examples

 

<span style="font-size:18px;">$pcd_viewer-multiview 1 data/partial_cup_model.pcd data/partial_cup_model.pcd data/partial_cup_model.pcd</span>


上面的代码将会加载partial_up_model.pcd三次,并将参数多视图角度(multiview 1

 

在点云开启过程中,按下h,可以获得帮助条令:

| Help:-------    p, P   : switch to a point-based representation    w, W   : switch to a wireframe-based representation (where available)    s, S   : switch to a surface-based representation (where available)    j, J   : take a .PNG snapshot of the current window view    c, C   : display current camera/window parameters    + / -   : increment/decrement overall point size    g, G   : display scale grid (on/off)    u, U   : display lookup table (on/off)    r, R [+ ALT] : reset camera [to viewpoint = {0, 0, 0} -> center_{x, y, z}]    ALT + s, S   : turn stereo mode on/off    ALT + f, F   : switch between maximized window mode and original size    l, L         : list all available geometric and color handlers for the current actor map    ALT + 0..9 [+ CTRL]  : switch between different geometric handlers (where available)          0..9 [+ CTRL]  : switch between different color handlers (where available)


 

 

按1将会现实当前可用几何/颜色设置,例如以下:

<span style="font-size:18px;">List of available geometry handlers for actor partial_cup_model.pcd-0: xyz(1) normal_xyz(2)List of available color handlers for actor partial_cup_model.pcd-0: [random](1) x(2) y(3) z(4) normal_x(5) normal_y(6) normal_z(7) curvature(8) boundary(9) k(10) principal_curvature_x(11) principal_curvature_y(12) principal_curvature_z(13) pc1(14) pc2(15)</span>


 

转到normal_xyz几何操作可用ALT+1,然后按8可开启曲面颜色控制,其结果如下:

<span style="font-size:18px;">$ pcd_viewer -normals 100 data/partial_cup_model.pcd</span>



 

使用下面命令,可加载partial_cup_model.pcd,然后展示100个曲面法线在屏幕上。

<span style="font-size:18px;">$ pcd_viewer -pc 100 data/partial_cup_model.pcd</span>


 

上面将会加载partial_up_model.pcd,然后将会在屏幕上找色每100个主曲率(+surface normal)。

 

<span style="font-size:18px;"><span style="font-family: Arial, Helvetica, sans-serif;">$ pcd_viewer data/bun000.pcd data/bun045.pcd -ax 0.5 -ps 3 -ps 1</span></span>


对于已下载的bun000.pcd和bun045.pcd的利用,下面图片中,用u和g能分别展示the lookup table和on-grid display。

 


Range Image Visualizer

快速可视化序列图像,可以用range_image_visualization的二进制代码:

<span style="font-size:18px;">$ tutorial_range_image_visualization data/office_scene.pcd</span>

以上会加载office_scene.pcd点云文件,从中创建一个序列图像并且将其可视化,无论是点云还是序列图片。

  • 0
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值