搭建环境: windows 8 + VS2008
从PCL网上下载了一个All in one(MSVC2008)的安装包,直接默认安装,在安装到OpenNI时,弹出一个提示框
具体失败原因不太清楚,略过这一步,完成PCL安装,再重新安装更高版本的OpenNI + SensorKinect ,
电脑还是无法读取Kinect(在设备管理器里查看,如果电脑能出现
PrimeSense下正确识别Kinect三个设备(Audio,Camera,motor)说明kinect驱动正确)
原因可能是(自己总结的,不一定对,欢迎大神指正):
AllInOne包内的OpenNI版本与windows8不兼容, 导致kinect的驱动(SensorKinect依附于OpenNI)不能正确安装
电脑无法识别kinect
解决办法:1)先在Win8 下成功安装 OpenNI + SensorKinect ,正确之后
(电脑的设备管理器能出现PrimeSense下正确识别Kinect三个设备,即为Kinect驱动安装正确)
2) 再用预先编译好的第三方源码包搭建PCL开发环境
更简单的办法:换一台win7 的电脑!简直各种正确!各种不出错,看得你赏心悦目!
步骤1:在Win8 下成功安装 OpenNI + SensorKinect
OpenNI/NITEInstallation on Windows 8
http://fivedots.coe.psu.ac.th/~ad/kinect/installation.html
May 2014: PrimeSense was bought by Apple at the end of April, andthe OpenNI.org website was shut down.Fortunately, several sites have set up archives of the old OpenNI and NITEsoftware, such as Simple-OpenNI and StructureSensor.
When looking through these archives, it's important to rememberthat the code examples in my book use OpenNI version 1. It's quitedifferent from version 2, which sports many changes to the skeleton and handdetection functions, resulting in big changes to NITE as well. In other words,you need to find archive copies of version 1 of OpenNI andNITE to run my code. The following instructions explain how to do that.
This page is written in the form of a checklist. If you prefera wordier explanation, then please have a look at section 3 of the draft chapter. Remember that it refers to thenow-defunct OpenNI website from 2012, so ignore any weblink information in thatchapter.
1. Clean Up
Useful freeware tools for cleaning Windows: Revo Uninstaller, CCleaner
2. Download the Packages
Download the relevant OpenNI/NITE zip file from the Simple-OpenNI downloads website. Search for"All Downloads" to find suitable versions of OpenNI and NITE forWindows, Linux, and OSX. I recommend the following:
(NOTE: OpenNI不同的版本号与对应版本的NITE以及SensorKinect,如果版本不对应,可能会出现各种缺乏.dll错误)
32-bit zip file ( OpenNI_NITE_Installer-win32-0.27.zip) contains four installers:
For example, the Windows 64-bit zipfile ( OpenNI_NITE_Installer-win64-0.27.zip) contains four installers:
So for 64-bitwindows 8, we choose OpenNI_NITE_Installer-win64-0.27.zipfor the nextInstallment.
Thereare two installers containing the word "sensor", which relate to theSensorKinect driver. It seems that the driverinside SensorKinect092-Bin-Win32-v5.1.2.1.msi is compiled usingVC++ 2010 so you must have Microsoft stalledfor the driver to correctly execute. The redistributable isinside sensor-win32-5.1.2.1-redist.msi.
Ifyou don't want to install the 64-bit version of OpenNI on your 64-bit Windowsmachine, then you can use the 32-bit installer instead. Some good instructionson how to do that can be found here.
NOTE:
1.Pleasenote the version of Microsoft Visual Studio,
Ifyou chooseWindows 32-bit zip file,then Microsoft's VC++ 2010 redistributable is needed
2. For The 64-bit machine , OpenNI_NITE_Installer-win64-0.27.zipis recommended.
3. Installation
Installthe four downloaded packages in the order(注意顺序):
Afterwards,check if the software is in the C:\ProgramFiles\OpenNI\ and C:\Program Files\PrimeSense\ directories.
插上Kinect
Toinstall the three hardware drivers (for motor, audio, and camera), you should:
该步骤具体细节:
1, Win+ x ---选择Device Manager
2, 选择unknown device---Kinect motor---右键选择更新驱动update driver
3.接下来,系统会跳出来一个对话框,询问要动搜寻更新,还是要手动安装;这时候,需要选取下面「浏览计算机上的驱动程序软件」这个选项,以进行手动指定。
4. 接下来,他会问驱动程序在哪里?如下图:
选择第一个选项,填入SensorKinect的driver所在的文件位置,我的是C:\Program Files\PrimeSense\SensorKinect\Driver
于是花费1分钟左右,安装成功!我激动啊!
成功的截图是这样滴:
Note: 由于SensorKinect是第三方破解驱动,没有签名,可能在windows8下安装会有问题,其中的一个解决办法是:禁用驱动强制签名
Windows8下禁用驱动强制签名方法(据说只能单次有效):
如果是Win8(主)双系统,启动到选系统的时候,选最下面的:更改默认值或选择其它选项 ——>选择其它选项 ——>疑难解答 ——>高级选项 ——>Windows启动设置 —重新启动 ,然后选择“禁用驱动程序强制签名” ;
whenyou see this, you are successful to make the computer to recognize the Kinect!
DeleteOpenNI's Java CLASSPATH environment variable via Windows' System control panelAdvanced tab
4. Edit four XML Configuration Files
In C:\Program Files\PrimeSense\NITE\Data edit:
In C:\Program Files\OpenNI\Data edit:
The edits to these XML files are:
Look at SampleConfig.xml in the chapter 2 code for examples of these changes.
Tips:若是直接修改*.xml文件,保存时会被拒绝。
解决办法:先把文件复制到非系统盘 修改后copy过去就行了
文件夹《step 3修改后的Xml文件》提供了需要的xml文件,直接覆盖原目录下的同名文件即可
5. Test OpenNI and NITE
In C:\Program Files\OpenNI\Samples\Bin\Release, run theapplications:
In C:\Program Files\PrimeSense\NITE\Samples\Bin\Release, run:
步骤2:WIN8_VS2008_用第三方预编译包从源码搭建PCL开发环境
Compiling PCL from source on Windows
http://pointclouds.org/documentation/tutorials/compiling_pcl_windows.php#compiling-pcl-windows
This tutorial explains how to build the Point CloudLibrary from source on Microsoft Windows platforms. In thistutorial, we assume that you have built and installed all the requireddependencies, or that you have installed them using the dependencies installersprovided on the downloads page.
Note
If you installed PCL using one of the all-in-one providedinstallers, then this tutorial is not for you. The all-in-one installeralready contains prebuilt PCL binaries which are ready to be used without anycompilation step.
Note
If there is no installers for your compiler, it is recommendedthat you build the dependencies out of source. The Building PCL’s dependencies from source on Windows tutorial should guide you through the download and thecompilation of all the required dependencies.
Requirements
we assume that you have built and installed all the requireddependencies, or that you have installed them using the dependencies installersprovided on the downloads page. Installing them to the default locations will makeconfiguring PCL easier.
used for shared pointers, and threading. mandatory
used as the matrix backend for SSE optimized math. mandatory
used in kdtree for fastapproximate nearest neighbors search. mandatory
used in visualization for3D point cloud rendering and visualization. mandatory
used for applications with a graphical user interface(GUI) optional
used for convex/concave hull decompositions in surface. optional
used to grab point clouds from OpenNI compliant devices. optional
is needed only to build PCL tests. We do not provide GTestinstallers. optional
Note
Though not a dependency per se, don’t forget that you also needthe CMake build system (http://www.cmake.org/), at least version 2.8.7. A Git client for Windowsis also required to download the PCL source code.
Downloading PCLsource code
To build the current official release, download the source archivefrom http://pointclouds.org/downloads/ and extract it somewhere on your disk, sayC:\PCL\PCL-1.5.1-Source. In this case, you can go directly to Configuring PCLsection, and pay attention to adjust the paths accordingly.
Or, you might want to build an experimental version of PCL totest some new features not yet available in the official releases. For this,you will need git ( http://git-scm.com/download ).
The invocation to download the source code is thus, using acommand line:
cd wherever/you/want/to/put/the/repo/git clone https://github.com/PointCloudLibrary/pcl.git
You could also use Github for Windows (https://windows.github.com/), but that is potentially more troublesome than setting up giton windows.
Configuring PCL
On Windows, we recommend to build shared PCLlibraries with static dependencies. In this tutorial, we willuse static dependencies when possible to build shared PCL. You can easilyswitch to using shared dependencies. Then, you need to make sure you put thedependencies’ dlls either in your PATH or in thesame folder as PCL dlls and executables.You can also build static PCL libraries if you want.
Run the CMake-gui application and fill in the fields:
Where is the source code :C:/PCL/pcl
Where to build the binaries: C:/PCL
Now hit the “Configure” button. You will be asked for a generator. A generator is simply a compiler.
Note
In this tutorial, we will be using Microsoft Visual C++ 2010compiler. If you want to build 32bit PCL, then pick the “Visual Studio 10”generator. If you want to build 64bit PCL, then pick the “Visual Studio 10Win64”.
Make sure you have installed the right third partydependencies. You cannot mix 32bit and 64bit code, and it is highly recommandedto not mix codes compiled with different compilers.
In the remaining of this tutorial, we will be using “VisualStudio 10 Win64” generator. Once you picked your generator, hit finish toclose the dialog window. CMake will start configuring PCL and looking for itsdependencies. For example, we can get this output :
The upper part of CMake window contains a list of CMakevariables and its respective values. The lower part contains some loggingoutput that can help figure out what is happening. We can see, for example,that VTK was not found, thus, the visualization module will not get built.
Before solving the VTK issue, let’s organize the CMakevariables in groups by checking the Grouped checkbox in the top right of CMake window. Let’s checkalso the Advancedcheckbox to show some advanced CMake variables. Now, if we wantto look for a specific variable value, we can either browse the CMake variablesto look for it, or we can use the Search: field to type the variable name.
Let’s check whether CMake did actually find the needed thirdparty dependencies or not :
CMake was not able to find boost automatically. No problem, wewill help it find it :) . If CMake has found your boost installation, then skipto the next bullet item.
Let’s tell CMake where boost headers are by specifiying theheaders path in Boost_INCLUDE_DIR variable. For example, myboost headers are in C:\Program Files\PCL-Boost\include (C:\ProgramFiles\Boost\include for newer installers). Then, let’s hit configure again ! Hopefully, CMake is now able to find all theother items (the libraries).
Note
This behaviour is not common for all libraries. Generally, ifCMake is not able to find a specific library or package, we have to manuallyset the values of all the CMake related variables. Hopefully, the CMake scriptresponsible of finding boost is able to find libraries using the headers path.
Eigen is a header-only library, thus, we need only EIGEN_INCLUDE_DIR tobe set. Hopefully, CMake did fing Eigen.
CMake was able to find my FLANN installation. By default onwindows, PCL will pick the static FLANN libraries with _s suffix. Thus, the FLANN_IS_STATICcheckbox ischecked by default.
Note
If you rather want to use the shared FLANNlibraries (those without the _s suffix), you need to manuallyedit the FLANN_LIBRARY and FLANN_LIBRARY_DEBUGvariablesto remove the _s suffix and do not forget touncheck FLANN_IS_STATIC. Make sure the FLANN dlls are either inyour PATH or in the same folder as your executables.
Note
In recent PCL, the FLANN_IS_STATIC checkbox nolonger exists.
It is highly recommended to install Qt to the default pathsuggested by the installer. You need then to define an environment variablenamed QTDIR to point to Qt installation path (e.g. C:\Qt\4.8.0). Also, you need to append the bin folder to the PATH environmentvariable. Once you modify the environment variables, you need to restart CMakeand click “Configure” again. If Qt is not found, you need at least tofill QT_QMAKE_EXECUTABLE CMake entry with the path ofqmake.exe (e.g. C:\Qt\4.8.0\bin\qmake.exe), then click “Configure”.
CMake did not find my VTK installation. There is only one VTKrelated CMake variable called VTK_DIR. We have to set it to thepath of the folder containingVTKConfig.cmake, which is in my case :C:\Program Files\VTK 5.6\lib\vtk-5.6 (C:\Program Files\VTK 5.8.0\lib\vtk-5.8for VTK 5.8). After you set VTK_DIR, hitconfigure again.
After clicking configure, in the logging window, we can see that VTK is found, butthe visualization module is still disabled manually. We have then to enable it by checking the BUILD_visualization checkbox.You can also do the same thing with the apps module. Then, hit configure again.
CMake was able to find my QHull installation. By default onwindows, PCL will pick the static QHull libraries with static suffix.
CMake was able to find my OpenNI installation.
Note
CMake do not look for the installed OpenNI Sensor module. It isneeded at runtime.
If you want to build PCL tests, you need to download GTest and buildit yourself. In this tutorial, we will not build tests.
Once CMake has found all the needed dependencies, let’s see thePCL specific CMake variables :
If you have the Pro version of Microsoft Visual Studio, you cancheck USE_PROJECT_FOLDERS checkbox to organize PCL projects infolders within the PCL solution. If you have an express edition, it isrecommended to keep it unchecked, as in express editions, project folders aredisabled.
Once PCL configuration is ok, hit the Generate button. CMake will then generate Visual Studio projectfiles (vcproj files) and the main solution file (PCL.sln) in C:\PCL directory.
Building PCL
Open that generated solution file (PCL.sln) to finally buildthe PCL libraries. This is how your solution will look like whether youenabled USE_PROJECT_FOLDERS (left) or not (right).
Building the “ALL_BUILD” project will build everything.
Note
Make sure to build the “ALL_BUILD” project in both debug and release mode.
Installing PCL
To install the built libraries and executbles, you need tobuild the “INSTALL” project in the solution explorer. This utility project willcopy PCL headers, libraries and executable to the directory defined bythe CMAKE_INSTALL_PREFIX CMake variable.
继上一步生成的PCL工程目录下打开PCL.sln解决方案文件,如下图所示,右击ALL_BUILD工程,选择Build,即可完成对PCL中所有的模块和例子程序编译与链接,时间可能比较长,和用户选择建立的模块个数以及用户的计算机配置有关,可出去喝点东西,回来可能就完成了。
编译链接完成后,安装PCL,即拷贝编译链接后的PCL头文件、库文件、可执行文件到前面cmake设置的CMAKE_INSTALL_PREFIX变量指定的路径,用户不需要自己拷贝,如图9所示右击INSTALL工程选择Build,即可完成对PCL的安装。
Note
Make sure to build the “INSTALL” project in both debug and release mode.
Note
It is highly recommanded to add the bin folder in PCLinstallation tree (e.g. C:\Program Files\PCL\bin) to your PATH environmentvariable.
个人实战经验总结
1. 搭建环境: windows 8 64 bit + VS 2008
2.安装的第三方软件以及版本
For example, the Windows 64-bit zip file ( OpenNI_NITE_Installer-win64-0.27.zip) contains four installers:
Note:OpenNI + NITE + Sensor + SensprKinect的安装请参看
《step 0 跟着我在win8 64位下_来安装 OpenNI.doc》
3.安装步骤
步骤全部参看前面几步:
RequirementsàDownloadingPCL source codeàConfiguringPCLàInstallingPCL
照做,英文指导写的相当好
中文指导可以参看 http://www.pclcn.org/study/shownews.php?lang=cn&id=48 写的好一般
于是卡壳出现了================
Cmake生成的pcl.sln工程文件选择建置时,编译出错!!
这一步之后,问题良多。。。。
4. 工程编译出现的问题以及解决办法
1)选择源码包1.7.2==============================
错误:cmake无法通过,找不到mm_malloc.h
解决办法:暂未解决。。。。
2)选择源码包1.7.1===================================
cmake通过,生成PCL.sln工程
错误: PCL.sln编译时报错:错误起因为缺乏:在template之前,
pcl_io这个工程
导致pcl_io_debug.lib无法被成功建立,导致后续出错
解决办法:暂未解决。。。。
3)源码包1.5.0=================================================
cmake通过,生成PCL.sln工程
错误:PCL.sln编译时报错:错误起因为缺乏:在“〉template”之前,
Pcl_io这个工程编译失败 导致pcl_io_debug.lib无法被成功建立,导致后续连续出错,打不开pcl_io_debug.lib类似的错误
Vs2008编译后错误信息:
项目: pcl_io,配置: Debug|x64
========== 生成:rce\PCL_src1.5.0\io\include\pcl/io/ply/ply_parser.h(54) :
fatal error C1083: 无法打开包括文件:“tuple”: No such file or directory
成功 19 个,失败 77 个,最新 2 个,跳过 0 个 ==========
错误原因:网络上回答
http://stackoverflow.com/questions/4312218/error-with-tuple-in-c-sharp-2008
我疯了!竟然是这个原因!: Tuple is onlyavailable in .NET 4, which isn't supported by VS2008.
解决办法:
1)安装低版本的Pcl(PCL1.4以及以下)
Update toframework 4.0 (find any patch for VS 2008) else, visual studio 2010 isrecommended for Tuple
更新.NET for VS 2008patch疑问以及解答:https://social.msdn.microsoft.com/Forums/en-US/671325e0-b41d-4cdc-9536-f024fff98a6e/framework-40-compatibility-with-vs-2008?forum=netfxgeneralprerelease
2)安装Visual studio 2010 ,它才支持tuple啊!
〉〉〉我这几天的功夫都白费了!,呜呜呜呜
Note:
因为pcl1.5以及以上版本用到了tuple这个结构体,这个结构体只在.NET 4.0以上的版本定义VS2008无法debug .NET 4.0,除非升级到VS 2010,所以呢,要么用低版本的pCL 要么把Vs升级
我下载低版本的!哎,长叹一声,继续尝试
4)选择源码包1.4.0==========================================
编译pcl_io工程时出现如下错误:
LINK : fatalerror LNK1104: 无法打开文件“C:\Program Files\MicrosoftSDKs\Windows\v6.1\Lib\x64\d3d9.lib”
导致pcl_io_debug.lib无法被成功建立,导致后续连续出错,打不开pcl_io_debug.lib类似的错误
解决办法:手动添加d3d9.lib 自己创一个文件夹
原本,d3d9.lib存在于C:\ProgramFiles\Microsoft SDKs\Windows\v6.0A\Lib\x64
C:\Program Files\Microsoft SDKs\Windows\下只有子目录v6.0A,
在C:\Program Files\Microsoft SDKs\Windows\我新建一个文件夹名为v6.1,把Lib文件夹全部拷贝过去,pcl_io工程成功编译!
Note:网上还有人说,以管理员身份运行Vs2008,再打开工程可以解决一些问题!
秀成果的时候到了:=============卡壳解决了!=================
Debug版本编译成功!
Release版本编译成功!
分别简直Debug, Release版本下的INSTANLL工程后
成功安装的目录!!!!大功告成!!!
Advanced topics
If you want to build PCL tests, you need to download GTest 1.6 (http://code.google.com/p/googletest/) and build it yourself. Make sure, when you configure GTestvia CMake to check the gtest_force_shared_crt checkbox. Youneed, as usual, to build GTest in both release and debug.
Back to PCL’s CMake settings, you have to fill the GTEST_* CMakeentries (include directory, gtest libraries (debug and release) and gtestmainlibraries (debug and release)). Then, you have to check BUILD_TEST and BUILD_global_tests CMakecheckboxes, and hit Configure and Generate.
You can build the doxygen documentation of PCL in order to havea local up-to-date api documentation. For this, you need Doxygen (http://www.doxygen.org). You will need also the Graph Visualization Software(GraphViz, http://www.graphviz.org/) to get the doxygen graphics, specifically the dot executable.
Once you installed these two packages, hit Configure. Three CMake variables should be set (if CMake cannot findthem, you can fill them manually) :
o DOXYGEN_EXECUTABLE : path to doxygen.exe (e.g. C:/Program Files (x86)/doxygen/bin/doxygen.exe)
o DOXYGEN_DOT_EXECUTABLE : path to dot.exe from GraphViz (e.g. C:/Program Files(x86)/Graphviz2.26.3/bin/dot.exe)
o DOXYGEN_DOT_PATH : path of the folder containing dot.exe from GraphViz (e.g. C:/Program Files(x86)/Graphviz2.26.3/bin)
Then, you need to enable the documentation project in Visual Studio by checking the BUILD_DOCUMENTATION checkboxin CMake.
You can also build one single CHM file that will gather all thegenerated html files into one file. You need the Microsoft HTML HELP Workshop. After you install the Microsoft HTML HELP Workshop, hit Configure. If CMake is notable to find HTML_HEL_COMPILER, then fill it manually with the pathto hhc.exe (e.g. C:/Program Files (x86)/HTML Help Workshop/hhc.exe),then click Configure and Generate.
Now, in PCL Visual Studio solution, you will have a new projectcalled doc. To generate the documentation files, right click on it, andchoose Build. Then, you can build the INSTALL project so that the generated documentation files getcopied to CMAKE_INSTALL_PREFIX/PCL/share/doc/pcl/html folder (e.g.C:\Program Files\PCL\share\doc\pcl\html).
Using PCL
We finally managed to compile the Point Cloud Library (PCL) asbinaries for Windows. You can start using them in your project by followingthe Using PCL in your own projecttutorial.
Our Youtube channel Google+ Facebook Followus on Twitter Site map
Exceptwhere otherwise noted, the PointClouds.org web pages are licensed under Creative Commons Attribution 3.0.
http://pointclouds.org/documentation/tutorials/using_pcl_pcl_config.php#using-pcl-pcl-config
步骤3:测试PCL是否成功安装:
http://www.pclcn.org/study/shownews.php?lang=cn&id=33
http://www.pclcn.org/study/shownews.php?lang=cn&id=34
建立两个文件,源程序文件project_inliers.cpp和cmake配置文件CMakeLists.txt内容拷贝链接http://pointclouds.org/documentation/tutorials/project_inliers.php#project-inliers中对应的代码及Cmakelists的代码(此处也可以从参考文献【1】中test文件拷贝对应的文件),放在同一文件夹source下,在source同一目录下建立camke-bin文件夹。
11 测试需要建立的文件
打开cmake,设置源文件目录与编译目录,如图12所示。
12设置cmake需要的路径
13camke中选择对应的编译器
14 配置与生成
选择对应的编译器,如图13所示,笔者选择对应visual studio 9 2008,点击finish,再点击配置与生成,如图14所示,即可得到工程文件,如图15所示。
15生成的工程文件
16编译工程文件
17 测试exe文件运行结果
打开工程文件编译链接生成Exe文件,如图2-16所示。
打开cmd.exe(win + R 快捷键),到编译输出的project_inliers.exe文件目录下运行该程序文件,可以看到相应的打印输出,如图17所示。
到此就完成了PCL在windows上的开发环境搭建,用户可以自行体验官方网站提供的大量实例代码了,如果用户只是使用稳定的PCL版本。
NOTE:
这个Cpp代码好像有问题,换一个Cpp代码测试通过!