Point Clouds Library (PCL) is an open-source project developed by Radu Bogdan and others. Its initial motivation was to focus on the application of point cloud sensing and integrate a large number of advanced 3D sensing methods, applicable to 3 Building blcoks. The algorithm implemented in this library includes: filtering, feature estimation, surface reconstruction, registration, model fitting and segmentation. the PCL Library also supports ROS (robot operating system ).
The PCL library is a template-based modern c ++ language implementation that fully utilizes SSE optimization commands at the underlying layer. A large number of open-source libraries are used in the algorithm, including eigen (an Open Source template library for linear algebra), OpenMP (refer to the website: http://openmp.org), the TBB library for multi-core parallel computing developed by Intel (threading building blocks) and FLANN (fast K-nearest for approximate nearest neighbors). In addition, in terms of 3D presentation, the PCL library introduces VTK (Visualization Toolkit ).
During the design of the PCL, the simplicity and convenience of development are taken into account. These function libraries are divided into smaller blocks for compilation, including the following modules:
(1) libpcl_filters: implements data filtering, such as downsampling, abnormal data processing, indices extraction, and projection.
(2) libpcl_feature: This library contains a large number of 3D features such as surface normals, curvatures, boundary point estimation, moment invariants, principal curvatures, PFH and fpfh descriptors, rift, RSD, vfh, sifht.
(3) libpcl_io: Mainly used for input and output.
(4) libpcl_segmentation: Implements cluster extraction, model fitting, and polygonal prism extraction.
In addition, it includes libpcl_surface, libpcl_registration, libpcl_keypoints, libpcl_range_image, and other modules. For more information, see the official website: http://www.pointclouds.org /.
To use the PCL, first download the library, download the corresponding version from the official website, and select the all-in-one installation package. This package contains all third-party compilation packages used in the PCL. After the download is complete, install it directly. The path can be installed as needed. After the installation is complete: add the corresponding library file to the environment variable (if you want to use a third-party library, add the third-party library file to the environment variable ):
Next, add the corresponding path to the development environment ide. In this article, "tools-options-projects and Solutions" in vs2008 ":
1) configuration of the executable file Bin
2) include file configuration
3) library file lib Configuration
Note: The configuration above is just an example. When configuring, developers must configure all the corresponding files, that is, it includes the configuration of files corresponding to the PCL library and all third-party libraries.
The following is a simple example of using the PCL Library (add the Lib file used in the additional dependencies of the project properties. If you do not know which lib file is used, add all lib files), including:
Debug:
Pcl_cmd_debug.lib
Pcl_common_debug.lib
Pcl_features_debug.lib
Pcl_filters_debug.lib
Pcl_io_debug.lib
Pcl_io_ply_debug.lib
Pcl_kdtree_debug.lib
Pcl_keypoints_debug.lib
Pcl_octree_debug.lib
Pcl_range_image_border_extractor_debug.lib
Pcl_registration_debug.lib
Pcl_sample_consensus_debug.lib
Pcl_search_debug.lib
Pcl_segmentation_debug.lib
Pcl_surface_debug.lib
Pcl_tracking_debug.lib
Pcl_visualization_debug.lib
Release:
Pcl_pai_release.lib
Pcl_common_release.lib
Pcl_features_release.lib
Pcl_filters_release.lib
Pcl_io_release.lib
Pcl_io_ply_release.lib
Pcl_kdtree_release.lib
Pcl_keypoints_release.lib
Pcl_octree_release.lib
Pcl_range_image_border_extractor_release.lib
Pcl_registration_release.lib
Pcl_sample_consensus_release.lib
Pcl_search_release.lib
Pcl_segmentation_release.lib
Pcl_surface_release.lib
Pcl_tracking_release.lib
Pcl_visualization_release.lib
The program code is as follows:
#include <iostream>#include <pcl/io/pcd_io.h>#include <pcl/point_types.h>using namespace std;int main( int argc, char* argv[]){pcl::PointCloud<pcl::PointXYZ> cloud;cloud.width = 5;cloud.height = 1;cloud.is_dense = false;cloud.points.resize(cloud.height*cloud.width);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);}pcl::io::savePCDFileASCII("test_pcd.pcd",cloud);std::cerr<<"Saved"<< cloud.points.size()<<" data points to test_pcd.pcd."<<std::endl;for ( size_t i=0; i<cloud.points.size(); ++i ){std::cerr<<" cloud.points[i].x "<<cloud.points[i].x<<endl<<" cloud.points[i].yx "<<cloud.points[i].y<<endl<<" cloud.points[i].z "<<cloud.points[i].z<<endl;}char c= (char)getchar();return 1;}
The execution result is as follows: