Andrew McClune
Andrew McClune

Reputation: 41

Using Point Cloud Library in Python

Hello I am trying to use Point Cloud Library in Python and as I am new to this C++ library and Python I am following the tutorial on http://strawlab.github.io/python-pcl/#pcl.PointCloud

However whenever I try to import pcl and define a module such as pcl.PointCloud() I get the following error;

AttributeError: 'module' object has no attribute 'PointCloud'

I have used sys.path.append to point to the correct directory where the PCL files have been installed as they are not in site packages. It says on the above link that the C++ code has already got Python bindings but I am unsure exactly what files I am trying to call in Python. Does anybody know how to overcome this error and load these modules?

Thanks, Andrew

Upvotes: 4

Views: 12865

Answers (4)

carlton
carlton

Reputation: 1

"""https://blog.pollithy.com/python/numpy/pointcloud/tutorial-pypcd"""

python3.6 -m pip install --user git+https://github.com/DanielPollithy/pypcd.git

Upvotes: 0

Kevin Patel
Kevin Patel

Reputation: 674

Try this,

sudo add-apt-repository ppa:sweptlaser/python3-pcl
sudo apt update
sudo apt install python3-pcl

After you've done that then you should be able to run:

python3 -c 'import pcl'

and it will return with no error (as opposed to ModuleNotFoundError: No module named 'pcl').

Tested on:

Ubuntu 18.04 LTS

Python 3.6.9

Reference: https://askubuntu.com/a/1170661/922137

Upvotes: 1

Jeremy
Jeremy

Reputation: 31

Looks like you need PCL 1.5.1 and cython 0.16 according to this page: http://strawlab.github.io/python-pcl/

Upvotes: 0

aIKid
aIKid

Reputation: 28342

Try skipping the parentheses:

from pcl import PointCloud

And then create an instance of PointCloud, for example, p:

p = PointCloud()

Hope it helps!

Upvotes: 0

Related Questions