pcl1.8.0,較pcl1.7和1.6多了不少算法,很多感興趣的方法都在pcl1.8中有所實(shí)現。當pcl11.8.0rc1和rc2發(fā)布時(shí)就迫不及待的下載下來(lái)進(jìn)行使用,用了幾個(gè)月發(fā)現pcl1.8.0rc版有幾個(gè)bug無(wú)法解決,如:表面重建時(shí)無(wú)法映射紋理。得知2016/06/14 github 發(fā)布正式版pcl1.8.0時(shí),就立馬下載下來(lái)準備編譯并記錄整個(gè)過(guò)程,感興趣的小伙伴可以參考。
pcl官網(wǎng)已經(jīng)有windows平臺下的編譯過(guò)程,現在我基于此教程編譯PCL1.8.0并配置。
下載地址:https://github.com/PointCloudLibrary/pcl/releases
編譯器VS2013,CMakeGUI 3.3.2,系統版本win7 64位。
提示:軟件版本根據自己情況選擇,沒(méi)必要非要和博客中一致。
| 第三方庫 | 用途 | 是否必須 |
|---|---|---|
| Boost | 用于智能指針等操作 | 必選 |
| Eigen | 用于矩陣運算等 | 必選 |
| FLANN | 用于鄰域搜索等 | 必選 |
| VTK | 可視化庫,用于顯示點(diǎn)云等 | 必選 |
| Qt | 用于圖像交互界面等 | 可選 |
| QHULL | used for convex/concave hull decompositions in surface | 可選 |
| OpenNI | 用于獲取點(diǎn)云等 | 可選 |
提示:在編譯PCL1.8.0時(shí)請確保您已安裝了正確的第三方依賴(lài)庫。不能混合32位和64位代碼,并且不能混用不同編譯器編譯第三方庫。有些庫需要自己編譯,這篇博客里就不對如何編譯第三方依賴(lài)庫進(jìn)行講解了,只詳述PCL1.8.0的編譯過(guò)程。
官方編譯教程:http://www.pointclouds.org/documentation/tutorials/compiling_pcl_windows.php
提示:跟著(zhù)官方教程操作即可成功。
(1) 將源碼包pcl-pcl-1.8.0.zip解壓到目錄:F:\pcl-1.8.0
提示:根據自己需要解壓即可,本博客一定程度上參考了官方教程。
(2)打開(kāi)CMakeGUI
源碼路徑:F:/pcl-1.8.0
項目路徑:F:/pcl-1.8.0/build
如圖:
(3)出現無(wú)法找到Eigen庫
BOOST_ROOT="F:\Boost"Boost_LIBRARY_DIRS="F:\Boost\lib"BOOST_INCLUDEDIR="F:\Boost\include\boost-1_59"(4)修改安裝路徑







將下列路徑加入環(huán)境變量:
F:\PCL1.8.0C\bin;F:\PCL1.8.0C\3rdParty\FLANN\bin;F:\PCL1.8.0C\3rdParty\OpenNI2\Tools;F:\PCL1.8.0C\3rdParty\Qhull\bin;F:\PCL1.8.0C\3rdParty\VTK\bin;(1)打開(kāi)VS2013新建項目,添加如下代碼
#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("example.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()) { //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;}(2)新建屬性表PCLCDebug




聯(lián)系客服