PCL+VS2010环境配置

1、下载

http://www.pointclouds.org/downloads/windows.html出下载PCL完全安装包1.6.0 all-in-one-installer,我的电脑是32位的选择Windows MSVC 2010 (32bit)

2、安装

安装在了

  
  
  
  
  1. D:\Program Files\PCL\

3、配置环境变量

添加环境变量PCL_ROOT

  
  
  
  
  1. D:\Program Files\PCL\

系统路径path后添加:

  
  
  
  
  1. D:\Program Files\OpenNI\Bin;%PCL_ROOT%\bin;%PCL_ROOT%\3rdParty\FLANN\bin;%PCL_ROOT%\3rdParty\Qhull\bin;

4、新建工程

新建Win32控制台应用程序,空工程,拷贝源文件

  
  
  
  
  1. D:\Program Files\PCL\share\doc\pcl-1.6\tutorials\sources\cloud_viewer\cloud_viewer.cpp

到工程目录下,添加到工程

cloud_viewer.cpp

  
  
  
  
  1. #include <pcl/visualization/cloud_viewer.h>
  2. #include <iostream>
  3. #include <pcl/io/io.h>
  4. #include <pcl/io/pcd_io.h>
  5. int user_data;
  6. void
  7. viewerOneOff (pcl::visualization::PCLVisualizer& viewer)
  8. {
  9. viewer.setBackgroundColor (1.0, 0.5, 1.0);
  10. pcl::PointXYZ o;
  11. o.x = 1.0;
  12. o.y = 0;
  13. o.z = 0;
  14. viewer.addSphere (o, 0.25, "sphere", 0);
  15. std::cout << "i only run once" << std::endl;
  16. }
  17. void
  18. viewerPsycho (pcl::visualization::PCLVisualizer& viewer)
  19. {
  20. static unsigned count = 0;
  21. std::stringstream ss;
  22. ss << "Once per viewer loop: " << count++;
  23. viewer.removeShape ("text", 0);
  24. viewer.addText (ss.str(), 200, 300, "text", 0);
  25. //FIXME: possible race condition here:
  26. user_data++;
  27. }
  28. int
  29. main ()
  30. {
  31. pcl::PointCloud<pcl::PointXYZRGBA>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZRGBA>);
  32. pcl::io::loadPCDFile ("my_point_cloud.pcd", *cloud);
  33. pcl::visualization::CloudViewer viewer("Cloud Viewer");
  34. //blocks until the cloud is actually rendered
  35. viewer.showCloud(cloud);
  36. //use the following functions to get access to the underlying more advanced/powerful
  37. //PCLVisualizer
  38. //This will only get called once
  39. viewer.runOnVisualizationThreadOnce (viewerOneOff);
  40. //This will get called once per visualization iteration
  41. viewer.runOnVisualizationThread (viewerPsycho);
  42. while (!viewer.wasStopped ())
  43. {
  44. //you can also do cool processing here
  45. //FIXME: Note that this is running in a separate thread from viewerPsycho
  46. //and you should guard against race conditions yourself...
  47. user_data++;
  48. }
  49. return 0;
  50. }

5、配置工程

你可以把安装目录D:\Program Files\PCL\改成自己的安装目录 项目属性->VC++目录->包含目录 添加

  
  
  
  
  1. D:\Program Files\PCL\3rdParty\Boost\include;D:\Program Files\PCL\3rdParty\Eigen\include;D:\Program Files\PCL\3rdParty\Flann\include;D:\Program Files\PCL\3rdParty\Qhull\include;D:\Program Files\PCL\3rdParty\VTK\include\vtk-5.8;C:\Program Files\OpenNI\Include;D:\Program Files\PCL\include\pcl-1.6;

项目属性->VC++目录->库目录 添加

  
  
  
  
  1. D:\Program Files\PCL\3rdParty\Boost\lib;D:\Program Files\PCL\3rdParty\Qhull\lib;D:\Program Files\PCL\3rdParty\FLANN\lib;D:\Program Files\PCL\3rdParty\VTK\lib\vtk-5.8;D:\Program Files\PCL\lib;C:\Program Files\OpenNI\Lib;

dubug模式,链接器->输入->附加依赖项 添加

  
  
  
  
  1. opengl32.lib
  2. pcl_kdtree_debug.lib
  3. pcl_io_debug.lib
  4. pcl_search_debug.lib
  5. pcl_segmentation_debug.lib
  6. pcl_apps_debug.lib
  7. pcl_features_debug.lib
  8. pcl_filters_debug.lib
  9. pcl_visualization_debug.lib
  10. pcl_common_debug.lib
  11. flann_cpp_s-gd.lib
  12. libboost_system-vc100-mt-gd-1_47.lib
  13. libboost_filesystem-vc100-mt-gd-1_47.lib
  14. libboost_thread-vc100-mt-gd-1_47.lib
  15. libboost_date_time-vc100-mt-gd-1_47.lib
  16. libboost_iostreams-vc100-mt-gd-1_47.lib
  17. vtkalglib-gd.lib
  18. vtkCharts-gd.lib
  19. vtkCommon-gd.lib
  20. vtkDICOMParser-gd.lib
  21. vtkexoIIc-gd.lib
  22. vtkexpat-gd.lib
  23. vtkFiltering-gd.lib
  24. vtkfreetype-gd.lib
  25. vtkftgl-gd.lib
  26. vtkGenericFiltering-gd.lib
  27. vtkGeovis-gd.lib
  28. vtkGraphics-gd.lib
  29. vtkhdf5-gd.lib
  30. vtkHybrid-gd.lib
  31. vtkImaging-gd.lib
  32. vtkInfovis-gd.lib
  33. vtkIO-gd.lib
  34. vtkjpeg-gd.lib
  35. vtklibxml2-gd.lib
  36. vtkmetaio-gd.lib
  37. vtkNetCDF-gd.lib
  38. vtkNetCDF_cxx-gd.lib
  39. vtkpng-gd.lib
  40. vtkproj4-gd.lib
  41. vtkRendering-gd.lib
  42. vtksqlite-gd.lib
  43. vtksys-gd.lib
  44. vtktiff-gd.lib
  45. vtkverdict-gd.lib
  46. vtkViews-gd.lib
  47. vtkVolumeRendering-gd.lib
  48. vtkWidgets-gd.lib
  49. vtkzlib-gd.lib

正常情况下,此时是可以编译通过的,但是执行时找不到mypointcloud.pcd文件,创建mypointcloud.pcd文件

  
  
  
  
  1. # .PCD v.7 - Point Cloud Data file format
  2. VERSION .7
  3. FIELDS x y z rgb
  4. SIZE 4 4 4 4
  5. TYPE F F F F
  6. COUNT 1 1 1 1
  7. WIDTH 213
  8. HEIGHT 1
  9. VIEWPOINT 0 0 0 1 0 0 0
  10. POINTS 213
  11. DATA ascii
  12. 0.93773 0.33763 0 4.2108e+06
  13. 0.90805 0.35641 0 4.2108e+06
  14. 0.81915 0.32 0 4.2108e+06
  15. 0.97192 0.278 0 4.2108e+06
  16. 0.944 0.29474 0 4.2108e+06
  17. 0.98111 0.24247 0 4.2108e+06
  18. 0.93655 0.26143 0 4.2108e+06
  19. 0.91631 0.27442 0 4.2108e+06
  20. 0.81921 0.29315 0 4.2108e+06
  21. 0.90701 0.24109 0 4.2108e+06
  22. 0.83239 0.23398 0 4.2108e+06
  23. 0.99185 0.2116 0 4.2108e+06
  24. 0.89264 0.21174 0 4.2108e+06
  25. 0.85082 0.21212 0 4.2108e+06
  26. 0.81044 0.32222 0 4.2108e+06
  27. 0.74459 0.32192 0 4.2108e+06
  28. 0.69927 0.32278 0 4.2108e+06
  29. 0.8102 0.29315 0 4.2108e+06
  30. 0.75504 0.29765 0 4.2108e+06
  31. 0.8102 0.24399 0 4.2108e+06
  32. 0.74995 0.24723 0 4.2108e+06
  33. 0.68049 0.29768 0 4.2108e+06
  34. 0.66509 0.29002 0 4.2108e+06
  35. 0.69441 0.2526 0 4.2108e+06
  36. 0.62807 0.22187 0 4.2108e+06
  37. 0.58706 0.32199 0 4.2108e+06
  38. 0.52125 0.31955 0 4.2108e+06
  39. 0.49351 0.32282 0 4.2108e+06
  40. 0.44313 0.32169 0 4.2108e+06
  41. 0.58678 0.2929 0 4.2108e+06
  42. 0.53436 0.29164 0 4.2108e+06
  43. 0.59308 0.24134 0 4.2108e+06
  44. 0.5357 0.2444 0 4.2108e+06
  45. 0.50043 0.31235 0 4.2108e+06
  46. 0.44107 0.29711 0 4.2108e+06
  47. 0.50727 0.22193 0 4.2108e+06
  48. 0.43957 0.23976 0 4.2108e+06
  49. 0.8105 0.21112 0 4.2108e+06
  50. 0.73555 0.2114 0 4.2108e+06
  51. 0.69907 0.21082 0 4.2108e+06
  52. 0.63327 0.21154 0 4.2108e+06
  53. 0.59165 0.21201 0 4.2108e+06
  54. 0.52477 0.21491 0 4.2108e+06
  55. 0.49375 0.21006 0 4.2108e+06
  56. 0.4384 0.19632 0 4.2108e+06
  57. 0.43425 0.16052 0 4.2108e+06
  58. 0.3787 0.32173 0 4.2108e+06
  59. 0.33444 0.3216 0 4.2108e+06
  60. 0.23815 0.32199 0 4.808e+06
  61. 0.3788 0.29315 0 4.2108e+06
  62. 0.33058 0.31073 0 4.2108e+06
  63. 0.3788 0.24399 0 4.2108e+06
  64. 0.30249 0.29189 0 4.2108e+06
  65. 0.23492 0.29446 0 4.808e+06
  66. 0.29465 0.24399 0 4.2108e+06
  67. 0.23514 0.24172 0 4.808e+06
  68. 0.18836 0.32277 0 4.808e+06
  69. 0.15992 0.32176 0 4.808e+06
  70. 0.08642 0.32181 0 4.808e+06
  71. 0.039994 0.32283 0 4.808e+06
  72. 0.20039 0.31211 0 4.808e+06
  73. 0.1417 0.29506 0 4.808e+06
  74. 0.20921 0.22332 0 4.808e+06
  75. 0.13884 0.24227 0 4.808e+06
  76. 0.085123 0.29441 0 4.808e+06
  77. 0.048446 0.31279 0 4.808e+06
  78. 0.086957 0.24399 0 4.808e+06
  79. 0.3788 0.21189 0 4.2108e+06
  80. 0.29465 0.19323 0 4.2108e+06
  81. 0.23755 0.19348 0 4.808e+06
  82. 0.29463 0.16054 0 4.2108e+06
  83. 0.23776 0.16054 0 4.808e+06
  84. 0.19016 0.21038 0 4.808e+06
  85. 0.15704 0.21245 0 4.808e+06
  86. 0.08678 0.21169 0 4.808e+06
  87. 0.012746 0.32168 0 4.808e+06
  88. -0.075715 0.32095 0 4.808e+06
  89. -0.10622 0.32304 0 4.808e+06
  90. -0.16391 0.32118 0 4.808e+06
  91. 0.00088411 0.29487 0 4.808e+06
  92. -0.057568 0.29457 0 4.808e+06
  93. -0.0034333 0.24399 0 4.808e+06
  94. -0.055185 0.24185 0 4.808e+06
  95. -0.10983 0.31352 0 4.808e+06
  96. -0.15082 0.29453 0 4.808e+06
  97. -0.11534 0.22049 0 4.808e+06
  98. -0.15155 0.24381 0 4.808e+06
  99. -0.1912 0.32173 0 4.808e+06
  100. -0.281 0.3185 0 4.808e+06
  101. -0.30791 0.32307 0 4.808e+06
  102. -0.33854 0.32148 0 4.808e+06
  103. -0.21248 0.29805 0 4.808e+06
  104. -0.26372 0.29905 0 4.808e+06
  105. -0.22562 0.24399 0 4.808e+06
  106. -0.25035 0.2371 0 4.808e+06
  107. -0.29941 0.31191 0 4.808e+06
  108. -0.35845 0.2954 0 4.808e+06
  109. -0.29231 0.22236 0 4.808e+06
  110. -0.36101 0.24172 0 4.808e+06
  111. -0.0034393 0.21129 0 4.808e+06
  112. -0.07306 0.21304 0 4.808e+06
  113. -0.10579 0.2099 0 4.808e+06
  114. -0.13642 0.21411 0 4.808e+06
  115. -0.22562 0.19323 0 4.808e+06
  116. -0.24439 0.19799 0 4.808e+06
  117. -0.22591 0.16041 0 4.808e+06
  118. -0.23466 0.16082 0 4.808e+06
  119. -0.3077 0.20998 0 4.808e+06
  120. -0.3413 0.21239 0 4.808e+06
  121. -0.40551 0.32178 0 4.2108e+06
  122. -0.50568 0.3218 0 4.2108e+06
  123. -0.41732 0.30844 0 4.2108e+06
  124. -0.44237 0.28859 0 4.2108e+06
  125. -0.41591 0.22004 0 4.2108e+06
  126. -0.44803 0.24236 0 4.2108e+06
  127. -0.50623 0.29315 0 4.2108e+06
  128. -0.50916 0.24296 0 4.2108e+06
  129. -0.57019 0.22334 0 4.2108e+06
  130. -0.59611 0.32199 0 4.2108e+06
  131. -0.65104 0.32199 0 4.2108e+06
  132. -0.72566 0.32129 0 4.2108e+06
  133. -0.75538 0.32301 0 4.2108e+06
  134. -0.59653 0.29315 0 4.2108e+06
  135. -0.65063 0.29315 0 4.2108e+06
  136. -0.59478 0.24245 0 4.2108e+06
  137. -0.65063 0.24399 0 4.2108e+06
  138. -0.70618 0.29525 0 4.2108e+06
  139. -0.76203 0.31284 0 4.2108e+06
  140. -0.70302 0.24183 0 4.2108e+06
  141. -0.77062 0.22133 0 4.2108e+06
  142. -0.41545 0.21099 0 4.2108e+06
  143. -0.45004 0.19812 0 4.2108e+06
  144. -0.4475 0.1673 0 4.2108e+06
  145. -0.52031 0.21236 0 4.2108e+06
  146. -0.55182 0.21045 0 4.2108e+06
  147. -0.5965 0.21131 0 4.2108e+06
  148. -0.65064 0.2113 0 4.2108e+06
  149. -0.72216 0.21286 0 4.2108e+06
  150. -0.7556 0.20987 0 4.2108e+06
  151. -0.78343 0.31973 0 4.2108e+06
  152. -0.87572 0.32111 0 4.2108e+06
  153. -0.90519 0.32263 0 4.2108e+06
  154. -0.95526 0.34127 0 4.2108e+06
  155. -0.79774 0.29271 0 4.2108e+06
  156. -0.85618 0.29497 0 4.2108e+06
  157. -0.79975 0.24326 0 4.2108e+06
  158. -0.8521 0.24246 0 4.2108e+06
  159. -0.91157 0.31224 0 4.2108e+06
  160. -0.95031 0.29572 0 4.2108e+06
  161. -0.92223 0.2213 0 4.2108e+06
  162. -0.94979 0.24354 0 4.2108e+06
  163. -0.78641 0.21505 0 4.2108e+06
  164. -0.87094 0.21237 0 4.2108e+06
  165. -0.90637 0.20934 0 4.2108e+06
  166. -0.93777 0.21481 0 4.2108e+06
  167. 0.22244 -0.0296 0 4.808e+06
  168. 0.2704 -0.078167 0 4.808e+06
  169. 0.24416 -0.056883 0 4.808e+06
  170. 0.27311 -0.10653 0 4.808e+06
  171. 0.26172 -0.10653 0 4.808e+06
  172. 0.2704 -0.1349 0 4.808e+06
  173. 0.24428 -0.15599 0 4.808e+06
  174. 0.19017 -0.025297 0 4.808e+06
  175. 0.14248 -0.02428 0 4.808e+06
  176. 0.19815 -0.037432 0 4.808e+06
  177. 0.14248 -0.03515 0 4.808e+06
  178. 0.093313 -0.02428 0 4.808e+06
  179. 0.044144 -0.02428 0 4.808e+06
  180. 0.093313 -0.03515 0 4.808e+06
  181. 0.044144 -0.03515 0 4.808e+06
  182. 0.21156 -0.17357 0 4.808e+06
  183. 0.029114 -0.12594 0 4.2108e+06
  184. 0.036583 -0.15619 0 4.2108e+06
  185. 0.22446 -0.20514 0 4.808e+06
  186. 0.2208 -0.2369 0 4.808e+06
  187. 0.2129 -0.208 0 4.808e+06
  188. 0.19316 -0.25672 0 4.808e+06
  189. 0.14497 -0.27484 0 4.808e+06
  190. 0.030167 -0.18748 0 4.2108e+06
  191. 0.1021 -0.27453 0 4.808e+06
  192. 0.1689 -0.2831 0 4.808e+06
  193. 0.13875 -0.28647 0 4.808e+06
  194. 0.086993 -0.29568 0 4.808e+06
  195. 0.044924 -0.3154 0 4.808e+06
  196. -0.0066125 -0.02428 0 4.808e+06
  197. -0.057362 -0.02428 0 4.808e+06
  198. -0.0066125 -0.03515 0 4.808e+06
  199. -0.057362 -0.03515 0 4.808e+06
  200. -0.10653 -0.02428 0 4.808e+06
  201. -0.15266 -0.025282 0 4.808e+06
  202. -0.10653 -0.03515 0 4.808e+06
  203. -0.16036 -0.037257 0 4.808e+06
  204. 0.0083286 -0.1259 0 4.2108e+06
  205. 0.0007442 -0.15603 0 4.2108e+06
  206. -0.1741 -0.17381 0 4.808e+06
  207. -0.18502 -0.02954 0 4.808e+06
  208. -0.20707 -0.056403 0 4.808e+06
  209. -0.23348 -0.07764 0 4.808e+06
  210. -0.2244 -0.10653 0 4.808e+06
  211. -0.23604 -0.10652 0 4.808e+06
  212. -0.20734 -0.15641 0 4.808e+06
  213. -0.23348 -0.13542 0 4.808e+06
  214. 0.0061083 -0.18729 0 4.2108e+06
  215. -0.066235 -0.27472 0 4.808e+06
  216. -0.17577 -0.20789 0 4.808e+06
  217. -0.10861 -0.27494 0 4.808e+06
  218. -0.15584 -0.25716 0 4.808e+06
  219. -0.0075775 -0.31546 0 4.808e+06
  220. -0.050817 -0.29595 0 4.808e+06
  221. -0.10306 -0.28653 0 4.808e+06
  222. -0.1319 -0.2831 0 4.808e+06
  223. -0.18716 -0.20571 0 4.808e+06
  224. -0.18369 -0.23729 0 4.808e+06

6、执行效果

PCL+VS2010环境配置_第1张图片

你可能感兴趣的:(PCL+VS2010环境配置)