pcl 1.8 + VS 2010 在win7 x64下的配置

https://blog.csdn.net/zhangping560/article/details/53978011

版权声明:(转载请注明作者和出处:http://blog.csdn.net/zhangping560 未经允许请勿用于商业用途) https://blog.csdn.net/zhangping560/article/details/53978011
在安装PCL时,最方便的办法是官网提供PCL all in one版本,下载安装即可,不需要对pcl源码编译及环境配置,但是目前该版本最新支持到1.6,而PCL源码库的版本一般较高(目前是1.8版本)。all in one版本可能缺少最新的功能。

在此,我使用Cmake进行最新的源码编译。官网给出了配置方法:http://pointclouds.org/documentation/tutorials/compiling_pcl_windows.php

在pcl的官网上可以下载所有的库的源码。 http://www.pointclouds.org/downloads/windows.html

前四项是必须要下载的(因为我需要用到点抓取功能,就安装的OpenNI。)并下载最新的PCL源码。 https://github.com/PointCloudLibrary/pcl/releases     解压,源码放在你指定的文件夹中,比如:C:/PCL/pcl

首先安装前四个软件,安装过程中注意要选择配置环境变量。(安装位置就按默认路径吧,选择自己的路径可能会麻烦点)
然后使用cmake对PCL源码进行编译vs2010的项目。在cmake中指定源码位置及生成位置:
Where is the source code : C:/PCL/pcl
Where to build the binaries: C:/PCL

Grouped和Advanced选项要选中

然后点击配置,编译器选择Visual Studio 10 Win64(这里一定要注意,如果你要配置64位的PCL环境,上面的第三方库也下载64位版本。千万不要选错。如果你要配置32位的PCL环境,第三方库下载32位版本,Cmake编译器选择Visual Studio 10 )

配置完以后,要在Cmake中确认第三方软件是否都找到了。
Boost :

Eigen :

FLANN :

VTK :

OpenNI :

其他库我们没有安装,就不需要指定了。以上路径如果没有找到就手动指定就好。

点击配置,如果没错误的话就点击生成。

在生成目录中打开PCL.sln工程。生成ALL_BUILD

如果上面的步骤你设置的都正确的话(尤其是32位64位设置),编译过程会有几个小错误:

编译到visualization模块时,如下语句会报错。参考:http://blog.csdn.net/Linear_Luo/article/details/52658984

if (!pcl::visualization::getColormapLUT (static_cast<LookUpTableRepresentationProperties>(value), table)) break;

'static_cast': cannot convert from 'double' to 'pcl::visualization::LookUpTableRepresentationPropert

解决方案: 
将所有的

static_cast<LookUpTableRepresentationProperties>(value)
1
1
修改成

static_cast<LookUpTableRepresentationProperties>(int(value))
这样应该就没问题了。编译会完全成功(dubug和release下都进行编译)

然后生成INSTALL。(dubug和release下都进行编译)

生成成功后,在C:\Program Files下会生成PCL文件夹,这就是配置好的PCL库了。之后就可以像OpenCV一样配置环境变量调用编程了

参考:blog.sina.com.cn/s/blog_b3a4f3f80101k38a.html

1、打开计算机 à 系统属性 à 高级系统设置 à 环境变量,在系统变量中添加C:\Program Files\OpenNI\Bin64;C:\Program Files\Boost\lib;C:\Program Files\flann\bin;C:\Program Files (x86)\Eigen\bin;C:Program Files\PCL\bin

2、打开VS2010 ,创建一个新的工程,点击左侧窗口下方的属性管理器,双击Microsoft.Cpp.win32.user,弹出属性页。

点击VC++目录(VC++ Directories)
在包含目录(Include Directories)里添加:

C:\Program Files (x86)\Eigen\include

C:\Program Files\flann\include

C:\Program Files\VTK 5.8.0\include\vtk-5.8

C:\Program Files\Boost\include

C:\Program Files\PCL\include\pcl-1.8

在库目录里(Library Directories)添加:

C:\Program Files\flann\lib

C:\Program Files\VTK 5.8.0\lib\vtk-5.8

C:\Program Files\Boost\lib

C:\Program Files\PCL\lib

点击C/C++——>常规(General),点开附加包含目录(Additional Include Directories),添加

C:\Program Files (x86)\Eigen\include

C:\Program Files\flann\include

C:\Program Files\VTK 5.8.0\include\vtk-5.8

C:\Program Files\Boost\include

C:\Program Files\PCL\include\pcl-1.8

点开链接器->常规,在附加库目录中添加

C:\Program Files\flann\lib

C:\Program Files\VTK 5.8.0\lib\vtk-5.8

C:\Program Files\Boost\lib

C:\Program Files\PCL\lib

链接器->输入->附加依赖项里边添加:

opengl32.lib

boost_chrono-vc100-mt-gd-1_50.lib
boost_date_time-vc100-mt-gd-1_50.lib
boost_filesystem-vc100-mt-gd-1_50.lib
boost_graph-vc100-mt-gd-1_50.lib
boost_graph_parallel-vc100-mt-gd-1_50.lib
boost_iostreams-vc100-mt-gd-1_50.lib
boost_locale-vc100-mt-gd-1_50.lib
boost_math_c99-vc100-mt-gd-1_50.lib
boost_math_c99f-vc100-mt-gd-1_50.lib
boost_math_tr1-vc100-mt-gd-1_50.lib
boost_math_tr1f-vc100-mt-gd-1_50.lib
boost_mpi-vc100-mt-gd-1_50.lib
boost_prg_exec_monitor-vc100-mt-gd-1_50.lib
boost_program_options-vc100-mt-gd-1_50.lib
boost_random-vc100-mt-gd-1_50.lib
boost_regex-vc100-mt-gd-1_50.lib
boost_serialization-vc100-mt-gd-1_50.lib
boost_signals-vc100-mt-gd-1_50.lib
boost_system-vc100-mt-gd-1_50.lib
boost_thread-vc100-mt-gd-1_50.lib
boost_timer-vc100-mt-gd-1_50.lib
boost_unit_test_framework-vc100-mt-gd-1_50.lib
boost_wave-vc100-mt-gd-1_50.lib
boost_wserialization-vc100-mt-gd-1_50.lib
libboost_chrono-vc100-mt-gd-1_50.lib
libboost_date_time-vc100-mt-gd-1_50.lib
libboost_filesystem-vc100-mt-gd-1_50.lib
libboost_graph_parallel-vc100-mt-gd-1_50.lib
libboost_iostreams-vc100-mt-gd-1_50.lib
libboost_locale-vc100-mt-gd-1_50.lib
libboost_math_c99-vc100-mt-gd-1_50.lib
libboost_math_c99f-vc100-mt-gd-1_50.lib
libboost_math_tr1-vc100-mt-gd-1_50.lib
libboost_math_tr1f-vc100-mt-gd-1_50.lib
libboost_mpi-vc100-mt-gd-1_50.lib
libboost_prg_exec_monitor-vc100-mt-gd-1_50.lib
libboost_program_options-vc100-mt-gd-1_50.lib
libboost_random-vc100-mt-gd-1_50.lib
libboost_regex-vc100-mt-gd-1_50.lib
libboost_serialization-vc100-mt-gd-1_50.lib
libboost_signals-vc100-mt-gd-1_50.lib
libboost_system-vc100-mt-gd-1_50.lib
libboost_test_exec_monitor-vc100-mt-gd-1_50.lib
libboost_thread-vc100-mt-gd-1_50.lib
libboost_timer-vc100-mt-gd-1_50.lib
libboost_unit_test_framework-vc100-mt-gd-1_50.lib
libboost_wave-vc100-mt-gd-1_50.lib
libboost_wserialization-vc100-mt-gd-1_50.lib

flann-gd.lib
flann_cpp_s-gd.lib
flann_cuda_s-gd.lib
flann_s-gd.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_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_surface_debug.lib
pcl_tracking_debug.lib
pcl_visualization_debug.lib

MapReduceMPI-gd.lib
mpistubs-gd.lib
vtkalglib-gd.lib
vtkCharts-gd.lib
vtkCommon-gd.lib
vtkDICOMParser-gd.lib
vtkexoIIc-gd.lib
vtkexpat-gd.lib
vtkFiltering-gd.lib
vtkfreetype-gd.lib
vtkftgl-gd.lib
vtkGenericFiltering-gd.lib
vtkGeovis-gd.lib
vtkGraphics-gd.lib
vtkhdf5-gd.lib
vtkHybrid-gd.lib
vtkImaging-gd.lib
vtkInfovis-gd.lib
vtkIO-gd.lib
vtkjpeg-gd.lib
vtklibxml2-gd.lib
vtkmetaio-gd.lib
vtkNetCDF-gd.lib
vtkNetCDF_cxx-gd.lib
vtkpng-gd.lib
vtkproj4-gd.lib
vtkRendering-gd.lib
vtksqlite-gd.lib
vtksys-gd.lib
vtktiff-gd.lib
vtkverdict-gd.lib
vtkViews-gd.lib
vtkVolumeRendering-gd.lib
vtkWidgets-gd.lib
vtkzlib-gd.lib

以上是debug下的配置,release下的配置一样,链接库需要换一下

opengl32.lib

boost_chrono-vc100-mt-1_50.lib
boost_date_time-vc100-mt-1_50.lib
boost_filesystem-vc100-mt-1_50.lib
boost_graph-vc100-mt-1_50.lib
boost_graph_parallel-vc100-mt-1_50.lib
boost_iostreams-vc100-mt-1_50.lib
boost_locale-vc100-mt-1_50.lib
boost_math_c99-vc100-mt-1_50.lib
boost_math_c99f-vc100-mt-1_50.lib
boost_math_tr1-vc100-mt-1_50.lib
boost_math_tr1f-vc100-mt-1_50.lib
boost_mpi-vc100-mt-1_50.lib
boost_prg_exec_monitor-vc100-mt-1_50.lib
boost_program_options-vc100-mt-1_50.lib
boost_random-vc100-mt-1_50.lib
boost_regex-vc100-mt-1_50.lib
boost_serialization-vc100-mt-1_50.lib
boost_signals-vc100-mt-1_50.lib
boost_system-vc100-mt-1_50.lib
boost_thread-vc100-mt-1_50.lib
boost_timer-vc100-mt-1_50.lib
boost_unit_test_framework-vc100-mt-1_50.lib
boost_wave-vc100-mt-1_50.lib
boost_wserialization-vc100-mt-1_50.lib
libboost_chrono-vc100-mt-1_50.lib
libboost_date_time-vc100-mt-1_50.lib
libboost_filesystem-vc100-mt-1_50.lib
libboost_graph_parallel-vc100-mt-1_50.lib
libboost_iostreams-vc100-mt-1_50.lib
libboost_locale-vc100-mt-1_50.lib
libboost_math_c99-vc100-mt-1_50.lib
libboost_math_c99f-vc100-mt-1_50.lib
libboost_math_tr1-vc100-mt-1_50.lib
libboost_math_tr1f-vc100-mt-1_50.lib
libboost_mpi-vc100-mt-1_50.lib
libboost_prg_exec_monitor-vc100-mt-1_50.lib
libboost_program_options-vc100-mt-1_50.lib
libboost_random-vc100-mt-1_50.lib
libboost_regex-vc100-mt-1_50.lib
libboost_serialization-vc100-mt-1_50.lib
libboost_signals-vc100-mt-1_50.lib
libboost_system-vc100-mt-1_50.lib
libboost_test_exec_monitor-vc100-mt-1_50.lib
libboost_thread-vc100-mt-1_50.lib
libboost_timer-vc100-mt-1_50.lib
libboost_unit_test_framework-vc100-mt-1_50.lib
libboost_wave-vc100-mt-1_50.lib
libboost_wserialization-vc100-mt-1_50.lib

flann.lib
flann_cpp_s.lib
flann_cuda_s.lib
flann_s.lib

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_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_surface_release.lib
pcl_tracking_release.lib
pcl_visualization_release.lib

MapReduceMPI.lib
mpistubs.lib
vtkalglib.lib
vtkCharts.lib
vtkCommon.lib
vtkDICOMParser.lib
vtkexoIIc.lib
vtkexpat.lib
vtkFiltering.lib
vtkfreetype.lib
vtkftgl.lib
vtkGenericFiltering.lib
vtkGeovis.lib
vtkGraphics.lib
vtkhdf5.lib
vtkHybrid.lib
vtkImaging.lib
vtkInfovis.lib
vtkIO.lib
vtkjpeg.lib
vtklibxml2.lib
vtkmetaio.lib
vtkNetCDF.lib
vtkNetCDF_cxx.lib
vtkpng.lib
vtkproj4.lib
vtkRendering.lib
vtksqlite.lib
vtksys.lib
vtktiff.lib
vtkverdict.lib
vtkViews.lib
vtkVolumeRendering.lib
vtkWidgets.lib
vtkzlib.lib

好了,至此就配置完成了。(重新启动计算机,完成配置)我们可以编写测试程序了:

#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>

int main (int argc, char** argv)
{
pcl::PointCloud<pcl::PointXYZ> cloud;

// Fill in the cloud data
cloud.width = 5;
cloud.height = 1;
cloud.is_dense = false;
cloud.points.resize (cloud.width * cloud.height);

for (size_t i = 0; i < cloud.points.size (); ++i)
{
cloud.points[i].x = 1024 * rand () / (RAND_MAX + 1.0f);
cloud.points[i].y = 1024 * rand () / (RAND_MAX + 1.0f);
cloud.points[i].z = 1024 * rand () / (RAND_MAX + 1.0f);
}

pcl::io::savePCDFileASCII ("test_pcd.pcd", cloud);
std::cerr << "Saved " << cloud.points.size () << " data points to test_pcd.pcd." << std::endl;

for (size_t i = 0; i < cloud.points.size (); ++i)
std::cerr << " " << cloud.points[i].x << " " << cloud.points[i].y << " " << cloud.points[i].z << std::endl;

return (0);
}

结果:

原文:https://blog.csdn.net/zhangping560/article/details/53978011

上一篇:Mysql对用户的操作


下一篇:linux下网络配置 命令