pcl点云库pcl教程 pdf软件安装需要vs的版本是64位的吗

《PCL点云库学习&VS2010(X64)》Part 42 OCtreeViewer - 梁的博客 - CSDN博客
《PCL点云库学习&VS2010(X64)》Part 42 OCtreeViewer
《PCL点云库 C++ 》
《PCL点云库学习&VS2010(X64)》Part 42 OCtreeViewer
1、八叉树可视化
主要是八叉树可视化,官方教程中有一个八叉树栅格可视化的例程,很多时候见过,但却不知道在哪里,怎么用,下面直接贴代码:
* Software License Agreement (BSD License)
Copyright (c) 2010, Willow Garage, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of the copyright holder(s) nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
&AS IS& AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
\author Raphael Favier
#include &pcl/io/pcd_io.h&
#include &pcl/common/time.h&
#include &pcl/visualization/pcl_visualizer.h&
#include &pcl/visualization/point_cloud_handlers.h&
#include &pcl/visualization/common/common.h&
#include &pcl/octree/octree.h&
#include &pcl/octree/octree_impl.h&
#include &pcl/filters/filter.h&
#include &boost.h&
#include &vtkRenderer.h&
#include &vtkRenderWindow.h&
#include &vtkCubeSource.h&
//=============================
// Displaying cubes is very long!
// so we limit their numbers.
const int MAX_DISPLAYED_CUBES(15000);
//=============================
class OctreeViewer
OctreeViewer (std::string &filename, double resolution) :
viz (&Octree visualizator&), cloud (new pcl::PointCloud&pcl::PointXYZ&()),
displayCloud (new pcl::PointCloud&pcl::PointXYZ&()), octree (resolution), displayCubes(false),
showPointsWithCubes (false), wireframe (true)
//try to load the cloud
if (!loadCloud(filename))
//register keyboard callbacks
viz.registerKeyboardCallback(&OctreeViewer::keyboardEventOccurred, *this, 0);
//key legends
viz.addText(&Keys:&, 0, 170, 0.0, 1.0, 0.0, &keys_t&);
viz.addText(&a -& Increment displayed depth&, 10, 155, 0.0, 1.0, 0.0, &key_a_t&);
viz.addText(&z -& Decrement displayed depth&, 10, 140, 0.0, 1.0, 0.0, &key_z_t&);
viz.addText(&d -& Toggle Point/Cube representation&, 10, 125, 0.0, 1.0, 0.0, &key_d_t&);
viz.addText(&x -& Show/Hide original cloud&, 10, 110, 0.0, 1.0, 0.0, &key_x_t&);
viz.addText(&s/w -& Surface/Wireframe representation&, 10, 95, 0.0, 1.0, 0.0, &key_sw_t&);
//set current level to half the maximum one
displayedDepth = static_cast&int& (floor (octree.getTreeDepth() / 2.0));
if (displayedDepth == 0)
displayedDepth = 1;
//show octree at default depth
extractPointsAtLevel(displayedDepth);
//reset camera
viz.resetCameraViewpoint(&cloud&);
//run main loop
//========================================================
// PRIVATE ATTRIBUTES
//========================================================
//visualizer
pcl::PointCloud&pcl::PointXYZ&::P
pcl::PointCloud&pcl::PointXYZRGB&::Ptr xyz_
pcl::visualization::PCLV
//original cloud
pcl::PointCloud&pcl::PointXYZ&::P
//displayed_cloud
pcl::PointCloud&pcl::PointXYZ&::Ptr displayC
pcl::octree::OctreePointCloudVoxelCentroid&pcl::PointXYZ&
int displayedD
//bool to decide if we display points or cubes
bool displayCubes, showPointsWithCubes,
//========================================================
/* \brief Callback to interact with the keyboard
void keyboardEventOccurred(const pcl::visualization::KeyboardEvent &event, void *)
if (event.getKeySym() == &a& && event.keyDown())
IncrementLevel();
else if (event.getKeySym() == &z& && event.keyDown())
DecrementLevel();
else if (event.getKeySym() == &d& && event.keyDown())
displayCubes = !displayC
else if (event.getKeySym() == &x& && event.keyDown())
showPointsWithCubes = !showPointsWithC
else if (event.getKeySym() == &w& && event.keyDown())
if(!wireframe)
wireframe=
else if (event.getKeySym() == &s& && event.keyDown())
if(wireframe)
wireframe=
/* \brief Graphic loop for the viewer
void run()
while (!viz.wasStopped())
//main loop of the visualizer
viz.spinOnce(100);
boost::this_thread::sleep(boost::posix_time::microseconds(100000));
/* \brief Helper function that read a pointcloud file (returns false if pbl)
Also initialize the octree
bool loadCloud(std::string &filename)
std::cout && &Loading file & && filename.c_str() && std::
//read cloud
if (pcl::io::loadPCDFile(filename, *cloud))
std::cerr && &ERROR: Cannot open file & && filename && &! Aborting...& && std::
//remove NaN Points
std::vector&int& nanI
pcl::removeNaNFromPointCloud(*cloud, *cloud, nanIndexes);
std::cout && &Loaded & && cloud-&points.size() && & points& && std::
//create octree structure
octree.setInputCloud(cloud);
//update bounding box automatically
octree.defineBoundingBox();
//add points in the tree
octree.addPointsFromInputCloud();
/* \brief Helper function that draw info for the user on the viewer
void showLegend(bool showCubes)
char dataDisplay[256];
sprintf(dataDisplay, &Displaying data as %s&, (showCubes) ? (&CUBES&) : (&POINTS&));
viz.removeShape(&disp_t&);
viz.addText(dataDisplay, 0, 60, 1.0, 0.0, 0.0, &disp_t&);
char level[256];
sprintf(level, &Displayed depth is %d on %d&, displayedDepth, octree.getTreeDepth());
viz.removeShape(&level_t1&);
viz.addText(level, 0, 45, 1.0, 0.0, 0.0, &level_t1&);
viz.removeShape(&level_t2&);
sprintf(level, &Voxel size: %.4fm [%lu voxels]&, sqrt(octree.getVoxelSquaredSideLen(displayedDepth)),
displayCloud-&points.size());
viz.addText(level, 0, 30, 1.0, 0.0, 0.0, &level_t2&);
viz.removeShape(&org_t&);
if (showPointsWithCubes)
viz.addText(&Displaying original cloud&, 0, 15, 1.0, 0.0, 0.0, &org_t&);
/* \brief Visual update. Create visualizations and add them to the viewer
void update()
//remove existing shapes from visualizer
clearView();
//prevent the display of too many cubes
bool displayCubeLegend = displayCubes && static_cast&int& (displayCloud-&points.size ()) &= MAX_DISPLAYED_CUBES;
showLegend(displayCubeLegend);
if (displayCubeLegend)
//show octree as cubes
showCubes(sqrt(octree.getVoxelSquaredSideLen(displayedDepth)));
if (showPointsWithCubes)
//add original cloud in visualizer
pcl::visualization::PointCloudColorHandlerGenericField&pcl::PointXYZ& color_handler(cloud, &z&);
viz.addPointCloud(cloud, color_handler, &cloud&);
//add current cloud in visualizer
pcl::visualization::PointCloudColorHandlerGenericField&pcl::PointXYZ& color_handler(displayCloud,&z&);
viz.addPointCloud(displayCloud, color_handler, &cloud&);
/* \brief remove dynamic objects from the viewer
void clearView()
//remove cubes if any
vtkRenderer *renderer = viz.getRenderWindow()-&GetRenderers()-&GetFirstRenderer();
while (renderer-&GetActors()-&GetNumberOfItems() & 0)
renderer-&RemoveActor(renderer-&GetActors()-&GetLastActor());
//remove point clouds if any
viz.removePointCloud(&cloud&);
/* \brief Create a vtkSmartPointer object containing a cube
vtkSmartPointer&vtkPolyData& GetCuboid(double minX, double maxX, double minY, double maxY, double minZ, double maxZ)
vtkSmartPointer&vtkCubeSource& cube = vtkSmartPointer&vtkCubeSource&::New();
cube-&SetBounds(minX, maxX, minY, maxY, minZ, maxZ);
return cube-&GetOutput();
/* \brief display octree cubes via vtk-functions
void showCubes(double voxelSideLen)
//get the renderer of the visualizer object
vtkRenderer *renderer = viz.getRenderWindow()-&GetRenderers()-&GetFirstRenderer();
vtkSmartPointer&vtkAppendPolyData& treeWireframe = vtkSmartPointer&vtkAppendPolyData&::New();
double s = voxelSideLen / 2.0;
for (i = 0; i & displayCloud-&points.size(); i++)
double x = displayCloud-&points[i].x;
double y = displayCloud-&points[i].y;
double z = displayCloud-&points[i].z;
#if VTK_MAJOR_VERSION & 6
treeWireframe-&AddInput(GetCuboid(x - s, x + s, y - s, y + s, z - s, z + s));
treeWireframe-&AddInputData (GetCuboid (x - s, x + s, y - s, y + s, z - s, z + s));
vtkSmartPointer&vtkActor& treeActor = vtkSmartPointer&vtkActor&::New();
vtkSmartPointer&vtkDataSetMapper& mapper = vtkSmartPointer&vtkDataSetMapper&::New();
#if VTK_MAJOR_VERSION & 6
mapper-&SetInput(treeWireframe-&GetOutput());
mapper-&SetInputData (treeWireframe-&GetOutput ());
treeActor-&SetMapper(mapper);
treeActor-&GetProperty()-&SetColor(1.0, 1.0, 1.0);
treeActor-&GetProperty()-&SetLineWidth(2);
if(wireframe)
treeActor-&GetProperty()-&SetRepresentationToWireframe();
treeActor-&GetProperty()-&SetOpacity(0.35);
treeActor-&GetProperty()-&SetRepresentationToSurface();
renderer-&AddActor(treeActor);
/* \brief Extracts all the points of depth = level from the octree
void extractPointsAtLevel(int depth)
displayCloud-&points.clear();
pcl::octree::OctreePointCloudVoxelCentroid&pcl::PointXYZ&::Iterator tree_
pcl::octree::OctreePointCloudVoxelCentroid&pcl::PointXYZ&::Iterator tree_it_end = octree.end();
pcl::PointXYZ
std::cout && &===== Extracting data at depth & && depth && &... & && std::
double start = pcl::getTime ();
for (tree_it = octree.begin(depth); tree_it!=tree_it_ ++tree_it)
Eigen::Vector3f voxel_min, voxel_
octree.getVoxelBounds(tree_it, voxel_min, voxel_max);
pt.x = (voxel_min.x() + voxel_max.x()) / 2.0f;
pt.y = (voxel_min.y() + voxel_max.y()) / 2.0f;
pt.z = (voxel_min.z() + voxel_max.z()) / 2.0f;
displayCloud-&points.push_back(pt);
double end = pcl::getTime ();
printf(&%lu pts, %.4gs. %.4gs./pt. =====\n&, displayCloud-&points.size (), end - start,
(end - start) / static_cast&double& (displayCloud-&points.size ()));
/* \brief Helper function to increase the octree display level by one
bool IncrementLevel()
if (displayedDepth & static_cast&int& (octree.getTreeDepth ()))
displayedDepth++;
extractPointsAtLevel(displayedDepth);
/* \brief Helper function to decrease the octree display level by one
bool DecrementLevel()
if (displayedDepth & 0)
displayedDepth--;
extractPointsAtLevel(displayedDepth);
int main(int argc, char ** argv)
if (argc != 3)
std::cerr && &ERROR: Syntax is octreeVisu &pcd file& &resolution&& && std::
std::cerr && &EXAMPLE: ./octreeVisu bun0.pcd 0.001& && std::
return -1;
std::string cloud_path(argv[1]);
OctreeViewer v(cloud_path, atof(argv[2]));
linux下的效果还是可以的,兔子的pcd格式数据太稀疏了,换成了car6.pcd这个数据。
该数据显示时可以用键盘上的d换成box模式,可以继续通过w/s来实现栅格和实体box的自由切换。
我的热门文章《PCL点云库 C++ 》(45)
《PCL点云库学习&VS2010(X64)》Part 20 PCL1.72(VTK6.2.0)PCL控制台程序线程
1、控制台中添加线程
#include &boost/thread/thread.hpp&
while (!viewer.wasStopped())
//在此处可以添加其他处理
viewer.spinOnce(100);
boost::this_thread::sleep(boost::posix_time::microseconds(100000));
view.spinOnce(10000);
//循环的次数
view.spin();
//无限循环
参考博客:
&&相关文章推荐
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:115764次
积分:2565
积分:2565
排名:第15582名
原创:140篇
转载:21篇
评论:72条
(2)(1)(3)(4)(2)(2)(6)(12)(3)(8)(3)(4)(14)(10)(21)(6)(5)(9)(5)(13)(23)(6)
(window.slotbydup = window.slotbydup || []).push({
id: '4740887',
container: s,
size: '250,250',
display: 'inlay-fix'查看: 815|回复: 6
注册时间最后登录阅读权限20积分69精华0帖子
注册会员, 积分 69, 距离下一级还需 131 积分
大家好,我现在在学习PCL的应用,刚开始入门遇到了一个问题,希望得到大家的帮助
OS&&:win7&&64bit
VS :&&2010& &
但是我在用Cmake时在选择编译器时,选择2010&&win&&64 则会出现 错误,但是用 2010 (不带win 64)则可以通过另外,用2010 IA64也是可以通过的,这是因为什么呢?
用2010&&win&&64生成的文件打开编译后会出现:
而用2010 IA64则会有下面的情况出现:
请问大家有知道原因的吗?谢谢
本帖子中包含更多资源
才可以下载或查看,没有帐号?
注册时间最后登录阅读权限30积分268精华0帖子
中级会员, 积分 268, 距离下一级还需 232 积分
我系统64位,配置的时候就是选择的Visual Studio 10 2010,编译能够通过,现在用着也都正常,觉得没有必要纠结这些
注册时间最后登录阅读权限20积分69精华0帖子
注册会员, 积分 69, 距离下一级还需 131 积分
多谢,那你一般都是直接用IDE呢还是自己写CMakeList.txt然后借助Cmake呢
注册时间最后登录阅读权限30积分268精华0帖子
中级会员, 积分 268, 距离下一级还需 232 积分
我是直接在vs2010下写的,感觉比较方便点,要不还得自己写CMakeList.txt
注册时间最后登录阅读权限10积分28精华0帖子
新手上路, 积分 28, 距离下一级还需 22 积分
LZ你好,我也遇到了您一样的问题,你最后是怎样解决的呢?
注册时间最后登录阅读权限20积分69精华0帖子
注册会员, 积分 69, 距离下一级还需 131 积分
李俗 发表于
LZ你好,我也遇到了您一样的问题,你最后是怎样解决的呢?
你好,我是这样解决的,我的系统是64位的,但是用的PCL是32位的,同时在vs2010中是直接用的Debug模式Win32,这样就可以了。我没有用Cmake软件来生成相应的工程文件,因为有网友说Cmake只能根据自己的系统的位数生成相应的工程文件,也就是说如果你的系统是64位的那么你用Cmake则只能生成64位对应的工程文件,这样你用vs2010打开后编译的话如果你的库是64位同时各种库目录和包含目录都设置正确的话应该是可以的。我也刚开始学习,可能有答的不是很到位的地方,不过你可以试试。
注册时间最后登录阅读权限20积分69精华0帖子
注册会员, 积分 69, 距离下一级还需 131 积分
Roy 发表于
我是直接在vs2010下写的,感觉比较方便点,要不还得自己写CMakeList.txt
谢谢你,我明白了
Powered by108被浏览13064分享邀请回答1316 条评论分享收藏感谢收起313 条评论分享收藏感谢收起查看更多回答+ VS2013 + PCL 1.7.2 配置的一些问题 - CSDN博客
+ VS2013 + PCL 1.7.2 配置的一些问题
项目要用的PCL,我的系统是64位, 使用的是VS2013,64位
现在官网上还没有适用 VS2013的版本,在论坛里找到了有人翻墙搞到的PCL 1.7.2,其中有32位版本,也有64位版本
由于我的系统和vs2013都是64位的,于是就想当然的下载了PCL-1.7.2-AllInOne-msvc2013-win64,然后安装配置了,再使用一个简单的示例程序来检查是否配置成功,结果出现一堆的连接错误:error LNK2019: 无法解析的外部符号 “public: void __thiscall ,网上找了很多方法都没解决。
最后师兄告诉我,因为建立的是32位的工程,所以应该配置32位的PCL。于是就下载了32位版本的,并且安装配置了,重新运行的时候又出现了错误:应用程序无法正常启动(0xc00007b),又google了一下,试了几个解决方案都无效,然后我想应该是32位版本的和64位版本的有冲突吧,就使用PCL 1.7.2中自带的卸载程序卸载了64位版本
然后再重新编译,结果错误:应用程序无法正常启动(0xc00007b)消失了,不过新出现了一个错误:缺失文件vtkCommonColor-6.2-gd.lib,因为我把64位版本删除了,结果出现这个问题,一定是32版本的安装之后配置没有成功,这时就想起来了,我安装了32位版本,然后重新配置了系统变量,但是没有重启计算机,结果就重新试了一下,果然成功了,重新配置环境变量的话,是需要重启计算机的!
我的PCL1.7.2的安装包以及配置方法以及示例程序都是来自这篇博客:
在这里对博主表示感谢!
下面是我的运行结果:
本文已收录于以下专栏:
相关文章推荐
计算机视觉、机器学习相关领域论文和源代码大集合--持续更新……
http://blog.csdn.net/zouxy09
注:下面有project网站的大部分...
感谢Tsuksa Sugiura本文使用的安装程序已搬运到墙内
百度云链接 密码:hsw1
1.7.2 release
Windows10下VS2013+PCL1.8环境配置刚换了机子配PCL,Windows下配环境实在是太蛋疼了,上次没有记录配置的过程,所以又得各种搜教程,关键是很多博客上写的教程都不对啊!!!不知道...
本教程以win8,vs2013环境为例,介绍了PCL1.7.2的安装方法,其它环境也可以参考本教程。PCL安装分为两种方法,第一种,直接从PCL源代码编译,后安装;第二种,使用PCL的All-in-o...
本文档是VS2013+PCL1.7.2的环境配置
1、首先注意,以下所有软件都装32位的!
2、关掉360安全卫士,否则将会出现很多安装提示;
3、安装OpenNI,必须在PCL官网下载的;(建议装在...
新项目是3D重建,最近都在查资料看论文,关于生成3D点云,特征检测,点云匹配,曲面重建等等。有篇知乎写得不错,讲了实现3D重建的相关体系和方法。不过我也是从那里面得到了启发,方法和里面也不太相同,因为...
PCL+VS2010环境配置
我本是效率至上的Linux党,但是PCL在Ubuntu下配置了几次都失败,不得不选择Windows
http://www.pointclouds....
PCL 作为一个优秀的点云类开源库集成了大量先进的点云处理算法,值得LiDAR工作者研究学习。从最初使用PCL1.6版本到1.7再到1.8,已经经历了几个年头,PCL中的算法也再不断更新完善。现在重写...
win10 x64下visual studio 2013 的 PCL 安装及配置过程,过程中可能出现的小问题解决方法
他的最新文章
您举报文章:
举报原因:
原文地址:
原因补充:
(最多只允许输入30个字)

我要回帖

更多关于 pcl点云库 的文章

 

随机推荐