亲宝软件园·资讯

展开

pcl1.8.0 vs2013配置

BOO2018 人气:0

最近开始学习pcl,经过几天的捣鼓终于将pcl1.8.0和vs2013的环境搭建起来。

准备

pcl版本:PCL-1.8.0-AllInOne-msvc2013-win64

vs版本:vs2013

下载地址链接:链接: http://pan.baidu.com/s/1L6trLERkzylkBUjTw94RNQ?pwd=ep39   提取码: ep39 

因为我的电脑是64位的,所以只有64位版本。

安装

vs2013下载解压默认安装就好了。

PCL整个安装过程需要注意以下三点,其它默认即可(我是安装在D盘):

1. 安装路径最好不要包括中文;

2. 建议勾选上“Add PCL to the system PATH for all users”;

3. 安装时,会提示安装OpenNI,这个建议安装在PCL安装路径的3rdParty下的OpenNI2文件夹中。

安装完成之后将下载好的PCL-1.8.0-AllInOne-msvc2013-win64-pdb,pdb文件拷贝到PCL ROOT下的bin文件夹中,下图是拷贝后的样子

配置

我们打开vs2013新建一个c++控制台程序,选择空项目,去掉“预编译头(P)”前的勾,去掉“安全开发生命周期(SDL)检查(C)”前的勾,其它默认即可。

在进去之后我们可以看见调试器右边有一个Debug 和Win32,我们需要了解的是编译出的程序分成32位和64位,不同的位数需要不同的lib和dll才能编译出来,这就需要我们下载对应的pcl版本。不同的位数的程序分成Debug和Release,vs默认的是Debug。假若需要生产上面4中程序需要分别设置对应的项目属性表。

首先将属性管理器调出来

VS默认只生成32位的程序,32位的属性管理器中只有两项:Debug|Win32以及Release|Win32,

如果需要生成64的程序,方法如下:VS界面有个运行项,后面有个debug,在后面有个叫“解决方案平台”的下拉框,其值默认为win32,需要把win32,改成x64

,方法是,点win32的箭头,点“配置管理器”,点“活动解决方案平台”,点“新建”,把“键入或选择新平台”,这一项,切换为x64,然后确定,此时,原来的win32已变为x64。这时编译生成的程序就是64位版本的,相应的属性管理器中变成四项。

下面我们就可以在属性管理器中进行属性表的配置。选中其中一项,右键点击“添加新项目属性表”,在弹出的对话框里设置好对应的属性表名和路径。确认之后,在该项中就会多出一项以刚才属性表名为名称的属性表。

注:下面配置的是Debugx64的属性表!!!

在新建的属性表里,有三个必须设置的重要项目:附加包含目录,附加库目录,附加依赖项。

1. 附加包含目录,其在项目属性“C/C++”子项的“常规”里下,主要用来设置库的头文件路径。这里设置好PCL及第三方库的头文件路径。

D:\PCL 1.8.0\include\pcl-1.8
D:\PCL 1.8.0\3rdParty\Boost\include\boost-1_59
D:\PCL 1.8.0\3rdParty\Eigen\eigen3
D:\PCL 1.8.0\3rdParty\FLANN\include
D:\PCL 1.8.0\3rdParty\OpenNI2\Include
D:\PCL 1.8.0\3rdParty\Qhull\include

D:\PCL 1.8.0\3rdParty\VTK\include\vtk-7.0

2. 附加库目录,其在项目属性的“连接器”子项的“常规”下,主要用来设置库的lib文件路径。这里设置好设置PCL及第三方库的lib文件路径。

D:\PCL 1.8.0\lib

D:\PCL 1.8.0\3rdParty\Boost\lib

D:\PCL 1.8.0\3rdParty\FLANN\lib

D:\PCL 1.8.0\3rdParty\OpenNI2\lib

D:\PCL 1.8.0\3rdParty\Qhull\lib

D:\PCL 1.8.0\3rdParty\VTK\lib

3. 附加依赖项,其在项目属性的“连接器”子项的“输入”下,主要用来设置编译所需的lib。这里设置好设置PCL及第三方库的lib文件名。

直接复制下面就可以。

pcl_apps_debug.lib
pcl_common_debug.lib
pcl_features_debug.lib
pcl_filters_debug.lib
pcl_io_debug.lib
pcl_io_ply_debug.lib
pcl_kdtree_debug.lib
pcl_keypoints_debug.lib
pcl_ml_debug.lib
pcl_octree_debug.lib
pcl_outofcore_debug.lib
pcl_people_debug.lib
pcl_recognition_debug.lib
pcl_registration_debug.lib
pcl_sample_consensus_debug.lib
pcl_search_debug.lib
pcl_segmentation_debug.lib
pcl_simulation_debug.lib
pcl_stereo_debug.lib
pcl_surface_debug.lib
pcl_tracking_debug.lib
pcl_visualization_debug.lib
libboost_atomic-vc120-mt-gd-1_59.lib
libboost_chrono-vc120-mt-gd-1_59.lib
libboost_container-vc120-mt-gd-1_59.lib
libboost_context-vc120-mt-gd-1_59.lib
libboost_coroutine-vc120-mt-gd-1_59.lib
libboost_date_time-vc120-mt-gd-1_59.lib
libboost_exception-vc120-mt-gd-1_59.lib
libboost_filesystem-vc120-mt-gd-1_59.lib
libboost_graph-vc120-mt-gd-1_59.lib
libboost_iostreams-vc120-mt-gd-1_59.lib
libboost_locale-vc120-mt-gd-1_59.lib
libboost_log-vc120-mt-gd-1_59.lib
libboost_log_setup-vc120-mt-gd-1_59.lib
libboost_math_c99-vc120-mt-gd-1_59.lib
libboost_math_c99f-vc120-mt-gd-1_59.lib
libboost_math_c99l-vc120-mt-gd-1_59.lib
libboost_math_tr1-vc120-mt-gd-1_59.lib
libboost_math_tr1f-vc120-mt-gd-1_59.lib
libboost_math_tr1l-vc120-mt-gd-1_59.lib
libboost_mpi-vc120-mt-gd-1_59.lib
libboost_prg_exec_monitor-vc120-mt-gd-1_59.lib
libboost_program_options-vc120-mt-gd-1_59.lib
libboost_random-vc120-mt-gd-1_59.lib
libboost_regex-vc120-mt-gd-1_59.lib
libboost_serialization-vc120-mt-gd-1_59.lib
libboost_signals-vc120-mt-gd-1_59.lib
libboost_system-vc120-mt-gd-1_59.lib
libboost_test_exec_monitor-vc120-mt-gd-1_59.lib
libboost_thread-vc120-mt-gd-1_59.lib
libboost_timer-vc120-mt-gd-1_59.lib
libboost_unit_test_framework-vc120-mt-gd-1_59.lib
libboost_wave-vc120-mt-gd-1_59.lib
libboost_wserialization-vc120-mt-gd-1_59.lib
flann_cpp_s-gd.lib
flann_s-gd.lib
flann-gd.lib
OpenNI2.lib
qhullstatic_r-gd.lib
qhull_p-gd.lib
qhull_r-gd.lib
qhullcpp-gd.lib
qhull-gd.lib
qhullstatic-gd.lib
 vtkalglib-7.0-gd.lib
 vtkChartsCore-7.0-gd.lib
 vtkCommonColor-7.0-gd.lib
 vtkCommonComputationalGeometry-7.0-gd.lib
vtkCommonCore-7.0-gd.lib
vtkCommonDataModel-7.0-gd.lib
 vtkCommonExecutionModel-7.0-gd.lib
 vtkCommonMath-7.0-gd.lib
 vtkCommonMisc-7.0-gd.lib
 vtkCommonSystem-7.0-gd.lib
 vtkCommonTransforms-7.0-gd.lib
 vtkDICOMParser-7.0-gd.lib
 vtkDomainsChemistry-7.0-gd.lib
 vtkDomainsChemistryOpenGL2-7.0-gd.lib
 vtkexoIIc-7.0-gd.lib
 vtkexpat-7.0-gd.lib
 vtkFiltersAMR-7.0-gd.lib
vtkFiltersCore-7.0-gd.lib
 vtkFiltersExtraction-7.0-gd.lib
 vtkFiltersFlowPaths-7.0-gd.lib
vtkFiltersGeneral-7.0-gd.lib
 vtkFiltersGeneric-7.0-gd.lib
 vtkFiltersGeometry-7.0-gd.lib
 vtkFiltersHybrid-7.0-gd.lib
 vtkFiltersHyperTree-7.0-gd.lib
 vtkFiltersImaging-7.0-gd.lib
 vtkFiltersModeling-7.0-gd.lib
 vtkFiltersParallel-7.0-gd.lib
 vtkFiltersParallelImaging-7.0-gd.lib
 vtkFiltersProgrammable-7.0-gd.lib
 vtkFiltersSelection-7.0-gd.lib
 vtkFiltersSMP-7.0-gd.lib
 vtkFiltersSources-7.0-gd.lib
 vtkFiltersStatistics-7.0-gd.lib
 vtkFiltersTexture-7.0-gd.lib
 vtkFiltersVerdict-7.0-gd.lib
 vtkfreetype-7.0-gd.lib
 vtkGeovisCore-7.0-gd.lib
 vtkglew-7.0-gd.lib
 vtkGUISupportQt-7.0-gd.lib
 vtkGUISupportQtSQL-7.0-gd.lib
 vtkhdf5-7.0-gd.lib
 vtkhdf5_hl-7.0-gd.lib
 vtkImagingColor-7.0-gd.lib
 vtkImagingCore-7.0-gd.lib
 vtkImagingFourier-7.0-gd.lib
 vtkImagingGeneral-7.0-gd.lib
 vtkImagingHybrid-7.0-gd.lib
 vtkImagingMath-7.0-gd.lib
 vtkImagingMorphological-7.0-gd.lib
 vtkImagingSources-7.0-gd.lib
 vtkImagingStatistics-7.0-gd.lib
 vtkImagingStencil-7.0-gd.lib
 vtkInfovisCore-7.0-gd.lib
 vtkInfovisLayout-7.0-gd.lib
 vtkInteractionImage-7.0-gd.lib
 vtkInteractionStyle-7.0-gd.lib
vtkInteractionWidgets-7.0-gd.lib
 vtkIOAMR-7.0-gd.lib
 vtkIOCore-7.0-gd.lib
 vtkIOEnSight-7.0-gd.lib
 vtkIOExodus-7.0-gd.lib
 vtkIOExport-7.0-gd.lib
 vtkIOGeometry-7.0-gd.lib
 vtkIOImage-7.0-gd.lib
 vtkIOImport-7.0-gd.lib
 vtkIOInfovis-7.0-gd.lib
 vtkIOLegacy-7.0-gd.lib
 vtkIOLSDyna-7.0-gd.lib
 vtkIOMINC-7.0-gd.lib
 vtkIOMovie-7.0-gd.lib
 vtkIONetCDF-7.0-gd.lib
 vtkIOParallel-7.0-gd.lib
vtkIOParallelXML-7.0-gd.lib
vtkIOPLY-7.0-gd.lib
vtkIOSQL-7.0-gd.lib
vtkIOVideo-7.0-gd.lib
vtkIOXML-7.0-gd.lib
vtkIOXMLParser-7.0-gd.lib
vtkjpeg-7.0-gd.lib
vtkjsoncpp-7.0-gd.lib
vtklibxml2-7.0-gd.lib
vtkmetaio-7.0-gd.lib
vtkNetCDF-7.0-gd.lib
vtkNetCDF_cxx-7.0-gd.lib
vtkoggtheora-7.0-gd.lib
vtkParallelCore-7.0-gd.lib
vtkpng-7.0-gd.lib
 vtkproj4-7.0-gd.lib
 vtkRenderingAnnotation-7.0-gd.lib
 vtkRenderingContext2D-7.0-gd.lib
 vtkRenderingContextOpenGL2-7.0-gd.lib
vtkRenderingCore-7.0-gd.lib
 vtkRenderingFreeType-7.0-gd.lib
 vtkRenderingImage-7.0-gd.lib
 vtkRenderingLabel-7.0-gd.lib
 vtkRenderingLOD-7.0-gd.lib
 vtkRenderingOpenGL2-7.0-gd.lib
 vtkRenderingQt-7.0-gd.lib
 vtkRenderingVolume-7.0-gd.lib
 vtkRenderingVolumeOpenGL2-7.0-gd.lib
vtksqlite-7.0-gd.lib
 vtksys-7.0-gd.lib
 vtktiff-7.0-gd.lib
 vtkverdict-7.0-gd.lib
 vtkViewsContext2D-7.0-gd.lib
 vtkViewsCore-7.0-gd.lib
 vtkViewsInfovis-7.0-gd.lib
 vtkViewsQt-7.0-gd.lib
 vtkzlib-7.0-gd.lib

Releasex64版本的附加依赖项:

pcl_common_release.lib
pcl_features_release.lib
pcl_filters_release.lib
pcl_io_ply_release.lib
pcl_io_release.lib
pcl_kdtree_release.lib
pcl_keypoints_release.lib
pcl_ml_release.lib
pcl_octree_release.lib
pcl_outofcore_release.lib
pcl_people_release.lib
pcl_recognition_release.lib
pcl_registration_release.lib
pcl_sample_consensus_release.lib
pcl_search_release.lib
pcl_segmentation_release.lib
pcl_stereo_release.lib
pcl_surface_release.lib
pcl_tracking_release.lib
pcl_visualization_release.lib
libboost_atomic-vc120-mt-1_59.lib
libboost_chrono-vc120-mt-1_59.lib
libboost_container-vc120-mt-1_59.lib
libboost_context-vc120-mt-1_59.lib
libboost_coroutine-vc120-mt-1_59.lib
libboost_date_time-vc120-mt-1_59.lib
libboost_exception-vc120-mt-1_59.lib
libboost_filesystem-vc120-mt-1_59.lib
libboost_graph-vc120-mt-1_59.lib
libboost_iostreams-vc120-mt-1_59.lib
libboost_locale-vc120-mt-1_59.lib
libboost_log-vc120-mt-1_59.lib
libboost_log_setup-vc120-mt-1_59.lib
libboost_math_c99-vc120-mt-1_59.lib
libboost_math_c99f-vc120-mt-1_59.lib
libboost_math_c99l-vc120-mt-1_59.lib
libboost_math_tr1-vc120-mt-1_59.lib
libboost_math_tr1f-vc120-mt-1_59.lib
libboost_math_tr1l-vc120-mt-1_59.lib
libboost_mpi-vc120-mt-1_59.lib
libboost_prg_exec_monitor-vc120-mt-1_59.lib
libboost_program_options-vc120-mt-1_59.lib
libboost_random-vc120-mt-1_59.lib
libboost_regex-vc120-mt-1_59.lib
libboost_serialization-vc120-mt-1_59.lib
libboost_signals-vc120-mt-1_59.lib
libboost_system-vc120-mt-1_59.lib
libboost_test_exec_monitor-vc120-mt-1_59.lib
libboost_thread-vc120-mt-1_59.lib
libboost_timer-vc120-mt-1_59.lib
libboost_unit_test_framework-vc120-mt-1_59.lib
libboost_wave-vc120-mt-1_59.lib
libboost_wserialization-vc120-mt-1_59.lib
flann_cpp_s.lib
flann_s.lib
qhull.lib
qhullcpp.lib
qhullstatic.lib
qhullstatic_r.lib
qhull_p.lib
qhull_r.lib
vtkalglib-7.0.lib
vtkChartsCore-7.0.lib
vtkCommonColor-7.0.lib
vtkCommonComputationalGeometry-7.0.lib
vtkCommonCore-7.0.lib
vtkCommonDataModel-7.0.lib
vtkCommonExecutionModel-7.0.lib
vtkCommonMath-7.0.lib
vtkCommonMisc-7.0.lib
vtkCommonSystem-7.0.lib
vtkCommonTransforms-7.0.lib
vtkDICOMParser-7.0.lib
vtkDomainsChemistry-7.0.lib
vtkDomainsChemistryOpenGL2-7.0.lib
vtkexoIIc-7.0.lib
vtkexpat-7.0.lib
vtkFiltersAMR-7.0.lib
vtkFiltersCore-7.0.lib
vtkFiltersExtraction-7.0.lib
vtkFiltersFlowPaths-7.0.lib
vtkFiltersGeneral-7.0.lib
vtkFiltersGeneric-7.0.lib
vtkFiltersGeometry-7.0.lib
vtkFiltersHybrid-7.0.lib
vtkFiltersHyperTree-7.0.lib
vtkFiltersImaging-7.0.lib
vtkFiltersModeling-7.0.lib
vtkFiltersParallel-7.0.lib
vtkFiltersParallelImaging-7.0.lib
vtkFiltersProgrammable-7.0.lib
vtkFiltersSelection-7.0.lib
vtkFiltersSMP-7.0.lib
vtkFiltersSources-7.0.lib
vtkFiltersStatistics-7.0.lib
vtkFiltersTexture-7.0.lib
vtkFiltersVerdict-7.0.lib
vtkfreetype-7.0.lib
vtkGeovisCore-7.0.lib
vtkglew-7.0.lib
vtkGUISupportQt-7.0.lib
vtkGUISupportQtSQL-7.0.lib
vtkhdf5-7.0.lib
vtkhdf5_hl-7.0.lib
vtkImagingColor-7.0.lib
vtkImagingCore-7.0.lib
vtkImagingFourier-7.0.lib
vtkImagingGeneral-7.0.lib
vtkImagingHybrid-7.0.lib
vtkImagingMath-7.0.lib
vtkImagingMorphological-7.0.lib
vtkImagingSources-7.0.lib
vtkImagingStatistics-7.0.lib
vtkImagingStencil-7.0.lib
vtkInfovisCore-7.0.lib
vtkInfovisLayout-7.0.lib
vtkInteractionImage-7.0.lib
vtkInteractionStyle-7.0.lib
vtkInteractionWidgets-7.0.lib
vtkIOAMR-7.0.lib
vtkIOCore-7.0.lib
vtkIOEnSight-7.0.lib
vtkIOExodus-7.0.lib
vtkIOExport-7.0.lib
vtkIOGeometry-7.0.lib
vtkIOImage-7.0.lib
vtkIOImport-7.0.lib
vtkIOInfovis-7.0.lib
vtkIOLegacy-7.0.lib
vtkIOLSDyna-7.0.lib
vtkIOMINC-7.0.lib
vtkIOMovie-7.0.lib
vtkIONetCDF-7.0.lib
vtkIOParallel-7.0.lib
vtkIOParallelXML-7.0.lib
vtkIOPLY-7.0.lib
vtkIOSQL-7.0.lib
vtkIOVideo-7.0.lib
vtkIOXML-7.0.lib
vtkIOXMLParser-7.0.lib
vtkjpeg-7.0.lib
vtkjsoncpp-7.0.lib
vtklibxml2-7.0.lib
vtkmetaio-7.0.lib
vtkNetCDF-7.0.lib
vtkNetCDF_cxx-7.0.lib
vtkoggtheora-7.0.lib
vtkParallelCore-7.0.lib
vtkpng-7.0.lib
vtkproj4-7.0.lib
vtkRenderingAnnotation-7.0.lib
vtkRenderingContext2D-7.0.lib
vtkRenderingContextOpenGL2-7.0.lib
vtkRenderingCore-7.0.lib
vtkRenderingFreeType-7.0.lib
vtkRenderingImage-7.0.lib
vtkRenderingLabel-7.0.lib
vtkRenderingLOD-7.0.lib
vtkRenderingOpenGL2-7.0.lib
vtkRenderingQt-7.0.lib
vtkRenderingVolume-7.0.lib
vtkRenderingVolumeOpenGL2-7.0.lib
vtksqlite-7.0.lib
vtksys-7.0.lib
vtktiff-7.0.lib
vtkverdict-7.0.lib
vtkViewsContext2D-7.0.lib
vtkViewsCore-7.0.lib
vtkViewsInfovis-7.0.lib
vtkViewsQt-7.0.lib
vtkzlib-7.0.lib

配置完属性表之后还需要配置dll。

配置dll有四种方法: 第一种,把dll拷贝到system32里去, 第二种,把dll拷贝到编译出来的程序的文件中, 第三种,直接配置到项目中。 本文采用第四种方法,在系统的path中添加dll的路径。具体方法如下:

首先将打开控制面板\系统和安全\系统->高级系统设置->环境变量

修改path路径在后面添加下面的文字:

;%PCL_ROOT%\bin
;%PCL_ROOT%\3rdParty\Qhull\bin
;%PCL_ROOT%\3rdParty\FLANN\bin
;%PCL_ROOT%\3rdParty\VTK\bin
;%PCL_ROOT%\3rdParty\OpenNI2\Tools

这样环境就配置完成了。

测试

代码:

#include <pcl/visualization/cloud_viewer.h>
#include <iostream>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
#include <iostream>
#include <pcl/filters/filter.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("test_cloud.pcd", *cloud);
	pcl::visualization::CloudViewer viewer("Cloud Viewer");
 
	//blocks until the cloud is actually rendered
	viewer.showCloud(cloud);
 
	//use the following functions to get access to the underlying more advanced/powerful
	//PCLVisualizer
 
	//This will only get called once
	viewer.runOnVisualizationThreadOnce(viewerOneOff);
 
	//This will get called once per visualization iteration
	viewer.runOnVisualizationThread(viewerPsycho);
 
	while (!viewer.wasStopped())
	{
		std::cout << cloud->width << endl;
		std::cout << cloud->height << endl;
		//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;
}

可能会缺少test_cloud.pcd,造成没有点云显示,也无伤大雅。

最终的测试显示。

本文在参考一些博客之后,发觉都不是很详细,特此写下这篇文章以供初学者更清楚的配置。

加载全部内容

相关教程
猜你喜欢
用户评论