Package: pclpy
pclpy: PCL for pythonPython bindings for the Point Cloud Library (PCL).
Generated from headers using CppHeaderParser and pybind11.This library is in active development, the api is likely to change.
The included modules do work, but tests are incomplete, and corner
cases are still common.Only Windows and python 3.6 x64 are supported at the moment.Contributions, issues, comments are welcome!Github repository:https://www.github.com/davidcaron/pclpyPypi:https://pypi.org/project/pclpy/MotivationMany other python libraries tried to bind PCL.
The most popular one being python-pcl, which uses Cython.
While Cython is really powerful, binding C++ templates isn't one of
its strenghts (and PCL uses templates heavily).
The result for python-pcl is a lot of code repetition, which is hard
to maintain and to add features to, and incomplete bindings of PCL's classes
and point types.Using pybind11, we use C++ directly. Templates, boost::smart_ptr and
the buffer protocol are examples of things that are simpler to implement.The results so far are very promising. A large percentage of PCL is covered.InstallingWindows with python 3.6 x64pip install pclpyWhen pip installs the project,pclpy_dependenciesis installed as a requirement.
This simple package contains only the PCL dlls required on Windows so you don't have
to download a PCL release or build it.LinuxNot working for now. Contributions are welcome!FeaturesAll point types are implemented (those specified by the default msvc compile flags)You can view point cloud data as numpy arrays usingcloud.xorcloud.xyzboost::shared_ptr is handled by pybind11 so it's completely abstracted at the python levellaspy integration for reading/writing las filesExampleYou can use either a high level, more pythonic api, or the wrapper over the PCL api.
The wrapper is meant to be as close as possible to the original PCL C++ api.Here is how you would use the library to process Moving Least Squares.
See the PCL documentation:http://pointclouds.org/documentation/tutorials/resampling.phpUsing the higher level api:importpclpy# read a las filepoint_cloud=pclpy.read("street.las","PointXYZRGBA")# compute mlsoutput=point_cloud.moving_least_squares(search_radius=0.05,compute_normals=True,num_threads=8)Or the wrapper over the PCL api:importpclpyfrompclpyimportpclpoint_cloud=pclpy.read("street.las","PointXYZRGBA")mls=pcl.surface.MovingLeastSquaresOMP.PointXYZRGBA_PointNormal()tree=pcl.search.KdTree.PointXYZRGBA()mls.setSearchRadius(0.05)mls.setPolynomialFit(False)mls.setNumberOfThreads(12)mls.setInputCloud(point_cloud)mls.setSearchMethod(tree)mls.setComputeNormals(True)output=pcl.PointCloud.PointNormal()mls.process(output)You can see the wrapper is very close to the C++ version:// C++ versionpcl::PointCloud<pcl::PointXYZ>::Ptrpoint_cloud(newpcl::PointCloud<pcl::PointXYZ>());pcl::io::loadPCDFile("bunny.pcd",*point_cloud);pcl::MovingLeastSquaresOMP<pcl::PointXYZ,pcl::PointNormal>mls;pcl::search::KdTree<pcl::PointXYZ>::Ptrtree(newpcl::search::KdTree<pcl::PointXYZ>);mls.setSearchRadius(0.05);mls.setPolynomialFit(false);mls.setNumberOfThreads(12);mls.setInputCloud(point_cloud);mls.setSearchMethod(tree);mls.setComputeNormals(true);pcl::PointCloud<pcl::PointNormal>output;mls.process(output);Modules2dcommongeometryfeaturesfiltersiokdtreekeypointsoctreerecognitionsample_consensussearchsegmentationstereosurfacetrackingvisualizationThese modules are skipped for nowmlpeopleoutofcoreregistrationevery module not in the PCL Windows release (gpu, cuda, etc.)Not Implemented(seegithub issuesand thewhat to skipsection ingenerators/config.py)To buildWindows with python 3.6 x64Download PCL release for Windows (PCL-1.8.1-AllInOne-msvc2017-win64.exe) at:https://github.com/PointCloudLibrary/pcl/releases/download/pcl-1.8.1/PCL-1.8.1-AllInOne-msvc2017-win64.exePCL_ROOT environment variable must be set to the installation directory of PCLAbout requirements:Install pybind11 from github (2.3dev version) it includes a necessary bug fixInstall CppHeaderParser fromhttps://github.com/davidcaron/CppHeaderParser(specific bug fixes)Generate modules usinggenerate_pybind11_bindings.pyThere is a missing file from the PCL release that you should get from the github repo: 2d/impl/kernel.hppMust be built with x64 version of cl.exe because of the large memory usage (see workaround in setup.py)python setup.py installUseful setup.py arguments:--msvc-mp-build should enable a multiprocessed build--msvc-no-code-link makes linking much faster (do not use for releases, see setup.py description)--use-clcache to cache msvc builds using clcache (must be installed)--debug to build in debug modeRoadmapWrap as much of PCL as reasonably possibleMore testsCI on AppveyorMake it work on Linux