2016년 3월 14일 월요일

[PCL] Point cloud library install on window 8, msvc2010

1. Download and install files: http://pointclouds.org/downloads/

2. Add environmental variable PATH in MyPC 

3. Open VS 2010

4. Add include directories in Project properties
C:\Program Files\PCL 1.6.0\include\pcl-1.6;
C:\Program Files\PCL 1.6.0\3rdParty\Boost\include;
C:\Program Files\PCL 1.6.0\3rdParty\Eigen\include;
C:\Program Files\PCL 1.6.0\3rdParty\FLANN\include;
C:\Program Files\PCL 1.6.0\3rdParty\Qhull\include;
C:\Program Files\PCL 1.6.0\3rdParty\VTK\include\vtk-5.8;

5. Add library directories in Project properties
C:\Program Files\PCL 1.6.0\lib;
C:\Program Files\PCL 1.6.0\3rdParty\Boost\lib;
C:\Program Files\PCL 1.6.0\3rdParty\FLANN\lib;
C:\Program Files\PCL 1.6.0\3rdParty\Qhull\lib;
C:\Program Files\PCL 1.6.0\3rdParty\VTK\lib\vtk-5.8;

6. Add libraries 
#pragma comment(lib, "pcl_apps_debug.lib")
#pragma comment(lib, "pcl_common_debug.lib")
#pragma comment(lib, "pcl_features_debug.lib")
#pragma comment(lib, "pcl_filters_debug.lib")
#pragma comment(lib, "pcl_io_debug.lib")
#pragma comment(lib, "pcl_io_ply_debug.lib")
#pragma comment(lib, "pcl_kdtree_debug.lib")
#pragma comment(lib, "pcl_keypoints_debug.lib")
#pragma comment(lib, "pcl_octree_debug.lib")
#pragma comment(lib, "pcl_registration_debug.lib")
#pragma comment(lib, "pcl_sample_consensus_debug.lib")
#pragma comment(lib, "pcl_search_debug.lib")
#pragma comment(lib, "pcl_segmentation_debug.lib")
#pragma comment(lib, "pcl_surface_debug.lib")
#pragma comment(lib, "pcl_tracking_debug.lib")
#pragma comment(lib, "pcl_visualization_debug.lib")

** I don't need above all things but I don't know, what they do................

7. Types sample codes

#include <pcl/visualization/cloud_viewer.h>
#include <iostream>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>


int main ()
{
 pcl::PointCloud<pcl::PointXYZ> cloud;
 cloud.width    = 10000;
 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);
 }
 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;

 pcl::visualization::CloudViewer viewer("PCL Viewer");
 viewer.showCloud(cloud.makeShared());
 while (!viewer.wasStopped());
 return 0;
}


<results>