This is a small python binding to the
import pcl
import numpy as np
p = pcl.PointCloud(np.array([[1, 2, 3], [3, 4, 5]], dtype=np.float32))
seg = p.make_segmenter()
seg.set_model_type(pcl.SACMODEL_PLANE)
seg.set_method_type(pcl.SAC_RANSAC)
indices, model = seg.segment()
or, for smoothing Point clouds can be viewed as NumPy arrays, so modifying them is possible
using all the familiar NumPy functionality: More samples can be found in the unit tests. This work was supported by Requirements
This release has been tested on Linux Ubuntu 16.04 with This release has been tested on Linux Ubuntu 18.04 with and MacOS with and Windows with and Windows with and Windows with Ubuntu16.04/18.04 (use official package) PCL 1.8.x/1.9.x and Ubuntu16.04/18.04(build module)([CI Test Timeout]) Build Module Case1. use homebrew(PCL 1.9.1 - 2018年12月25日 current) Install PCL Module. $ brew tap homebrew/science $ brew install pcl Case1. use old homebrew(PCL 1.8.1 - 2017年11月13日 current) Check git log. $ cd /usr/local/Library/Formula $ git log ... git checkout (target hash) pcl.rb write after. Warning: Current Installer (2017年10月02日) Not generated pcl-2d-1.8.pc file.(Issue #119) Reference PointCloudLibrary Issue. circumvent: This is the simpliest method on windows. The wheel contains the PCL binaries _
and thus you do not need to install the original PCL library.
import pcl
p = pcl.load("C/table_scene_lms400.pcd")
fil = p.make_statistical_outlier_filter()
fil.set_mean_k (50)
fil.set_std_dev_mul_thresh (1.0)
fil.filter().to_file("inliers.pcd")
import numpy as np
import pcl
p = pcl.PointCloud(10) # "empty" point cloud
a = np.asarray(p) # NumPy view on the cloud
a[:] = 0 # fill with zeros
print(p[3]) # prints (0.0, 0.0, 0.0)
a[:, 0] = 1 # set x coordinates to 1
print(p[3]) # prints (1.0, 0.0, 0.0)
Installation
Linux(Ubuntu)
before Install module
$ sudo apt-get update -y
$ sudo apt-get install libpcl-dev -y
Reference `here <https://packages.ubuntu.com/search?keywords=libpcl-dev>`_.
before Install module
copy travis/pcl-2d-1.8.pc file to /usr/local/lib/pkgconfig folder.
Windows
Using pip with a precompiled wheel
OpenNI2[(PCL Install FolderPath)3円rdParty\OpenNI\OpenNI-(win32/x64)-1.3.2-Dev.msi]
Case2. use 1.8.1/1.9.1
Visual Studio 2017 C++ Compiler Tools(use Python 3.6.x/3.7.x)
Windows Gtk+ Download Download file unzip. Copy bin Folder to pkg-config Folder
Download file unzip. Copy bin Folder to pkg-config Folder
or execute powershell file [Install-GTKPlus.ps1].
set before Environment variable
- PCL_ROOT
set PCL_ROOT=(PCL Install/Build_Binary FolderPath)
2. PATH
(pcl 1.6.0)
set PATH=%PCL_ROOT%/bin/;%OPEN_NI_ROOT%/Tools;%VTK_ROOT%/bin;%PATH%
(pcl 1.8.1/1.9.1)
set PATH=%PCL_ROOT%/bin/;%OPEN_NI2_ROOT%/Tools;%VTK_ROOT%/bin;%PATH%
pip install --upgrade pip
pip install cython
pip install numpy
python setup.py build_ext -i
python setup.py install
-> conda create -n ipk # create a new conda env. -> conda activate ipk # activate env.
-> conda update -n base -c defaults conda # update conda
-> conda config --add channels conda-forge # add conda-forge channels -> conda install -c sirokujira python-pcl # pcl installation -> conda install -c jithinpr2 gtk3 # Gtk+ Gui dependency -> conda install -y ipython # install ipython -> conda install -y jupyter # install jupyter
After that, run jupyter notebook or ipython shell to test pcl installation.
windows(1.6.0/1.8.1/1.9.1)
https://travis-ci.org/strawlab/python-pcl.svg?branch=master
Point Cloud is a heavily templated API, and consequently mapping this into Python using Cython is challenging.
It is written in Cython, and implements enough hard bits of the API (from Cythons perspective, i.e the template/smart_ptr bits) to provide a foundation for someone wishing to carry on.
PCL API docs, and the /touchmii/python-pcl