pcl1.8.0 vs2013 win10 x64 安装配置及部分问题解决方法

转自:

https://blog.csdn.net/u012750702/article/details/53046210

主要参考博客:

http://www.zhangzscn.com/2016/03/02/pcl1-8-0%EF%BC%8Cvs2013%E9%85%8D%E7%BD%AE%E6%95%99%E7%A8%8B%E3%80%82/

http://www.cnblogs.com/newpanderking/articles/4022322.html

http://blog.csdn.net/otones/article/details/45138211

感谢作者~

环境:

win 10 x64

visual studio 2013

一、准备工作

首先下载需要的文件,

从第一个参考博客作者给出的百度网盘中下载需要版本的.exe安装程序,属性表,包含pdb文件的压缩包,如图:

http://pan.baidu.com/s/1c1sqoQO

这里以x64为例。

二、安装

1、双击安装包,安装的时候注意选上“Add PCL to the system PATH for all users”,如图所示,这样安装程序会自动在系统环境变量中添加"PCL_ROOT"项

以下具体内容都以我的安装路径为例:

2、安装的过程中会弹出OpenNI的安装程序,将OpenNI的安装路径设置为PCL ROOT下3rdParty\OpenNI2文件夹,例:

E:\Programming_win\PCL\PCL 1.8.0\3rdParty\OpenNI2

(这里可以选择安装在其他目录不过会影响到项目配置)

3、安装程序执行完成后将pdb文件压缩包解压(即 PCL-1.8.0-AllInOne-msvc2013-win64-pdb.rar),pdb文件拷贝到PCL ROOT下的bin文件夹中,例:

E:\Programming_win\PCL\PCL 1.8.0\bin

三、环境变量

上面说过了安装程序会自动添加PCL_ROOT到系统环境变量中,此外还要手动添加PCL、Qhull、FLANN、VTK、OpenNI2的bin目录到PATH中,  

例:

注意如果安装程序没有自动添加PCL_ROOT则需要手动添加(如上图)。

四、项目配置

1、在vs2013中新建项目,

     注意vs2013中Configuration Manager(配置管理器)默认Active solution plantform(活动平台)是Win32,如果安装的是x64的PCL需要将其改成x64,否则编译的时候会出现奇怪的问题。

2、Solution Explorer(解决方案管理器)中右键项目->Properties(属性)

 Configuration Properties(配置管理器)->C/C++->Preprocessor(预处理器)->Preprocessor Definitions(预处理定义) 中添加如下两项:

_SCL_SECURE_NO_WARNINGS
_CRT_SECURE_NO_WARNINGS

3、Property Manager(属性管理器)中,

     Property Manager与Solution Explorer在同一个tab布局中,如果没找到的话,

菜单栏的VIEW(视图)->Other Windows(其他窗口)->Property Manager(属性管理器)

接下来右键每个以Debug或Release开头的文件夹(这里的可能跟我的不一样),Add Existing Property Sheet,选择下载下来的属性表文件(PCLDebug.props或PCLRelease.props),debug就选debug,release就选release。

五、测试代码

直接在工程中添加main.cpp文件后编译运行如下代码,

代码来自博客http://blog.csdn.net/otones/article/details/45138211,感谢博主~

 
  1. #include <pcl/visualization/cloud_viewer.h>

  2. #include <iostream>

  3. #include <pcl/io/io.h>

  4. #include <pcl/io/pcd_io.h>

  5.  
  6. int user_data;

  7.  
  8. void viewerOneOff(pcl::visualization::PCLVisualizer& viewer)

  9. {

  10. viewer.setBackgroundColor(1.0, 0.5, 1.0);

  11. pcl::PointXYZ o;

  12. o.x = 1.0;

  13. o.y = 0;

  14. o.z = 0;

  15. viewer.addSphere(o, 0.25, "sphere", 0);

  16. std::cout << "i only run once" << std::endl;

  17.  
  18. }

  19.  
  20. void viewerPsycho(pcl::visualization::PCLVisualizer& viewer)

  21. {

  22. static unsigned count = 0;

  23. std::stringstream ss;

  24. ss << "Once per viewer loop: " << count++;

  25. viewer.removeShape("text", 0);

  26. viewer.addText(ss.str(), 200, 300, "text", 0);

  27.  
  28. //FIXME: possible race condition here:

  29. user_data++;

  30. }

  31.  
  32. int main()

  33. {

  34. pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZRGBA>);

  35. pcl::io::loadPCDFile("my_point_cloud.pcd", *cloud);

  36.  
  37. pcl::visualization::CloudViewer viewer("Cloud Viewer");

  38.  
  39.  
  40.  
  41. //blocks until the cloud is actually rendered

  42. viewer.showCloud(cloud);

  43.  
  44. //use the following functions to get access to the underlying more advanced/powerful

  45. //PCLVisualizer

  46.  
  47. //This will only get called once

  48. viewer.runOnVisualizationThreadOnce(viewerOneOff);

  49.  
  50. //This will get called once per visualization iteration

  51. viewer.runOnVisualizationThread(viewerPsycho);

  52. while (!viewer.wasStopped())

  53. {

  54. //you can also do cool processing here

  55. //FIXME: Note that this is running in a separate thread from viewerPsycho

  56. //and you should guard against race conditions yourself...

  57. user_data++;

  58. }

  59. return 0;

  60. }

出现如下图所示则说明没有问题,配置成功:

六、小问题

出现类似无法启动此程序,因为计算机中丢失xxx.dll的问题,

首先检查该文件存不存在,若PCL ROOT下没有找到该文件则说明安装出现问题或者链接出现问题(比如卸载重装过PCL但是链接仍指向原有目录)。

若能找到该文件,则返回第三步,仔细检查环境变量的配置,包括配置是否正确及是否有卸载后的残留。

猜你喜欢

转载自blog.csdn.net/qq_38446366/article/details/81704181