1. 先下载 PCL-1.9.1-AllInOne-msvc2017-win64.exe 档案并安装,我的安装目录是D:\service\pcl\PCL 1.9.1
2. 然后安装D:\service\pcl\PCL 1.9.1\3rdParty\OpenNI2 目录下的OpenNI-Windows-x64-2.2.msi ,默认安装路径是C:\Program Files\OpenNI2
3. 打开VS开一个新的project
4. 添加include目录
D:\service\pcl\PCL 1.9.1\include\pcl-1.9
D:\service\pcl\PCL 1.9.1\3rdParty\Boost\include\boost-1_68
D:\service\pcl\PCL 1.9.1\3rdParty\Eigen\eigen3
D:\service\pcl\PCL 1.9.1\3rdParty\FLANN\include
D:\service\pcl\PCL 1.9.1\3rdParty\Qhull\include
D:\service\pcl\PCL 1.9.1\3rdParty\VTK\include\vtk-8.1
5. 添加lib目录
D:\service\pcl\PCL 1.9.1\lib
D:\service\pcl\PCL 1.9.1\3rdParty\Boost\lib
D:\service\pcl\PCL 1.9.1\3rdParty\FLANN\lib
D:\service\pcl\PCL 1.9.1\3rdParty\Qhull\lib
D:\service\pcl\PCL 1.9.1\3rdParty\VTK\lib
C:\Program Files\OpenNI2\Lib
6. 添加lib项目(用代码跑的)
结果太长了放在文章最后面
Java代码如下
import java.io.File;
import java.util.ArrayList;
public class List {
public static void main(String[] args) {
ArrayList list = new ArrayList<>();
list.add("D:\\service\\pcl\\PCL 1.9.1\\lib");
list.add("D:\\service\\pcl\\PCL 1.9.1\\3rdParty\\Boost\\lib");
list.add("D:\\service\\pcl\\PCL 1.9.1\\3rdParty\\FLANN\\lib");
list.add("D:\\service\\pcl\\PCL 1.9.1\\3rdParty\\Qhull\\lib");
list.add("D:\\service\\pcl\\PCL 1.9.1\\3rdParty\\VTK\\lib");
list.add("C:\\Program Files\\OpenNI2\\Lib");
for (int i = 0; i < list.size(); i++) {
File file=new File(list.get(i));
File[] files = file.listFiles();
for (File f : files) {
String name = f.getName();
if (name.endsWith(".lib")) {
System.out.println(name);
}}}}}
7. 新建立一个dll文件夹D:\service\pcl\PCL_1.9.1_dll, 把pcl安装目录和openni的安装目录下的dll全部拷贝进去
在vs 配置 dll的路径 PATH=D:\service\pcl\PCL_1.9.1_dll
8. 网上找一个pcd的文件, 我用的是这个,雷锋给的不用积分
https://download.csdn.net/download/qq_25669417/10767973
9. 运行代码
#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING
#include "pch.h"
#include
#include
#include
#include
#include
int main(int argc, char *argv[])
{
pcl::PointCloud::Ptr cloud(new pcl::PointCloud);
pcl::io::loadPCDFile("D:/service/pcl/pcd_samples/TrsfResult0.pcd", *cloud);
if (pcl::io::loadPCDFile("D:/service/pcl/pcd_samples/TrsfResult0.pcd", *cloud) == -1)
{
std::cout << "Cloud reading failed." << std::endl;
system("pause");
return (-1);
}
//std::cout << cloud->width << std::endl;
//std::cout << cloud->height;
pcl::visualization::CloudViewer viewer("Simple Cloud Viewer");
viewer.showCloud(cloud);
while (!viewer.wasStopped())
{
}
system("pause");
return (0);
}
10. 出图
--------------------------------------------------------------------------------------------------------------------------------------------------------
PCL 1.9.1全部的lib
pcl_common_debug.lib
pcl_common_release.lib
pcl_features_debug.lib
pcl_features_release.lib
pcl_filters_debug.lib
pcl_filters_release.lib
pcl_io_debug.lib
pcl_io_ply_debug.lib
pcl_io_ply_release.lib
pcl_io_release.lib
pcl_kdtree_debug.lib
pcl_kdtree_release.lib
pcl_keypoints_debug.lib
pcl_keypoints_release.lib
pcl_ml_debug.lib
pcl_ml_release.lib
pcl_octree_debug.lib
pcl_octree_release.lib
pcl_outofcore_debug.lib
pcl_outofcore_release.lib
pcl_people_debug.lib
pcl_people_release.lib
pcl_recognition_debug.lib
pcl_recognition_release.lib
pcl_registration_debug.lib
pcl_registration_release.lib
pcl_sample_consensus_debug.lib
pcl_sample_consensus_release.lib
pcl_search_debug.lib
pcl_search_release.lib
pcl_segmentation_debug.lib
pcl_segmentation_release.lib
pcl_stereo_debug.lib
pcl_stereo_release.lib
pcl_surface_debug.lib
pcl_surface_release.lib
pcl_tracking_debug.lib
pcl_tracking_release.lib
pcl_visualization_debug.lib
pcl_visualization_release.lib
libboost_atomic-vc141-mt-gd-x64-1_68.lib
libboost_atomic-vc141-mt-x64-1_68.lib
libboost_bzip2-vc141-mt-gd-x64-1_68.lib
libboost_bzip2-vc141-mt-x64-1_68.lib
libboost_chrono-vc141-mt-gd-x64-1_68.lib
libboost_chrono-vc141-mt-x64-1_68.lib
libboost_container-vc141-mt-gd-x64-1_68.lib
libboost_container-vc141-mt-x64-1_68.lib
libboost_context-vc141-mt-gd-x64-1_68.lib
libboost_context-vc141-mt-x64-1_68.lib
libboost_contract-vc141-mt-gd-x64-1_68.lib
libboost_contract-vc141-mt-x64-1_68.lib
libboost_coroutine-vc141-mt-gd-x64-1_68.lib
libboost_coroutine-vc141-mt-x64-1_68.lib
libboost_date_time-vc141-mt-gd-x64-1_68.lib
libboost_date_time-vc141-mt-x64-1_68.lib
libboost_exception-vc141-mt-gd-x64-1_68.lib
libboost_exception-vc141-mt-x64-1_68.lib
libboost_fiber-vc141-mt-gd-x64-1_68.lib
libboost_fiber-vc141-mt-x64-1_68.lib
libboost_filesystem-vc141-mt-gd-x64-1_68.lib
libboost_filesystem-vc141-mt-x64-1_68.lib
libboost_graph-vc141-mt-gd-x64-1_68.lib
libboost_graph-vc141-mt-x64-1_68.lib
libboost_graph_parallel-vc141-mt-gd-x64-1_68.lib
libboost_graph_parallel-vc141-mt-x64-1_68.lib
libboost_iostreams-vc141-mt-gd-x64-1_68.lib
libboost_iostreams-vc141-mt-x64-1_68.lib
libboost_locale-vc141-mt-gd-x64-1_68.lib
libboost_locale-vc141-mt-x64-1_68.lib
libboost_log-vc141-mt-gd-x64-1_68.lib
libboost_log-vc141-mt-x64-1_68.lib
libboost_log_setup-vc141-mt-gd-x64-1_68.lib
libboost_log_setup-vc141-mt-x64-1_68.lib
libboost_math_c99-vc141-mt-gd-x64-1_68.lib
libboost_math_c99-vc141-mt-x64-1_68.lib
libboost_math_c99f-vc141-mt-gd-x64-1_68.lib
libboost_math_c99f-vc141-mt-x64-1_68.lib
libboost_math_c99l-vc141-mt-gd-x64-1_68.lib
libboost_math_c99l-vc141-mt-x64-1_68.lib
libboost_math_tr1-vc141-mt-gd-x64-1_68.lib
libboost_math_tr1-vc141-mt-x64-1_68.lib
libboost_math_tr1f-vc141-mt-gd-x64-1_68.lib
libboost_math_tr1f-vc141-mt-x64-1_68.lib
libboost_math_tr1l-vc141-mt-gd-x64-1_68.lib
libboost_math_tr1l-vc141-mt-x64-1_68.lib
libboost_mpi-vc141-mt-gd-x64-1_68.lib
libboost_mpi-vc141-mt-x64-1_68.lib
libboost_numpy27-vc141-mt-gd-x64-1_68.lib
libboost_numpy27-vc141-mt-x64-1_68.lib
libboost_numpy37-vc141-mt-gd-x64-1_68.lib
libboost_numpy37-vc141-mt-x64-1_68.lib
libboost_prg_exec_monitor-vc141-mt-gd-x64-1_68.lib
libboost_prg_exec_monitor-vc141-mt-x64-1_68.lib
libboost_program_options-vc141-mt-gd-x64-1_68.lib
libboost_program_options-vc141-mt-x64-1_68.lib
libboost_python27-vc141-mt-gd-x64-1_68.lib
libboost_python27-vc141-mt-x64-1_68.lib
libboost_python37-vc141-mt-gd-x64-1_68.lib
libboost_python37-vc141-mt-x64-1_68.lib
libboost_random-vc141-mt-gd-x64-1_68.lib
libboost_random-vc141-mt-x64-1_68.lib
libboost_regex-vc141-mt-gd-x64-1_68.lib
libboost_regex-vc141-mt-x64-1_68.lib
libboost_serialization-vc141-mt-gd-x64-1_68.lib
libboost_serialization-vc141-mt-x64-1_68.lib
libboost_signals-vc141-mt-gd-x64-1_68.lib
libboost_signals-vc141-mt-x64-1_68.lib
libboost_stacktrace_noop-vc141-mt-gd-x64-1_68.lib
libboost_stacktrace_noop-vc141-mt-x64-1_68.lib
libboost_stacktrace_windbg-vc141-mt-gd-x64-1_68.lib
libboost_stacktrace_windbg-vc141-mt-x64-1_68.lib
libboost_stacktrace_windbg_cached-vc141-mt-gd-x64-1_68.lib
libboost_stacktrace_windbg_cached-vc141-mt-x64-1_68.lib
libboost_system-vc141-mt-gd-x64-1_68.lib
libboost_system-vc141-mt-x64-1_68.lib
libboost_test_exec_monitor-vc141-mt-gd-x64-1_68.lib
libboost_test_exec_monitor-vc141-mt-x64-1_68.lib
libboost_thread-vc141-mt-gd-x64-1_68.lib
libboost_thread-vc141-mt-x64-1_68.lib
libboost_timer-vc141-mt-gd-x64-1_68.lib
libboost_timer-vc141-mt-x64-1_68.lib
libboost_type_erasure-vc141-mt-gd-x64-1_68.lib
libboost_type_erasure-vc141-mt-x64-1_68.lib
libboost_unit_test_framework-vc141-mt-gd-x64-1_68.lib
libboost_unit_test_framework-vc141-mt-x64-1_68.lib
libboost_wave-vc141-mt-gd-x64-1_68.lib
libboost_wave-vc141-mt-x64-1_68.lib
libboost_wserialization-vc141-mt-gd-x64-1_68.lib
libboost_wserialization-vc141-mt-x64-1_68.lib
libboost_zlib-vc141-mt-gd-x64-1_68.lib
libboost_zlib-vc141-mt-x64-1_68.lib
flann-gd.lib
flann.lib
flann_cpp-gd.lib
flann_cpp.lib
flann_cpp_s-gd.lib
flann_cpp_s.lib
flann_s-gd.lib
flann_s.lib
qhull.lib
qhullcpp.lib
qhullcpp_d.lib
qhullstatic.lib
qhullstatic_d.lib
qhullstatic_r.lib
qhullstatic_r_d.lib
qhull_d.lib
qhull_p.lib
qhull_p_d.lib
qhull_r.lib
qhull_r_d.lib
vtkalglib-8.1-gd.lib
vtkalglib-8.1.lib
vtkChartsCore-8.1-gd.lib
vtkChartsCore-8.1.lib
vtkCommonColor-8.1-gd.lib
vtkCommonColor-8.1.lib
vtkCommonComputationalGeometry-8.1-gd.lib
vtkCommonComputationalGeometry-8.1.lib
vtkCommonCore-8.1-gd.lib
vtkCommonCore-8.1.lib
vtkCommonDataModel-8.1-gd.lib
vtkCommonDataModel-8.1.lib
vtkCommonExecutionModel-8.1-gd.lib
vtkCommonExecutionModel-8.1.lib
vtkCommonMath-8.1-gd.lib
vtkCommonMath-8.1.lib
vtkCommonMisc-8.1-gd.lib
vtkCommonMisc-8.1.lib
vtkCommonSystem-8.1-gd.lib
vtkCommonSystem-8.1.lib
vtkCommonTransforms-8.1-gd.lib
vtkCommonTransforms-8.1.lib
vtkDICOMParser-8.1-gd.lib
vtkDICOMParser-8.1.lib
vtkDomainsChemistry-8.1-gd.lib
vtkDomainsChemistry-8.1.lib
vtkexoIIc-8.1-gd.lib
vtkexoIIc-8.1.lib
vtkexpat-8.1-gd.lib
vtkexpat-8.1.lib
vtkFiltersAMR-8.1-gd.lib
vtkFiltersAMR-8.1.lib
vtkFiltersCore-8.1-gd.lib
vtkFiltersCore-8.1.lib
vtkFiltersExtraction-8.1-gd.lib
vtkFiltersExtraction-8.1.lib
vtkFiltersFlowPaths-8.1-gd.lib
vtkFiltersFlowPaths-8.1.lib
vtkFiltersGeneral-8.1-gd.lib
vtkFiltersGeneral-8.1.lib
vtkFiltersGeneric-8.1-gd.lib
vtkFiltersGeneric-8.1.lib
vtkFiltersGeometry-8.1-gd.lib
vtkFiltersGeometry-8.1.lib
vtkFiltersHybrid-8.1-gd.lib
vtkFiltersHybrid-8.1.lib
vtkFiltersHyperTree-8.1-gd.lib
vtkFiltersHyperTree-8.1.lib
vtkFiltersImaging-8.1-gd.lib
vtkFiltersImaging-8.1.lib
vtkFiltersModeling-8.1-gd.lib
vtkFiltersModeling-8.1.lib
vtkFiltersParallel-8.1-gd.lib
vtkFiltersParallel-8.1.lib
vtkFiltersParallelImaging-8.1-gd.lib
vtkFiltersParallelImaging-8.1.lib
vtkFiltersPoints-8.1-gd.lib
vtkFiltersPoints-8.1.lib
vtkFiltersProgrammable-8.1-gd.lib
vtkFiltersProgrammable-8.1.lib
vtkFiltersSelection-8.1-gd.lib
vtkFiltersSelection-8.1.lib
vtkFiltersSMP-8.1-gd.lib
vtkFiltersSMP-8.1.lib
vtkFiltersSources-8.1-gd.lib
vtkFiltersSources-8.1.lib
vtkFiltersStatistics-8.1-gd.lib
vtkFiltersStatistics-8.1.lib
vtkFiltersTexture-8.1-gd.lib
vtkFiltersTexture-8.1.lib
vtkFiltersTopology-8.1-gd.lib
vtkFiltersTopology-8.1.lib
vtkFiltersVerdict-8.1-gd.lib
vtkFiltersVerdict-8.1.lib
vtkfreetype-8.1-gd.lib
vtkfreetype-8.1.lib
vtkGeovisCore-8.1-gd.lib
vtkGeovisCore-8.1.lib
vtkgl2ps-8.1-gd.lib
vtkgl2ps-8.1.lib
vtkhdf5-8.1-gd.lib
vtkhdf5-8.1.lib
vtkhdf5_hl-8.1-gd.lib
vtkhdf5_hl-8.1.lib
vtkImagingColor-8.1-gd.lib
vtkImagingColor-8.1.lib
vtkImagingCore-8.1-gd.lib
vtkImagingCore-8.1.lib
vtkImagingFourier-8.1-gd.lib
vtkImagingFourier-8.1.lib
vtkImagingGeneral-8.1-gd.lib
vtkImagingGeneral-8.1.lib
vtkImagingHybrid-8.1-gd.lib
vtkImagingHybrid-8.1.lib
vtkImagingMath-8.1-gd.lib
vtkImagingMath-8.1.lib
vtkImagingMorphological-8.1-gd.lib
vtkImagingMorphological-8.1.lib
vtkImagingSources-8.1-gd.lib
vtkImagingSources-8.1.lib
vtkImagingStatistics-8.1-gd.lib
vtkImagingStatistics-8.1.lib
vtkImagingStencil-8.1-gd.lib
vtkImagingStencil-8.1.lib
vtkInfovisCore-8.1-gd.lib
vtkInfovisCore-8.1.lib
vtkInfovisLayout-8.1-gd.lib
vtkInfovisLayout-8.1.lib
vtkInteractionImage-8.1-gd.lib
vtkInteractionImage-8.1.lib
vtkInteractionStyle-8.1-gd.lib
vtkInteractionStyle-8.1.lib
vtkInteractionWidgets-8.1-gd.lib
vtkInteractionWidgets-8.1.lib
vtkIOAMR-8.1-gd.lib
vtkIOAMR-8.1.lib
vtkIOCore-8.1-gd.lib
vtkIOCore-8.1.lib
vtkIOEnSight-8.1-gd.lib
vtkIOEnSight-8.1.lib
vtkIOExodus-8.1-gd.lib
vtkIOExodus-8.1.lib
vtkIOExport-8.1-gd.lib
vtkIOExport-8.1.lib
vtkIOExportOpenGL-8.1-gd.lib
vtkIOExportOpenGL-8.1.lib
vtkIOGeometry-8.1-gd.lib
vtkIOGeometry-8.1.lib
vtkIOImage-8.1-gd.lib
vtkIOImage-8.1.lib
vtkIOImport-8.1-gd.lib
vtkIOImport-8.1.lib
vtkIOInfovis-8.1-gd.lib
vtkIOInfovis-8.1.lib
vtkIOLegacy-8.1-gd.lib
vtkIOLegacy-8.1.lib
vtkIOLSDyna-8.1-gd.lib
vtkIOLSDyna-8.1.lib
vtkIOMINC-8.1-gd.lib
vtkIOMINC-8.1.lib
vtkIOMovie-8.1-gd.lib
vtkIOMovie-8.1.lib
vtkIONetCDF-8.1-gd.lib
vtkIONetCDF-8.1.lib
vtkIOParallel-8.1-gd.lib
vtkIOParallel-8.1.lib
vtkIOParallelXML-8.1-gd.lib
vtkIOParallelXML-8.1.lib
vtkIOPLY-8.1-gd.lib
vtkIOPLY-8.1.lib
vtkIOSQL-8.1-gd.lib
vtkIOSQL-8.1.lib
vtkIOTecplotTable-8.1-gd.lib
vtkIOTecplotTable-8.1.lib
vtkIOVideo-8.1-gd.lib
vtkIOVideo-8.1.lib
vtkIOXML-8.1-gd.lib
vtkIOXML-8.1.lib
vtkIOXMLParser-8.1-gd.lib
vtkIOXMLParser-8.1.lib
vtkjpeg-8.1-gd.lib
vtkjpeg-8.1.lib
vtkjsoncpp-8.1-gd.lib
vtkjsoncpp-8.1.lib
vtklibharu-8.1-gd.lib
vtklibharu-8.1.lib
vtklibxml2-8.1-gd.lib
vtklibxml2-8.1.lib
vtklz4-8.1-gd.lib
vtklz4-8.1.lib
vtkmetaio-8.1-gd.lib
vtkmetaio-8.1.lib
vtkNetCDF-8.1-gd.lib
vtkNetCDF-8.1.lib
vtknetcdfcpp-8.1-gd.lib
vtknetcdfcpp-8.1.lib
vtkoggtheora-8.1-gd.lib
vtkoggtheora-8.1.lib
vtkParallelCore-8.1-gd.lib
vtkParallelCore-8.1.lib
vtkpng-8.1-gd.lib
vtkpng-8.1.lib
vtkproj4-8.1-gd.lib
vtkproj4-8.1.lib
vtkRenderingAnnotation-8.1-gd.lib
vtkRenderingAnnotation-8.1.lib
vtkRenderingContext2D-8.1-gd.lib
vtkRenderingContext2D-8.1.lib
vtkRenderingContextOpenGL-8.1-gd.lib
vtkRenderingContextOpenGL-8.1.lib
vtkRenderingCore-8.1-gd.lib
vtkRenderingCore-8.1.lib
vtkRenderingFreeType-8.1-gd.lib
vtkRenderingFreeType-8.1.lib
vtkRenderingGL2PS-8.1-gd.lib
vtkRenderingGL2PS-8.1.lib
vtkRenderingImage-8.1-gd.lib
vtkRenderingImage-8.1.lib
vtkRenderingLabel-8.1-gd.lib
vtkRenderingLabel-8.1.lib
vtkRenderingLIC-8.1-gd.lib
vtkRenderingLIC-8.1.lib
vtkRenderingLOD-8.1-gd.lib
vtkRenderingLOD-8.1.lib
vtkRenderingOpenGL-8.1-gd.lib
vtkRenderingOpenGL-8.1.lib
vtkRenderingVolume-8.1-gd.lib
vtkRenderingVolume-8.1.lib
vtkRenderingVolumeOpenGL-8.1-gd.lib
vtkRenderingVolumeOpenGL-8.1.lib
vtksqlite-8.1-gd.lib
vtksqlite-8.1.lib
vtksys-8.1-gd.lib
vtksys-8.1.lib
vtktiff-8.1-gd.lib
vtktiff-8.1.lib
vtkverdict-8.1-gd.lib
vtkverdict-8.1.lib
vtkViewsContext2D-8.1-gd.lib
vtkViewsContext2D-8.1.lib
vtkViewsCore-8.1-gd.lib
vtkViewsCore-8.1.lib
vtkViewsInfovis-8.1-gd.lib
vtkViewsInfovis-8.1.lib
vtkzlib-8.1-gd.lib
vtkzlib-8.1.lib
OpenNI2.lib