PCL学习笔记(1):pcl1.6.0+vs2010环境配置以及第一个pcl程序

//捣腾了一天,终于算是看到点希望了。

一、准备

(本文的环境配置不需要CMake)

1.vs2010 (本人使用的是32位)

2.pcl 安装包:All-in-one installers(点击下载)选择PCL 1.6.0 All-In-One Installer

3.PDB:在上面的下载页面选择PDB files

二、安装

1.安装vs 2010

2.安装 pcl 安装包(最好不要更改安装路径,否则会影响后面的环境配置和工程配置)

等也是自动安装好。

【安装好即可,不要修改路径】

3.PDB files解压后,将所有pdb文件复制到:C:\Program Files\PCL 1.6.0\bin

三、环境变量配置

添加环境变量PCL_ROOT

C:\Program Files\PCL 1.6.0

然后在path环境变量下添加:

C:\Program Files\OpenNI\Bin;%PCL_ROOT%\bin;%PCL_ROOT%\3rdParty\FLANN\bin;%PCL_ROOT%\3rdParty\Qhull\bin;

四、新建工程

//很多程序可以去point cloud library官网下载

main.cpp

#include <pcl/visualization/cloud_viewer.h>#include <iostream>#include <pcl/io/io.h>#include <pcl/io/pcd_io.h>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 = 0;o.z = 0;viewer.addSphere (o, 0.25, "sphere", 0);std::cout << "i only run once" << std::endl;}void viewerPsycho (pcl::visualization::PCLVisualizer& viewer){static unsigned count = 0;std::stringstream ss;ss << "Once per viewer loop: " << count++;viewer.removeShape ("text", 0);viewer.addText (ss.str(), 200, 300, "text", 0);//FIXME: possible race condition here:user_data++;}int main (){pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGBA>);pcl::io::loadPCDFile ("my_point_cloud.pcd", *cloud);pcl::visualization::CloudViewer viewer("Cloud Viewer");//blocks until the cloud is actually renderedviewer.showCloud(cloud);//use the following functions to get access to the underlying more advanced/powerful//PCLVisualizer//This will only get called onceviewer.runOnVisualizationThreadOnce (viewerOneOff);//This will get called once per visualization iterationviewer.runOnVisualizationThread (viewerPsycho);while (!viewer.wasStopped ()){//you can also do cool processing here//FIXME: Note that this is running in a separate thread from viewerPsycho//and you should guard against race conditions yourself…user_data++;}return 0;}五、工程配置【Debug】

1.项目–>属性–>配置属性–>VC++目录–>包含目录 //注意检查自己的路径是否正确

添加:

C:\Program Files\PCL 1.6.0\3rdParty\Boost\includeC:\Program Files\PCL 1.6.0\3rdParty\Eigen\includeC:\Program Files\PCL 1.6.0\3rdParty\FLANN\includeC:\Program Files\PCL 1.6.0\3rdParty\Qhull\includeC:\Program Files\PCL 1.6.0\3rdParty\VTK\include\vtk-5.8C:\Program Files\PCL 1.6.0\include\pcl-1.6C:\Program Files\OpenNI\Include

2.项目–>属性–>配置属性–>VC++目录–>库目录 //注意检查自己的路径是否正确

添加:

C:\Program Files\PCL 1.6.0\3rdParty\Boost\libC:\Program Files\PCL 1.6.0\3rdParty\Qhull\libC:\Program Files\PCL 1.6.0\3rdParty\FLANN\libC:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8C:\Program Files\PCL 1.6.0\libC:\Program Files\OpenNI\Lib3.项目–>属性–>配置属性–>链接器–>输入->附加依赖项 //注意检查自己的路径是否正确

添加:

opengl32.libpcl_kdtree_debug.libpcl_io_debug.libpcl_search_debug.libpcl_segmentation_debug.libpcl_apps_debug.libpcl_features_debug.libpcl_filters_debug.libpcl_visualization_debug.libpcl_common_debug.libflann_cpp_s-gd.liblibboost_system-vc100-mt-gd-1_47.liblibboost_filesystem-vc100-mt-gd-1_47.liblibboost_thread-vc100-mt-gd-1_47.liblibboost_date_time-vc100-mt-gd-1_47.liblibboost_iostreams-vc100-mt-gd-1_47.libvtkalglib-gd.libvtkCharts-gd.libvtkCommon-gd.libvtkDICOMParser-gd.libvtkexoIIc-gd.libvtkexpat-gd.libvtkFiltering-gd.libvtkfreetype-gd.libvtkftgl-gd.libvtkGenericFiltering-gd.libvtkGeovis-gd.libvtkGraphics-gd.libvtkhdf5-gd.libvtkHybrid-gd.libvtkImaging-gd.libvtkInfovis-gd.libvtkIO-gd.libvtkjpeg-gd.libvtklibxml2-gd.libvtkmetaio-gd.libvtkNetCDF-gd.libvtkNetCDF_cxx-gd.libvtkpng-gd.libvtkproj4-gd.libvtkRendering-gd.libvtksqlite-gd.libvtksys-gd.libvtktiff-gd.libvtkverdict-gd.libvtkViews-gd.libvtkVolumeRendering-gd.libvtkWidgets-gd.libvtkzlib-gd.lib此时环境配置已经结束,在程序有一句函数,加载了一个pcd文件。 pcl::io::loadPCDFile ("my_point_cloud.pcd", *cloud);六、添加my_point_cloud.pcd文件可以提高你的水平。(戏从对手来。

PCL学习笔记(1):pcl1.6.0+vs2010环境配置以及第一个pcl程序

相关文章:

你感兴趣的文章:

标签云: