/python-pcl

Python bindings to the pointcloud library (pcl)

Primary LanguagePython

Fork me on GitHub

Introduction

This is a small python binding to the pointcloud library. Currently, the following parts of the API are wrapped (all methods operate on PointXYZ) point types

  • I/O and integration; saving and loading PCD files
  • segmentation
  • SAC
  • smoothing
  • filtering

The code tries to follow the Point Cloud API, and also provides helper function for interacting with numpy. For example (from tests/test.py)

import pcl
p = pcl.PointCloud()
p.from_array(np.array([[1,2,3],[3,4,5]], dtype=np.float32)))
seg = self.p.make_segmenter()
seg.set_model_type(pcl.SACMODEL_PLANE)
seg.set_method_type(pcl.SAC_RANSAC)
indices, model = seg.segment()

or, for smoothing

import pcl
p = pcl.PointCloud()
p.from_file("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")

More samples can be found in the examples directory, and in the unit tests.

This work was supported by Strawlab.

Requirements

This release has been tested on Ubuntu 12.10 with

  • pcl 1.5.1-1
  • Cython 0.16-1 (experimental)

A note about types

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.

API Documentation

.. autosummary::
   pcl.PointCloud
   pcl.Segmentation
   pcl.SegmentationNormal
   pcl.StatisticalOutlierRemovalFilter
   pcl.MovingLeastSquares
   pcl.PassThroughFilter
   pcl.VoxelGridFilter

For deficiencies in this documentation, please consule the PCL API docs, and the PCL tutorials.

.. automodule:: pcl
   :members:
   :undoc-members: