*Note that more detailed installation instructions can be found on Python-PCL's github page; however, for completeness, I have included some installation instructions.
If you're running Linux, the installation process is quite involved. You will need to run following commands:
> sudo apt-get install build-essential devscripts
> dget -u https://launchpad.net/ubuntu/+archive/primary/+files/pcl_1.7.2-14ubuntu1.16.04.1.dsc
> cd pcl-1.7.2
> sudo dpkg-buildpackage -r -uc -b
> sudo dpkg -i pcl_*.deb
Now, in this step, you will need to install several packages manually using dpkg, namely:
libpcl1.7_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl1.7-dbg_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl-apps1.7_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl-common1.7_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl-dev_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl-doc_1.7.2-14ubuntu1.16.04.1_all.deb
libpcl-features1.7_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl-filters1.7_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl-io1.7_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl-kdtree1.7_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl-keypoints1.7_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl-octree1.7_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl-outofcore1.7_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl-people1.7_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl-recognition1.7_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl-registration1.7_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl-sample-consensus1.7_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl-search1.7_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl-segmentation1.7_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl-surface1.7_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl-tracking1.7_1.7.2-14ubuntu1.16.04.1_amd64.deb
libpcl-visualization1.7_1.7.2-14ubuntu1.16.04.1_amd64.deb
pcl-tools_1.7.2-14ubuntu1.16.04.1_amd64.deb
Each of these packages should be in your pcl-1.7.2 directory and form a complex tree of dependencies; simply put, installing of these packages is a non-trivial process.
Next, you need to clone the Python-PCL repository and run the following commands:
> python setup.py build_ext -i
> python setup.py install
Finally, to verify that Python-PCL installed correctly. type import pcl in your python interpreter.
On Mac OS, the installation process is simple.
Install Homebrew and run the following commands:
> brew tap homebrew-science
> brew install pcl
Next, you need to clone the Python-PCL repository and run the following commands:
> python setup.py build_ext -i
> python setup.py install
Finally, to verify that Python-PCL installed correctly. type import pcl in your python interpreter.
See Python-PCL's Github page!
When processing point cloud data, raw data files typically have hundreds of millions of points, which are often repetitive. Subsampling provides a way to prune your point cloud data within minimal loss in fidelity. In this tutorial, we will explore a technique called voxel filtering; to learn more about voxel filtering, look here.
First, import pcl and load your point cloud data:
Notice that we need to bind the point cloud data to a PointCloud object.
Then, we will create a voxel filter from the point cloud, set a filter size, and apply the filter:
Now, we're finished! The size of the new point cloud data will depend on the size and density of the original point cloud; you should print the size of the new point cloud to verify that the filter was applied correctly.
Python-PCL can also be used to find the k-th points closest to a single point in your point cloud.
This approach uses a KdTree, which you can read more about here.
First, import pcl and load your point cloud data:
Next, we will create a KdTree from our point cloud data , pick a point to start from, and run the search:
nearest_k_search_for_cloud() will return the indices of the points closest to the points we selected!